[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <tip-6e0dc374a2c912a8a967ea8a4f9696dd4b0a6d3e@git.kernel.org>
Date: Mon, 14 Oct 2013 22:23:27 -0700
From: tip-bot for Ramkumar Ramachandra <tipbot@...or.com>
To: linux-tip-commits@...r.kernel.org
Cc: acme@...hat.com, linux-kernel@...r.kernel.org, hpa@...or.com,
mingo@...nel.org, fweisbec@...il.com, artagnon@...il.com,
tglx@...utronix.de
Subject: [tip:perf/core] perf completion: Use more comp words
Commit-ID: 6e0dc374a2c912a8a967ea8a4f9696dd4b0a6d3e
Gitweb: http://git.kernel.org/tip/6e0dc374a2c912a8a967ea8a4f9696dd4b0a6d3e
Author: Ramkumar Ramachandra <artagnon@...il.com>
AuthorDate: Thu, 4 Jul 2013 18:11:31 +0530
Committer: Arnaldo Carvalho de Melo <acme@...hat.com>
CommitDate: Wed, 9 Oct 2013 11:12:31 -0300
perf completion: Use more comp words
The completion words $words and $cword are available, so we might as
well use them instead of directly accessing COMP_WORDS.
Signed-off-by: Ramkumar Ramachandra <artagnon@...il.com>
Cc: Frederic Weisbecker <fweisbec@...il.com>
Link: http://lkml.kernel.org/r/1372941691-14684-8-git-send-email-artagnon@gmail.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@...hat.com>
---
tools/perf/bash_completion | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/tools/perf/bash_completion b/tools/perf/bash_completion
index ee9c6d8..62e157db 100644
--- a/tools/perf/bash_completion
+++ b/tools/perf/bash_completion
@@ -92,15 +92,15 @@ __ltrim_colon_completions()
type perf &>/dev/null &&
_perf()
{
- local cur prev cmd
+ local cur words cword prev cmd
COMPREPLY=()
- _get_comp_words_by_ref -n : cur prev
+ _get_comp_words_by_ref -n =: cur words cword prev
- cmd=${COMP_WORDS[0]}
+ cmd=${words[0]}
# List perf subcommands or long options
- if [ $COMP_CWORD -eq 1 ]; then
+ if [ $cword -eq 1 ]; then
if [[ $cur == --* ]]; then
COMPREPLY=( $( compgen -W '--help --version \
--exec-path --html-path --paginate --no-pager \
@@ -110,13 +110,13 @@ _perf()
COMPREPLY=( $( compgen -W '$cmds' -- "$cur" ) )
fi
# List possible events for -e option
- elif [[ $prev == "-e" && "${COMP_WORDS[1]}" == @(record|stat|top) ]]; then
+ elif [[ $prev == "-e" && "${words[1]}" == @(record|stat|top) ]]; then
evts=$($cmd list --raw-dump)
COMPREPLY=( $( compgen -W '$evts' -- "$cur" ) )
__ltrim_colon_completions $cur
# List long option names
elif [[ $cur == --* ]]; then
- subcmd=${COMP_WORDS[1]}
+ subcmd=${words[1]}
opts=$($cmd $subcmd --list-opts)
COMPREPLY=( $( compgen -W '$opts' -- "$cur" ) )
fi
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists