From: tip-bot for Ramkumar Ramachandra <tipbot@zytor.com>
To: linux-tip-commits@vger.kernel.org
Cc: acme@redhat.com, linux-kernel@vger.kernel.org, hpa@zytor.com,
mingo@kernel.org, artagnon@gmail.com, tglx@linutronix.de
Subject: [tip:perf/core] perf completion: Introduce a layer of indirection
Date: Sat, 30 Nov 2013 04:49:38 -0800 [thread overview]
Message-ID: <tip-2cf025e69543f5f4aa68e8549d60680515fef5ad@git.kernel.org> (raw)
In-Reply-To: <1384704807-15779-2-git-send-email-artagnon@gmail.com>
Commit-ID: 2cf025e69543f5f4aa68e8549d60680515fef5ad
Gitweb: http://git.kernel.org/tip/2cf025e69543f5f4aa68e8549d60680515fef5ad
Author: Ramkumar Ramachandra <artagnon@gmail.com>
AuthorDate: Sun, 17 Nov 2013 21:43:23 +0530
Committer: Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Wed, 27 Nov 2013 14:58:35 -0300
perf completion: Introduce a layer of indirection
Define the variables cur, words, cword, and prev outside the main
completion function so that we have a chance to override it when we
introduce zsh support.
Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>
Cc: Ingo Molnar <mingo@kernel.org>
Link: http://lkml.kernel.org/r/1384704807-15779-2-git-send-email-artagnon@gmail.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/bash_completion | 17 +++++++++++------
1 file changed, 11 insertions(+), 6 deletions(-)
diff --git a/tools/perf/bash_completion b/tools/perf/bash_completion
index 62e157db..3efdc84 100644
--- a/tools/perf/bash_completion
+++ b/tools/perf/bash_completion
@@ -89,15 +89,12 @@ __ltrim_colon_completions()
fi
}
-type perf &>/dev/null &&
-_perf()
+__perf_main ()
{
- local cur words cword prev cmd
-
- COMPREPLY=()
- _get_comp_words_by_ref -n =: cur words cword prev
+ local cmd
cmd=${words[0]}
+ COMPREPLY=()
# List perf subcommands or long options
if [ $cword -eq 1 ]; then
@@ -120,6 +117,14 @@ _perf()
opts=$($cmd $subcmd --list-opts)
COMPREPLY=( $( compgen -W '$opts' -- "$cur" ) )
fi
+}
+
+type perf &>/dev/null &&
+_perf()
+{
+ local cur words cword prev
+ _get_comp_words_by_ref -n =: cur words cword prev
+ __perf_main
} &&
complete -o bashdefault -o default -o nospace -F _perf perf 2>/dev/null \
next prev parent reply other threads:[~2013-11-30 12:49 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-11-17 16:13 [PATCH 0/5] zsh support for perf completion Ramkumar Ramachandra
2013-11-17 16:13 ` [PATCH 1/5] perf completion: introduce a layer of indirection Ramkumar Ramachandra
2013-11-30 12:49 ` tip-bot for Ramkumar Ramachandra [this message]
2013-11-17 16:13 ` [PATCH 2/5] perf completion: factor out compgen stuff Ramkumar Ramachandra
2013-11-30 12:49 ` [tip:perf/core] perf completion: Factor " tip-bot for Ramkumar Ramachandra
2013-11-17 16:13 ` [PATCH 3/5] perf completion: factor out call to __ltrim_colon_completions Ramkumar Ramachandra
2013-11-30 12:49 ` [tip:perf/core] perf completion: Factor " tip-bot for Ramkumar Ramachandra
2013-11-17 16:13 ` [PATCH 4/5] perf completion: introduce zsh support Ramkumar Ramachandra
2013-11-30 12:50 ` [tip:perf/core] perf completion: Introduce " tip-bot for Ramkumar Ramachandra
2013-11-17 16:13 ` [PATCH 5/5] perf completion: rename file to reflect " Ramkumar Ramachandra
2013-11-30 12:50 ` [tip:perf/core] perf completion: Rename " tip-bot for Ramkumar Ramachandra
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=tip-2cf025e69543f5f4aa68e8549d60680515fef5ad@git.kernel.org \
--to=tipbot@zytor.com \
--cc=acme@redhat.com \
--cc=artagnon@gmail.com \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tip-commits@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=tglx@linutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox