bash: fix long option with argument double completion
Pressing TAB right after 'git command --long-option=' results in 'git command --long-option=--long-option=' when the long option requires an argument, but we don't provide completion for its arguments (e.g. commit --author=, apply --exclude=). This patch detects these long options and provides empty completion array for them. Signed-off-by: SZEDER Gábor <szeder@ira.uka.de> Signed-off-by: Shawn O. Pearce <spearce@spearce.org>maint
parent
ce5a2c956f
commit
5447aac755
|
@ -121,13 +121,21 @@ __gitcomp ()
|
||||||
if [ $# -gt 2 ]; then
|
if [ $# -gt 2 ]; then
|
||||||
cur="$3"
|
cur="$3"
|
||||||
fi
|
fi
|
||||||
for c in $1; do
|
case "$cur" in
|
||||||
case "$c$4" in
|
--*=)
|
||||||
--*=*) all="$all$c$4$s" ;;
|
COMPREPLY=()
|
||||||
*.) all="$all$c$4$s" ;;
|
return
|
||||||
*) all="$all$c$4 $s" ;;
|
;;
|
||||||
esac
|
*)
|
||||||
done
|
for c in $1; do
|
||||||
|
case "$c$4" in
|
||||||
|
--*=*) all="$all$c$4$s" ;;
|
||||||
|
*.) all="$all$c$4$s" ;;
|
||||||
|
*) all="$all$c$4 $s" ;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
;;
|
||||||
|
esac
|
||||||
IFS=$s
|
IFS=$s
|
||||||
COMPREPLY=($(compgen -P "$2" -W "$all" -- "$cur"))
|
COMPREPLY=($(compgen -P "$2" -W "$all" -- "$cur"))
|
||||||
return
|
return
|
||||||
|
|
Loading…
Reference in New Issue