I don't like getopts. Don't know why. I just don't.

This commit is contained in:
Jack L. Frost 2015-02-06 13:40:27 +03:00
parent 3d148e6b4a
commit 07d1805d13

21
zpac
View File

@ -177,9 +177,16 @@ main() {
source "$HOME/.config/zpac.rc.sh"
fi
while getopts 'sASdw:f' opt
while (( $# )); do
case "$1" in
(--) shift; break;;
(-*)
while read -n1 c
do
case "$opt" in
case "$c" in
(-|'') :;;
(h) usage; return 0;;
(s) action='search';;
@ -201,13 +208,19 @@ main() {
(w) cfg_workdir="$OPTARG";;
(f) flag_force=1;;
(\?)
(*)
err "Unknown key: $OPTARG"
usage
return 1
;;
esac
done shift $(( OPTIND - 1 ))
done
;;
(*) shift; break;;
esac
shift
done
(( flag_search_aur && flag_search_syncdb )) && {
unset flag_search_aur flag_search_syncdb