Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 333960
b: refs/heads/master
c: ae0c1f9
h: refs/heads/master
v: v3
  • Loading branch information
Namhyung Kim authored and Arnaldo Carvalho de Melo committed Oct 4, 2012
1 parent 7da0ea3 commit 7fb0a9c
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: e60fc847cefa34d9b7a60f8fbbe3f7dc68fbd75e
refs/heads/master: ae0c1f993411d88bf54c9e20a4249ebcc7a041f9
18 changes: 16 additions & 2 deletions trunk/tools/perf/bash_completion
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,29 @@ function_exists()
return $?
}

function_exists __ltrim_colon_completions ||
__ltrim_colon_completions()
{
if [[ "$1" == *:* && "$COMP_WORDBREAKS" == *:* ]]; then
# Remove colon-word prefix from COMPREPLY items
local colon_word=${1%${1##*:}}
local i=${#COMPREPLY[*]}
while [[ $((--i)) -ge 0 ]]; do
COMPREPLY[$i]=${COMPREPLY[$i]#"$colon_word"}
done
fi
}

have perf &&
_perf()
{
local cur prev cmd

COMPREPLY=()
if function_exists _get_comp_words_by_ref; then
_get_comp_words_by_ref cur prev
_get_comp_words_by_ref -n : cur prev
else
cur=$(_get_cword)
cur=$(_get_cword :)
prev=${COMP_WORDS[COMP_CWORD-1]}
fi

Expand All @@ -35,6 +48,7 @@ _perf()
elif [[ $prev == "-e" && "${COMP_WORDS[1]}" == @(record|stat|top) ]]; then
evts=$($cmd list --raw-dump)
COMPREPLY=( $( compgen -W '$evts' -- "$cur" ) )
__ltrim_colon_completions $cur
# List long option names
elif [[ $cur == --* ]]; then
subcmd=${COMP_WORDS[1]}
Expand Down

0 comments on commit 7fb0a9c

Please sign in to comment.