From: Andi Kleen <a...@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 <a...@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 72391ff68f66..582513e004f9 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 vendor | 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

Reply via email to