aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorYunlong Song <yunlong.song@huawei.com>2015-03-18 09:35:46 -0400
committerArnaldo Carvalho de Melo <acme@redhat.com>2015-03-19 12:48:56 -0400
commit02fde323b9aaebb4a21e7c0e04759470b6c07594 (patch)
tree95123a348e701b3041c5a0c77a64fc48446b85a6 /tools
parent76aea7731e7050c066943a1d7456ec6510702601 (diff)
perf tools: Fix the bash completion for listing options of perf subcommand
The bash completion does not support listing options for 'perf kvm|kmem|mem|lock|sched --<TAB>', where 'kvm|kmem|mem|lock|sched' are all subcommands of perf. Example: Before this patch: $ perf kvm --<TAB> $ As shown above, the options of perf kvm does not come out. After this patch: $ perf kvm --<TAB> --alloc --caller --input --line --raw-ip --sort --verbose As shown above, the options of perf kvm can come out now. Signed-off-by: Yunlong Song <yunlong.song@huawei.com> Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com> Cc: Paul Mackerras <paulus@samba.org> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Cc: Wang Nan <wangnan0@huawei.com> Link: http://lkml.kernel.org/r/1426685758-25488-2-git-send-email-yunlong.song@huawei.com Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools')
-rw-r--r--tools/perf/perf-completion.sh21
1 files changed, 12 insertions, 9 deletions
diff --git a/tools/perf/perf-completion.sh b/tools/perf/perf-completion.sh
index c2595e9bd69b..4822ed38e23e 100644
--- a/tools/perf/perf-completion.sh
+++ b/tools/perf/perf-completion.sh
@@ -119,15 +119,18 @@ __perf_main ()
119 elif [[ $prev == "-e" && "${words[1]}" == @(record|stat|top) ]]; then 119 elif [[ $prev == "-e" && "${words[1]}" == @(record|stat|top) ]]; then
120 evts=$($cmd list --raw-dump) 120 evts=$($cmd list --raw-dump)
121 __perfcomp_colon "$evts" "$cur" 121 __perfcomp_colon "$evts" "$cur"
122 # List subcommands for perf commands 122 else
123 elif [[ $prev == @(kvm|kmem|mem|lock|sched) ]]; then 123 # List subcommands for perf commands
124 subcmds=$($cmd $prev --list-cmds) 124 if [[ $prev == @(kvm|kmem|mem|lock|sched) ]]; then
125 __perfcomp_colon "$subcmds" "$cur" 125 subcmds=$($cmd $prev --list-cmds)
126 # List long option names 126 __perfcomp_colon "$subcmds" "$cur"
127 elif [[ $cur == --* ]]; then 127 fi
128 subcmd=${words[1]} 128 # List long option names
129 opts=$($cmd $subcmd --list-opts) 129 if [[ $cur == --* ]]; then
130 __perfcomp "$opts" "$cur" 130 subcmd=${words[1]}
131 opts=$($cmd $subcmd --list-opts)
132 __perfcomp "$opts" "$cur"
133 fi
131 fi 134 fi
132} 135}
133 136