aboutsummaryrefslogtreecommitdiff
path: root/tools/perf/bash_completion
diff options
context:
space:
mode:
authorFrederic Weisbecker <fweisbec@gmail.com>2012-08-09 16:31:51 +0200
committerArnaldo Carvalho de Melo <acme@redhat.com>2012-08-09 15:58:51 -0300
commit98a4179c9aa1e99adf5103e6e0d05f563d902de1 (patch)
tree7dc88426528560f39e48b51df305677879e2385a /tools/perf/bash_completion
parentd25dcba8541c1cc31621d5cefce0304dafb9ae4f (diff)
perf tools: Initial bash completion support
This implements bash completion for perf subcommands such as record, report, script, probe, etc... Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com> Cc: David Ahern <dsahern@gmail.com> Cc: Ingo Molnar <mingo@kernel.org> Cc: Jiri Olsa <jolsa@redhat.com> Cc: Namhyung Kim <namhyung@gmail.com> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Cc: Stephane Eranian <eranian@google.com> Link: http://lkml.kernel.org/r/1344522713-27951-2-git-send-email-fweisbec@gmail.com Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/bash_completion')
-rw-r--r--tools/perf/bash_completion22
1 files changed, 22 insertions, 0 deletions
diff --git a/tools/perf/bash_completion b/tools/perf/bash_completion
new file mode 100644
index 00000000000..9a31fa5ed2a
--- /dev/null
+++ b/tools/perf/bash_completion
@@ -0,0 +1,22 @@
+# perf completion
+
+have perf &&
+_perf()
+{
+ local cur cmd
+
+ COMPREPLY=()
+ _get_comp_words_by_ref cur
+
+ cmd=${COMP_WORDS[0]}
+
+ # List perf subcommands
+ if [ $COMP_CWORD -eq 1 ]; then
+ cmds=$($cmd --list-cmds)
+ COMPREPLY=( $( compgen -W '$cmds' -- "$cur" ) )
+ # Fall down to list regular files
+ else
+ _filedir
+ fi
+} &&
+complete -F _perf perf