No need to test for COMPREPLY count when toggling nospace.
It only takes effect if there's only one completion anyway.
This commit is contained in:
parent
5cd5993211
commit
48ffb0ac6d
@ -78,8 +78,7 @@ _java_classes()
|
||||
$( compgen -f -X '!*.class' -- "$i/$cur" | \
|
||||
sed -e '/\$/d' -e "s|^$i/||" )
|
||||
)
|
||||
[[ ${#COMPREPLY[@]} == 1 && ${COMPREPLY[0]} == *.class ]] && \
|
||||
compopt +o nospace &>/dev/null
|
||||
[[ $COMPREPLY == *.class ]] && compopt +o nospace &>/dev/null
|
||||
|
||||
# FIXME: if we have foo.class and foo/, the completion
|
||||
# returns "foo/"... how to give precedence to files
|
||||
@ -232,8 +231,7 @@ _java()
|
||||
fi
|
||||
fi
|
||||
|
||||
[[ ${#COMPREPLY[@]} -eq 1 && ${COMPREPLY[0]} == -*[:=] ]] && \
|
||||
compopt -o nospace
|
||||
[[ $COMPREPLY == -*[:=] ]] && compopt -o nospace
|
||||
|
||||
__ltrim_colon_completions "$cur"
|
||||
} &&
|
||||
@ -380,8 +378,7 @@ _pack200()
|
||||
--method-attribute= --code-attribute= --config-file= \
|
||||
--verbose --quiet --log-file= --help --version -J \
|
||||
--repack' -- "$cur" ) )
|
||||
[[ ${#COMPREPLY[@]} -eq 1 && ${COMPREPLY[0]} == *= ]] && \
|
||||
compopt -o nospace
|
||||
[[ $COMPREPLY == *= ]] && compopt -o nospace
|
||||
else
|
||||
_filedir 'pack?(.gz)'
|
||||
fi
|
||||
@ -425,8 +422,7 @@ _unpack200()
|
||||
if [[ "$cur" == -* ]] ; then
|
||||
COMPREPLY=( $( compgen -W '--deflate-hint= --remove-pack-file \
|
||||
--verbose --quiet --log-file= --help --version' -- "$cur" ) )
|
||||
[[ ${#COMPREPLY[@]} -eq 1 && ${COMPREPLY[0]} == *= ]] && \
|
||||
compopt -o nospace
|
||||
[[ $COMPREPLY == *= ]] && compopt -o nospace
|
||||
else
|
||||
_filedir 'pack?(.gz)'
|
||||
fi
|
||||
|
@ -68,8 +68,7 @@ _rsync()
|
||||
--write-batch= --only-write-batch= --read-batch= --protocol= \
|
||||
--iconv= --ipv4 --ipv6 --version --help --daemon --config= \
|
||||
--no-detach' -- "$cur" ) )
|
||||
[[ ${#COMPREPLY[@]} -eq 1 && ${COMPREPLY[0]} != *= ]] && \
|
||||
compopt +o nospace
|
||||
[[ $COMPREPLY == *= ]] || compopt +o nospace
|
||||
;;
|
||||
*:*)
|
||||
if declare -F _scp_remote_files &>/dev/null; then
|
||||
|
@ -78,8 +78,7 @@ _smartctl_test()
|
||||
COMPREPLY=( $( compgen -W 'offline short long conveyance select,
|
||||
select,redo select,next afterselect,on afterselect,off pending,
|
||||
scttempint, vendor,' -- "$cur" ) )
|
||||
[[ ${#COMPREPLY[@]} -eq 1 && "${COMPREPLY[@]}" == *, ]] && \
|
||||
compopt -o nospace
|
||||
[[ $COMPREPLY == *, ]] && compopt -o nospace
|
||||
}
|
||||
_smartctl_drivedb()
|
||||
{
|
||||
|
@ -134,8 +134,7 @@ _sysbench()
|
||||
|
||||
if [[ "$cur" == -* || ! $test ]]; then
|
||||
COMPREPLY=( $( compgen -W "$opts" -- "$cur" ) )
|
||||
[[ ${#COMPREPLY[@]} -eq 1 && ${COMPREPLY[0]} != *= ]] || \
|
||||
compopt -o nospace
|
||||
[[ $COMPREPLY == *= ]] && compopt -o nospace
|
||||
else
|
||||
COMPREPLY=( $( compgen -W "prepare run cleanup help version" \
|
||||
-- "$cur" ) )
|
||||
|
@ -43,8 +43,7 @@ _cdrecord()
|
||||
gigarec= audiomaster forcespeed noforcespeed speedread
|
||||
nospeedread singlesession nosinglesession hidecdr
|
||||
nohidecdr tattooinfo tattoofile=' -- "$cur" ) )
|
||||
[[ ${#COMPREPLY[@]} -eq 1 && ${COMPREPLY[0]} != *= ]] || \
|
||||
compopt -o nospace
|
||||
[[ $COMPREPLY == *= ]] && compopt -o nospace
|
||||
fi
|
||||
;;
|
||||
driver)
|
||||
@ -91,7 +90,7 @@ _cdrecord()
|
||||
if [ $track_mode -eq 0 ]; then
|
||||
COMPREPLY+=( $( compgen -W '${generic_options[@]}' -- "$cur" ) )
|
||||
fi
|
||||
[[ ${#COMPREPLY[@]} -eq 1 && ${COMPREPLY[0]} != *= ]] || compopt -o nospace
|
||||
[[ $COMPREPLY == *= ]] && compopt -o nospace
|
||||
} &&
|
||||
complete -F _cdrecord cdrecord wodim
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user