gphoto2: Fix split argument handing, and colon treatment in --port args

This commit is contained in:
Ville Skyttä 2014-11-16 12:09:54 +02:00
parent 32e6e49088
commit 7d66285b42

View File

@ -3,7 +3,7 @@
_gphoto2() _gphoto2()
{ {
local cur prev words cword split local cur prev words cword split
_init_completion -s || return _init_completion -s -n : || return
case $prev in case $prev in
--debug-logfile) --debug-logfile)
@ -25,6 +25,7 @@ _gphoto2()
--port) --port)
COMPREPLY=( $(compgen -W "$( gphoto2 --list-ports 2>/dev/null | \ COMPREPLY=( $(compgen -W "$( gphoto2 --list-ports 2>/dev/null | \
tail -n +4 | awk '{ print $1 }' )" -- "$cur") ) tail -n +4 | awk '{ print $1 }' )" -- "$cur") )
__ltrim_colon_completions "$cur"
return 0 return 0
;; ;;
--camera) --camera)
@ -40,8 +41,11 @@ _gphoto2()
;; ;;
esac esac
$split && return
if [[ "$cur" == -* ]]; then if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) )
[[ $COMPREPLY == *= ]] && compopt -o nospace
return 0 return 0
fi fi