sbopkg: improve code, make it more logical

- remove ugly case '-c|-g|-h|-k|-l|-o|-P|-p|-q|-R|-r|-s|-u|-v)'
- remove second case statement

Reviewed-by: Igor Murzov <igor@gplsoft.org>
This commit is contained in:
Sergey V 2011-01-08 02:27:40 +03:00
parent f6e04085f9
commit d77fb12d01

View File

@ -1,3 +1,4 @@
# -*- sh -*-
# bash completion for sbopkg tool # bash completion for sbopkg tool
# #
# (c) Igor Murzov <igor@gplsoft.org> # (c) Igor Murzov <igor@gplsoft.org>
@ -29,9 +30,14 @@ _sbopkg()
_filedir -d _filedir -d
return 0 return 0
;; ;;
-c|-g|-h|-k|-l|-o|-P|-p|-q|-R|-r|-s|-u|-v) -V)
# argument required but no completions available COMPREPLY=( $( compgen -W "? \
# or argument not required `sbopkg -V ? 2>&1 | cut -s -f1`" -- "$cur" ) )
return 0
;;
-i|-b)
;;
*)
return 0 return 0
;; ;;
esac esac
@ -65,21 +71,12 @@ _sbopkg()
esac esac
done done
case $prev in if [ ! -r "$REPO_ROOT/$REPO_NAME/$REPO_BRANCH/SLACKBUILDS.TXT" ]; then
-V) return 0
COMPREPLY=( $( compgen -W "? \ fi
`sbopkg -V ? 2>&1 | cut -s -f1`" -- "$cur" ) ) COMPREPLY=( $( grep "^SLACKBUILD NAME: $cur" \
return 0 $REPO_ROOT/$REPO_NAME/$REPO_BRANCH/SLACKBUILDS.TXT | cut -f3- -d\ )
;; $( (cd $QUEUEDIR; ls $cur*.sqf 2> /dev/null) ) )
-i|-b) return 0
if [ ! -r "$REPO_ROOT/$REPO_NAME/$REPO_BRANCH/SLACKBUILDS.TXT" ]; then
return 0
fi
COMPREPLY=( $( grep "^SLACKBUILD NAME: $cur" \
$REPO_ROOT/$REPO_NAME/$REPO_BRANCH/SLACKBUILDS.TXT | cut -f3- -d\ )
$( (cd $QUEUEDIR; ls $cur*.sqf 2> /dev/null) ) )
return 0
;;
esac
} && complete -F _sbopkg sbopkg -o plusdirs } && complete -F _sbopkg sbopkg -o plusdirs