I don't like getopts. Don't know why. I just don't.
This commit is contained in:
parent
3d148e6b4a
commit
07d1805d13
21
zpac
21
zpac
|
@ -177,9 +177,16 @@ main() {
|
||||||
source "$HOME/.config/zpac.rc.sh"
|
source "$HOME/.config/zpac.rc.sh"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
while getopts 'sASdw:f' opt
|
while (( $# )); do
|
||||||
|
case "$1" in
|
||||||
|
(--) shift; break;;
|
||||||
|
|
||||||
|
(-*)
|
||||||
|
while read -n1 c
|
||||||
do
|
do
|
||||||
case "$opt" in
|
case "$c" in
|
||||||
|
(-|'') :;;
|
||||||
|
|
||||||
(h) usage; return 0;;
|
(h) usage; return 0;;
|
||||||
|
|
||||||
(s) action='search';;
|
(s) action='search';;
|
||||||
|
@ -201,13 +208,19 @@ main() {
|
||||||
(w) cfg_workdir="$OPTARG";;
|
(w) cfg_workdir="$OPTARG";;
|
||||||
(f) flag_force=1;;
|
(f) flag_force=1;;
|
||||||
|
|
||||||
(\?)
|
(*)
|
||||||
err "Unknown key: $OPTARG"
|
err "Unknown key: $OPTARG"
|
||||||
usage
|
usage
|
||||||
return 1
|
return 1
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
done shift $(( OPTIND - 1 ))
|
done
|
||||||
|
;;
|
||||||
|
|
||||||
|
(*) shift; break;;
|
||||||
|
esac
|
||||||
|
shift
|
||||||
|
done
|
||||||
|
|
||||||
(( flag_search_aur && flag_search_syncdb )) && {
|
(( flag_search_aur && flag_search_syncdb )) && {
|
||||||
unset flag_search_aur flag_search_syncdb
|
unset flag_search_aur flag_search_syncdb
|
||||||
|
|
Loading…
Reference in New Issue
Block a user