aboutsummaryrefslogtreecommitdiffhomepage
path: root/debian
diff options
context:
space:
mode:
authorGuido Günther <agx@sigxcpu.org>2016-12-20 08:02:28 +0100
committerGuido Günther <agx@sigxcpu.org>2016-12-20 08:02:28 +0100
commit6f5070dd0921a431f15563aa9041760d11b36d0b (patch)
tree6df9a543052ee6e2095f81ee4fcd6e2802c70238 /debian
parent67cf3ed1bb667816baff586b75d991142d1840ef (diff)
bash completion: don't complete options values with options
So far hitting <tab. on --bar= would have all other options as suggestions.
Diffstat (limited to 'debian')
-rw-r--r--debian/gbp.completion8
1 files changed, 7 insertions, 1 deletions
diff --git a/debian/gbp.completion b/debian/gbp.completion
index 5bb23eac..43e78901 100644
--- a/debian/gbp.completion
+++ b/debian/gbp.completion
@@ -53,11 +53,13 @@ _gbp_comp ()
local tristate_opts=${4:-"--color\="}
local cbdist_opts=${5:-"--git-dist\="}
local remote_config_opts="--remote-config\="
+ local start_opt=""
# COMPREPLY considers '=' as a word. For $prev we prefer the word before the actual "="
if [[ "$prev" == "=" ]]; then
prev="${COMP_WORDS[COMP_CWORD - 2]}"
elif [[ "$cur" == "=" ]]; then
+ start_opt=1
cur=""
fi
@@ -96,7 +98,11 @@ _gbp_comp ()
tab_opts=$(echo "$options" | sed -e 's/ \+/\t/g' -e 's/[^=]$/& /g')
type compopt &>/dev/null && compopt -o nospace
local IFS=$'\t\n'
- COMPREPLY=($(compgen -W "$tab_opts" -- $cur))
+ if [ -n "$start_opt" ]; then
+ COMPREPLY="" # we don't have any good suggestions
+ else
+ COMPREPLY=($(compgen -W "$tab_opts" -- $cur))
+ fi
}
# check if we can find a gbp command on the commandline