diff options
-rw-r--r-- | tools/perf/bash_completion | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/tools/perf/bash_completion b/tools/perf/bash_completion index 62e157db2e2b..3efdc84f112c 100644 --- a/tools/perf/bash_completion +++ b/tools/perf/bash_completion | |||
@@ -89,15 +89,12 @@ __ltrim_colon_completions() | |||
89 | fi | 89 | fi |
90 | } | 90 | } |
91 | 91 | ||
92 | type perf &>/dev/null && | 92 | __perf_main () |
93 | _perf() | ||
94 | { | 93 | { |
95 | local cur words cword prev cmd | 94 | local cmd |
96 | |||
97 | COMPREPLY=() | ||
98 | _get_comp_words_by_ref -n =: cur words cword prev | ||
99 | 95 | ||
100 | cmd=${words[0]} | 96 | cmd=${words[0]} |
97 | COMPREPLY=() | ||
101 | 98 | ||
102 | # List perf subcommands or long options | 99 | # List perf subcommands or long options |
103 | if [ $cword -eq 1 ]; then | 100 | if [ $cword -eq 1 ]; then |
@@ -120,6 +117,14 @@ _perf() | |||
120 | opts=$($cmd $subcmd --list-opts) | 117 | opts=$($cmd $subcmd --list-opts) |
121 | COMPREPLY=( $( compgen -W '$opts' -- "$cur" ) ) | 118 | COMPREPLY=( $( compgen -W '$opts' -- "$cur" ) ) |
122 | fi | 119 | fi |
120 | } | ||
121 | |||
122 | type perf &>/dev/null && | ||
123 | _perf() | ||
124 | { | ||
125 | local cur words cword prev | ||
126 | _get_comp_words_by_ref -n =: cur words cword prev | ||
127 | __perf_main | ||
123 | } && | 128 | } && |
124 | 129 | ||
125 | complete -o bashdefault -o default -o nospace -F _perf perf 2>/dev/null \ | 130 | complete -o bashdefault -o default -o nospace -F _perf perf 2>/dev/null \ |