diff options
| author | Ramkumar Ramachandra <artagnon@gmail.com> | 2013-07-04 08:41:31 -0400 |
|---|---|---|
| committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2013-10-09 10:12:31 -0400 |
| commit | 6e0dc374a2c912a8a967ea8a4f9696dd4b0a6d3e (patch) | |
| tree | 1d4ea81721da7455a110d3df265eb34da4ffa5d4 /tools/perf/bash_completion | |
| parent | c3fb6717e90049b93d0f5f5714a4d878799d89c2 (diff) | |
perf completion: Use more comp words
The completion words $words and $cword are available, so we might as
well use them instead of directly accessing COMP_WORDS.
Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Link: http://lkml.kernel.org/r/1372941691-14684-8-git-send-email-artagnon@gmail.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/bash_completion')
| -rw-r--r-- | tools/perf/bash_completion | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/tools/perf/bash_completion b/tools/perf/bash_completion index ee9c6d85f2c9..62e157db2e2b 100644 --- a/tools/perf/bash_completion +++ b/tools/perf/bash_completion | |||
| @@ -92,15 +92,15 @@ __ltrim_colon_completions() | |||
| 92 | type perf &>/dev/null && | 92 | type perf &>/dev/null && |
| 93 | _perf() | 93 | _perf() |
| 94 | { | 94 | { |
| 95 | local cur prev cmd | 95 | local cur words cword prev cmd |
| 96 | 96 | ||
| 97 | COMPREPLY=() | 97 | COMPREPLY=() |
| 98 | _get_comp_words_by_ref -n : cur prev | 98 | _get_comp_words_by_ref -n =: cur words cword prev |
| 99 | 99 | ||
| 100 | cmd=${COMP_WORDS[0]} | 100 | cmd=${words[0]} |
| 101 | 101 | ||
| 102 | # List perf subcommands or long options | 102 | # List perf subcommands or long options |
| 103 | if [ $COMP_CWORD -eq 1 ]; then | 103 | if [ $cword -eq 1 ]; then |
| 104 | if [[ $cur == --* ]]; then | 104 | if [[ $cur == --* ]]; then |
| 105 | COMPREPLY=( $( compgen -W '--help --version \ | 105 | COMPREPLY=( $( compgen -W '--help --version \ |
| 106 | --exec-path --html-path --paginate --no-pager \ | 106 | --exec-path --html-path --paginate --no-pager \ |
| @@ -110,13 +110,13 @@ _perf() | |||
| 110 | COMPREPLY=( $( compgen -W '$cmds' -- "$cur" ) ) | 110 | COMPREPLY=( $( compgen -W '$cmds' -- "$cur" ) ) |
| 111 | fi | 111 | fi |
| 112 | # List possible events for -e option | 112 | # List possible events for -e option |
| 113 | elif [[ $prev == "-e" && "${COMP_WORDS[1]}" == @(record|stat|top) ]]; then | 113 | elif [[ $prev == "-e" && "${words[1]}" == @(record|stat|top) ]]; then |
| 114 | evts=$($cmd list --raw-dump) | 114 | evts=$($cmd list --raw-dump) |
| 115 | COMPREPLY=( $( compgen -W '$evts' -- "$cur" ) ) | 115 | COMPREPLY=( $( compgen -W '$evts' -- "$cur" ) ) |
| 116 | __ltrim_colon_completions $cur | 116 | __ltrim_colon_completions $cur |
| 117 | # List long option names | 117 | # List long option names |
| 118 | elif [[ $cur == --* ]]; then | 118 | elif [[ $cur == --* ]]; then |
| 119 | subcmd=${COMP_WORDS[1]} | 119 | subcmd=${words[1]} |
| 120 | opts=$($cmd $subcmd --list-opts) | 120 | opts=$($cmd $subcmd --list-opts) |
| 121 | COMPREPLY=( $( compgen -W '$opts' -- "$cur" ) ) | 121 | COMPREPLY=( $( compgen -W '$opts' -- "$cur" ) ) |
| 122 | fi | 122 | fi |
