summaryrefslogtreecommitdiff
path: root/tools/perf/bash_completion
diff options
context:
space:
mode:
authorNamhyung Kim <namhyung@kernel.org>2012-10-02 19:21:34 +0400
committerArnaldo Carvalho de Melo <acme@redhat.com>2012-10-03 01:36:44 +0400
commit4d8061faca7a50010f037374410f0c3647c3ecf8 (patch)
tree820c67bbdd04d129826888aef56ddf18a6cd516e /tools/perf/bash_completion
parent35c2fde1155cc7225361edf43d8efd0aabd28a0c (diff)
downloadlinux-4d8061faca7a50010f037374410f0c3647c3ecf8.tar.xz
perf tools: Long option completion support for each subcommands
Add internal --list-opts option to print all of long option names to stdout so that it can be used for bash completion engine. Signed-off-by: Namhyung Kim <namhyung@kernel.org> Acked-by: Frederic Weisbecker <fweisbec@gmail.com> Cc: David Ahern <dsahern@gmail.com> Cc: Frederic Weisbecker <fweisbec@gmail.com> Cc: Ingo Molnar <mingo@kernel.org> Cc: Peter Zijlstra <peterz@infradead.org> Link: http://lkml.kernel.org/r/1349191294-6926-4-git-send-email-namhyung@kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/bash_completion')
-rw-r--r--tools/perf/bash_completion9
1 files changed, 7 insertions, 2 deletions
diff --git a/tools/perf/bash_completion b/tools/perf/bash_completion
index bef06f0deeb5..5c355ababf80 100644
--- a/tools/perf/bash_completion
+++ b/tools/perf/bash_completion
@@ -33,8 +33,13 @@ _perf()
fi
# List possible events for -e option
elif [[ $prev == "-e" && "${COMP_WORDS[1]}" == @(record|stat|top) ]]; then
- cmds=$($cmd list --raw-dump)
- COMPREPLY=( $( compgen -W '$cmds' -- "$cur" ) )
+ evts=$($cmd list --raw-dump)
+ COMPREPLY=( $( compgen -W '$evts' -- "$cur" ) )
+ # List long option names
+ elif [[ $cur == --* ]]; then
+ subcmd=${COMP_WORDS[1]}
+ opts=$($cmd $subcmd --list-opts)
+ COMPREPLY=( $( compgen -W '$opts' -- "$cur" ) )
# Fall down to list regular files
else
_filedir