From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934945AbcJFUFV (ORCPT ); Thu, 6 Oct 2016 16:05:21 -0400 Received: from mail.kernel.org ([198.145.29.136]:55936 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934902AbcJFUFU (ORCPT ); Thu, 6 Oct 2016 16:05:20 -0400 Date: Thu, 6 Oct 2016 17:05:10 -0300 From: Arnaldo Carvalho de Melo To: Andi Kleen Cc: jolsa@kernel.org, linux-kernel@vger.kernel.org, Andi Kleen Subject: Re: [PATCH 3/3] perf, tools: Fix completion script to handle comma list Message-ID: <20161006200510.GC4809@kernel.org> References: <1475781807-6034-1-git-send-email-andi@firstfloor.org> <1475781807-6034-3-git-send-email-andi@firstfloor.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1475781807-6034-3-git-send-email-andi@firstfloor.org> X-Url: http://acmel.wordpress.com User-Agent: Mutt/1.7.0 (2016-08-17) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Em Thu, Oct 06, 2016 at 12:23:27PM -0700, Andi Kleen escreveu: > From: Andi Kleen > > 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. It works partially, for instance, if I try completing: perf stat -e CPL I get: perf stat -e CPL_CYCLES.RING0 but if I try: perf stat -e cycles,CPL I get nothing :-\ Is this working with you? > v2: Handle conflict with upper case completion patch > Signed-off-by: Andi Kleen > --- > 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