data/xbps.bash: shorten argument comparisons

This commit is contained in:
Eivind Uggedal 2014-09-18 19:44:31 +00:00
parent 5bbcdf2c62
commit 0f73158ed8

View File

@ -38,8 +38,8 @@ _xbps_complete() {
return return
fi fi
local common='-C|--config|-r|--rootdir' local common='C|-config|r|-rootdir'
local morecommon="$common|-c|--cachedir" local morecommon="$common|c|-cachedir"
local modes='auto manual hold unhold' local modes='auto manual hold unhold'
local props='architecture local props='architecture
@ -75,45 +75,45 @@ _xbps_complete() {
case $1 in case $1 in
xbps-dgraph) xbps-dgraph)
if [[ $prev != @(-c|-o|-r) ]]; then if [[ $prev != -@(c|o|r) ]]; then
_xbps_installed_reply $cur _xbps_installed_reply $cur
return return
fi fi
;; ;;
xbps-install) xbps-install)
if [[ $prev != @($morecommon) ]]; then if [[ $prev != -@($morecommon) ]]; then
_xbps_all_reply $cur _xbps_all_reply $cur
return return
fi fi
;; ;;
xbps-pkgdb) xbps-pkgdb)
if [[ $prev == @(-m|--mode) ]]; then if [[ $prev == -@(m|-mode) ]]; then
COMPREPLY=( $( compgen -W "$modes" -- "$cur") ) COMPREPLY=( $( compgen -W "$modes" -- "$cur") )
return return
fi fi
if [[ $prev != @($common) ]]; then if [[ $prev != -@($common) ]]; then
_xbps_installed_reply $cur _xbps_installed_reply $cur
return return
fi fi
;; ;;
xbps-query) xbps-query)
if [[ $prev == @(-p|--property) ]]; then if [[ $prev == -@(p|-property) ]]; then
COMPREPLY=( $( compgen -W "$props" -- "$cur") ) COMPREPLY=( $( compgen -W "$props" -- "$cur") )
return return
fi fi
if [[ $prev != @($morecommon|-p|--property|-o|--ownedby) ]]; then if [[ $prev != -@($morecommon|o|-ownedby) ]]; then
_xbps_all_reply $cur _xbps_all_reply $cur
return return
fi fi
;; ;;
xbps-reconfigure) xbps-reconfigure)
if [[ $prev != @($common) ]]; then if [[ $prev != -@($common) ]]; then
_xbps_installed_reply $cur _xbps_installed_reply $cur
return return
fi fi
;; ;;
xbps-remove) xbps-remove)
if [[ $prev != @($morecommon) ]]; then if [[ $prev != -@($morecommon) ]]; then
_xbps_installed_reply $cur _xbps_installed_reply $cur
return return
fi fi