make selection of optionsvs mandatory argument completion similar to others

This commit is contained in:
Guillaume Rousse 2009-12-30 00:31:17 +01:00
parent 2e1b780d84
commit 877d36fefb
3 changed files with 13 additions and 29 deletions

View File

@ -8,22 +8,16 @@ _unace()
COMPREPLY=() COMPREPLY=()
cur=`_get_cword` cur=`_get_cword`
case "$cur" in
-*) if [[ "$cur" == -* ]] ; then
COMPREPLY=( $( compgen -W '-c -c- -f -f- -o -o- -p -y -y-' \ COMPREPLY=( $( compgen -W '-c -c- -f -f- -o -o- -p -y -y-' -- "$cur" ) )
-- "$cur" ) ) else
;;
*)
if [ $COMP_CWORD -eq 1 ]; then if [ $COMP_CWORD -eq 1 ]; then
COMPREPLY=( $( compgen -W 'e l t v x' -- "$cur" ) ) COMPREPLY=( $( compgen -W 'e l t v x' -- "$cur" ) )
else else
_filedir '@(ace|ACE)' _filedir '@(ace|ACE)'
fi fi
;; fi
esac
return 0
} && } &&
complete -F _unace -o filenames unace complete -F _unace -o filenames unace

View File

@ -8,22 +8,18 @@ _unrar()
COMPREPLY=() COMPREPLY=()
cur=`_get_cword` cur=`_get_cword`
case "$cur" in if [[ "$cur" == -* ]] ; then
-*)
COMPREPLY=( $( compgen -W '-ad -ap -av- -c- -cfg- -cl -cu \ COMPREPLY=( $( compgen -W '-ad -ap -av- -c- -cfg- -cl -cu \
-dh -ep -f -idp -ierr -inul -kb -o+ -o- -ow -p -p- -r -ta \ -dh -ep -f -idp -ierr -inul -kb -o+ -o- -ow -p -p- -r -ta \
-tb -tn -to -u -v -ver -vp -x -x@ -y' -- "$cur" ) ) -tb -tn -to -u -v -ver -vp -x -x@ -y' -- "$cur" ) )
;; else
*)
if [ $COMP_CWORD -eq 1 ]; then if [ $COMP_CWORD -eq 1 ]; then
COMPREPLY=( $( compgen -W 'e l lb lt p t v vb vt x' -- "$cur" ) ) COMPREPLY=( $( compgen -W 'e l lb lt p t v vb vt x' -- "$cur" ) )
else else
_filedir '@(rar|RAR)' _filedir '@(rar|RAR)'
fi fi
;; fi
esac
return 0
} && } &&
complete -F _unrar -o filenames unrar complete -F _unrar -o filenames unrar

View File

@ -7,17 +7,11 @@ _yum_arch()
COMPREPLY=() COMPREPLY=()
cur=`_get_cword` cur=`_get_cword`
case "$cur" in if [[ "$cur" == -* ]] ; then
-*) COMPREPLY=( $( compgen -W '-d -v -vv -n -c -z -s -l -q' -- "$cur" ) )
COMPREPLY=( $( compgen -W '-d -v -vv -n -c -z -s -l \ else
-q' -- "$cur" ) ) _filedir -d
;; fi
*)
_filedir -d
;;
esac
return 0
} && } &&
complete -F _yum_arch -o filenames yum-arch complete -F _yum_arch -o filenames yum-arch