Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1496825

[PATCH 3/3] perf, tools: Fix completion script to handle comma list

From Andi Kleen <andi@firstfloor.org>
Newsgroups linux.kernel
Subject [PATCH 3/3] perf, tools: Fix completion script to handle comma list
Date 2016-10-06 21:30 +0200
Message-ID <spmwF-5ch-13@gated-at.bofh.it> (permalink)
References <spmwF-5ch-5@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


From: Andi Kleen <ak@linux.intel.com>

The perf event completion script only handled a single event per
-e option. So for "perf stat -e cycles,branches" branches could
not be completed.

Fix that issue by always only using the last suffix for completion.

For some reason it only works in bash currently, but zsh
is the same as before.

v2: Handle conflict with upper case completion patch
Signed-off-by: Andi Kleen <ak@linux.intel.com>
---
 tools/perf/perf-completion.sh | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/tools/perf/perf-completion.sh b/tools/perf/perf-completion.sh
index 3b5a258a4b7b..819a1346689f 100644
--- a/tools/perf/perf-completion.sh
+++ b/tools/perf/perf-completion.sh
@@ -166,7 +166,11 @@ __perf_main ()
 			[[:upper:]]*) evts=$($cmd list --raw-dump json | tr a-z A-Z) ;;
 			*) evts=$($cmd list --raw-dump) ;;
 		esac
+		old="$cur"
+		cur="${cur/*[,{]/}"
+		prefix=${old%$cur}
 		__perfcomp_colon "$evts" "$cur"
+		COMPREPLY=("${prefix}${COMPREPLY[0]}")
 	else
 		# List subcommands for perf commands
 		if [[ $prev_skip_opts == @(kvm|kmem|mem|lock|sched|
-- 
2.5.5

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 1/3] perf, tools: Add support for perf list json Andi Kleen <andi@firstfloor.org> - 2016-10-06 21:30 +0200
  [PATCH 3/3] perf, tools: Fix completion script to handle comma list Andi Kleen <andi@firstfloor.org> - 2016-10-06 21:30 +0200
    Re: [PATCH 3/3] perf, tools: Fix completion script to handle comma  list Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-10-06 22:10 +0200
      Re: [PATCH 3/3] perf, tools: Fix completion script to handle comma  list Andi Kleen <ak@linux.intel.com> - 2016-10-06 22:10 +0200
        Re: [PATCH 3/3] perf, tools: Fix completion script to handle comma  list Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-10-06 22:40 +0200
          Re: [PATCH 3/3] perf, tools: Fix completion script to handle comma  list Andi Kleen <ak@linux.intel.com> - 2016-10-06 22:50 +0200
  Re: [PATCH 1/3] perf, tools: Add support for perf list json Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-10-06 22:10 +0200

csiph-web