From: Ramkumar Ramachandra <artagnon@gmail.com>
To: LKML <linux-kernel@vger.kernel.org>
Cc: Ingo Molnar <mingo@kernel.org>,
Arnaldo Carvalho de Melo <acme@ghostprotocols.net>,
Ingo Molnar <mingo@redhat.com>
Subject: [PATCH 3/5] perf completion: factor out call to __ltrim_colon_completions
Date: Sun, 17 Nov 2013 21:43:25 +0530 [thread overview]
Message-ID: <1384704807-15779-4-git-send-email-artagnon@gmail.com> (raw)
In-Reply-To: <1384704807-15779-1-git-send-email-artagnon@gmail.com>
In our sole callsite, __ltrim_colon_completions is called after
__perfcomp, to modify the COMPREPLY set by the invocation. This is
problematic, because in the zsh equivalent (using compset/ compadd),
we'll have to generate completions in one-shot. So factor out this
entire callsite into a special override'able __perfcomp_colon function;
we will override it when introducing zsh support.
Cc: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
Cc: Ingo Molnar <mingo@redhat.com>
Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>
---
tools/perf/bash_completion | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/tools/perf/bash_completion b/tools/perf/bash_completion
index 82431268..573599b 100644
--- a/tools/perf/bash_completion
+++ b/tools/perf/bash_completion
@@ -94,6 +94,12 @@ __perfcomp ()
COMPREPLY=( $( compgen -W "$1" -- "$2" ) )
}
+__perfcomp_colon ()
+{
+ __perfcomp "$1" "$2"
+ __ltrim_colon_completions $cur
+}
+
__perf_main ()
{
local cmd
@@ -114,8 +120,7 @@ __perf_main ()
# List possible events for -e option
elif [[ $prev == "-e" && "${words[1]}" == @(record|stat|top) ]]; then
evts=$($cmd list --raw-dump)
- __perfcomp "$evts" "$cur"
- __ltrim_colon_completions $cur
+ __perfcomp_colon "$evts" "$cur"
# List long option names
elif [[ $cur == --* ]]; then
subcmd=${words[1]}
--
1.8.5.rc0.6.gfd75b41
next prev parent reply other threads:[~2013-11-17 16:22 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:perf/core] perf completion: Introduce " tip-bot for Ramkumar Ramachandra
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 ` Ramkumar Ramachandra [this message]
2013-11-30 12:49 ` [tip:perf/core] perf completion: Factor out call to __ltrim_colon_completions 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=1384704807-15779-4-git-send-email-artagnon@gmail.com \
--to=artagnon@gmail.com \
--cc=acme@ghostprotocols.net \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=mingo@redhat.com \
/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