aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorNamhyung Kim <namhyung@kernel.org>2012-10-02 11:21:32 -0400
committerArnaldo Carvalho de Melo <acme@redhat.com>2012-10-02 17:36:42 -0400
commita1d668c3ffd38d611f8446615e8f797dcfdfc397 (patch)
treea9a40bf0f2ae0cfc2ec494f8d30ed27c546d6b28 /tools
parent002439e84ed67cbb33cab4057fcd6a4146c0f815 (diff)
perf tools: Check existence of _get_comp_words_by_ref when bash completing
The '_get_comp_words_by_ref' function is available from the bash completion v1.2 so that earlier version emits following warning: $ perf re<TAB>_get_comp_words_by_ref: command not found Use older '_get_cword' method when the above function doesn't exist. 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-2-git-send-email-namhyung@kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools')
-rw-r--r--tools/perf/bash_completion15
1 files changed, 13 insertions, 2 deletions
diff --git a/tools/perf/bash_completion b/tools/perf/bash_completion
index 1958fa539d0f..3d48cee1b5e5 100644
--- a/tools/perf/bash_completion
+++ b/tools/perf/bash_completion
@@ -1,12 +1,23 @@
1# perf completion 1# perf completion
2 2
3function_exists()
4{
5 declare -F $1 > /dev/null
6 return $?
7}
8
3have perf && 9have perf &&
4_perf() 10_perf()
5{ 11{
6 local cur cmd 12 local cur prev cmd
7 13
8 COMPREPLY=() 14 COMPREPLY=()
9 _get_comp_words_by_ref cur prev 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
10 21
11 cmd=${COMP_WORDS[0]} 22 cmd=${COMP_WORDS[0]}
12 23