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


Groups > linux.kernel > #1485899 > unrolled thread

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

Started byAndi Kleen <andi@firstfloor.org>
First post2016-09-18 20:20 +0200
Last post2016-09-18 20:20 +0200
Articles 1 — 1 participant

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH 2/2] perf, tools: Fix completion script to handle comma list Andi Kleen <andi@firstfloor.org> - 2016-09-18 20:20 +0200

#1485899 — [PATCH 2/2] perf, tools: Fix completion script to handle comma list

FromAndi Kleen <andi@firstfloor.org>
Date2016-09-18 20:20 +0200
Subject[PATCH 2/2] perf, tools: Fix completion script to handle comma list
Message-ID<siOR3-35Q-5@gated-at.bofh.it>
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 some reason it only works in bash currently, but zsh
is the same as before.

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 3ba80b2359cc..14c2be73b6fd 100644
--- a/tools/perf/perf-completion.sh
+++ b/tools/perf/perf-completion.sh
@@ -162,7 +162,11 @@ __perf_main ()
 	elif [[ $prev == @("-e"|"--event") &&
 		$prev_skip_opts == @(record|stat|top) ]]; then
 		evts=$($cmd list --raw-dump)
+		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

[toc] | [standalone]


Back to top | Article view | linux.kernel


csiph-web