perf evlist: Remove some unused methods
[deliverable/linux.git] / tools / perf / bash_completion
CommitLineData
98a4179c
FW
1# perf completion
2
a1d668c3
NK
3function_exists()
4{
5 declare -F $1 > /dev/null
6 return $?
7}
8
98a4179c
FW
9have perf &&
10_perf()
11{
a1d668c3 12 local cur prev cmd
98a4179c
FW
13
14 COMPREPLY=()
a1d668c3
NK
15 if function_exists _get_comp_words_by_ref; then
16 _get_comp_words_by_ref cur prev
17 else
18 cur=$(_get_cword)
19 prev=${COMP_WORDS[COMP_CWORD-1]}
20 fi
98a4179c
FW
21
22 cmd=${COMP_WORDS[0]}
23
35c2fde1 24 # List perf subcommands or long options
98a4179c 25 if [ $COMP_CWORD -eq 1 ]; then
35c2fde1
NK
26 if [[ $cur == --* ]]; then
27 COMPREPLY=( $( compgen -W '--help --version \
28 --exec-path --html-path --paginate --no-pager \
29 --perf-dir --work-tree --debugfs-dir' -- "$cur" ) )
30 else
31 cmds=$($cmd --list-cmds)
32 COMPREPLY=( $( compgen -W '$cmds' -- "$cur" ) )
33 fi
a3277d2d
FW
34 # List possible events for -e option
35 elif [[ $prev == "-e" && "${COMP_WORDS[1]}" == @(record|stat|top) ]]; then
4d8061fa
NK
36 evts=$($cmd list --raw-dump)
37 COMPREPLY=( $( compgen -W '$evts' -- "$cur" ) )
38 # List long option names
39 elif [[ $cur == --* ]]; then
40 subcmd=${COMP_WORDS[1]}
41 opts=$($cmd $subcmd --list-opts)
42 COMPREPLY=( $( compgen -W '$opts' -- "$cur" ) )
98a4179c
FW
43 # Fall down to list regular files
44 else
45 _filedir
46 fi
47} &&
48complete -F _perf perf
This page took 0.029639 seconds and 5 git commands to generate.