Commit 37e72c31 authored by Ramkumar Ramachandra's avatar Ramkumar Ramachandra Committed by Arnaldo Carvalho de Melo

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: default avatarRamkumar Ramachandra <artagnon@gmail.com>
Cc: Ingo Molnar <mingo@kernel.org>
Link: http://lkml.kernel.org/r/1384704807-15779-4-git-send-email-artagnon@gmail.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent 12f9dd50
......@@ -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]}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment