public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
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: Factor out call to __ltrim_colon_completions
Date: Sat, 30 Nov 2013 04:49:57 -0800	[thread overview]
Message-ID: <tip-37e72c31061521d6f0e4b7fe47cd5748280ed691@git.kernel.org> (raw)
In-Reply-To: <1384704807-15779-4-git-send-email-artagnon@gmail.com>

Commit-ID:  37e72c31061521d6f0e4b7fe47cd5748280ed691
Gitweb:     http://git.kernel.org/tip/37e72c31061521d6f0e4b7fe47cd5748280ed691
Author:     Ramkumar Ramachandra <artagnon@gmail.com>
AuthorDate: Sun, 17 Nov 2013 21:43:25 +0530
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Wed, 27 Nov 2013 14:58:35 -0300

perf completion: Factor out call to __ltrim_colon_completions

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.

Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>
Cc: Ingo Molnar <mingo@kernel.org>
Link: http://lkml.kernel.org/r/1384704807-15779-4-git-send-email-artagnon@gmail.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.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]}

  reply	other threads:[~2013-11-30 12:50 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 ` [PATCH 3/5] perf completion: factor out call to __ltrim_colon_completions Ramkumar Ramachandra
2013-11-30 12:49   ` tip-bot for Ramkumar Ramachandra [this message]
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-37e72c31061521d6f0e4b7fe47cd5748280ed691@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