diff options
Diffstat (limited to 'tools/perf/bash_completion')
-rw-r--r-- | tools/perf/bash_completion | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/tools/perf/bash_completion b/tools/perf/bash_completion new file mode 100644 index 000000000000..1958fa539d0f --- /dev/null +++ b/tools/perf/bash_completion | |||
@@ -0,0 +1,26 @@ | |||
1 | # perf completion | ||
2 | |||
3 | have perf && | ||
4 | _perf() | ||
5 | { | ||
6 | local cur cmd | ||
7 | |||
8 | COMPREPLY=() | ||
9 | _get_comp_words_by_ref cur prev | ||
10 | |||
11 | cmd=${COMP_WORDS[0]} | ||
12 | |||
13 | # List perf subcommands | ||
14 | if [ $COMP_CWORD -eq 1 ]; then | ||
15 | cmds=$($cmd --list-cmds) | ||
16 | COMPREPLY=( $( compgen -W '$cmds' -- "$cur" ) ) | ||
17 | # List possible events for -e option | ||
18 | elif [[ $prev == "-e" && "${COMP_WORDS[1]}" == @(record|stat|top) ]]; then | ||
19 | cmds=$($cmd list --raw-dump) | ||
20 | COMPREPLY=( $( compgen -W '$cmds' -- "$cur" ) ) | ||
21 | # Fall down to list regular files | ||
22 | else | ||
23 | _filedir | ||
24 | fi | ||
25 | } && | ||
26 | complete -F _perf perf | ||