diff options
author | Gregor Kleen <gkleen@yggdrasil.li> | 2018-09-25 19:21:19 +0200 |
---|---|---|
committer | Gregor Kleen <gkleen@yggdrasil.li> | 2018-09-25 19:21:19 +0200 |
commit | 53bf3a2c099192d483bf4108772297b6fc215140 (patch) | |
tree | 5195233d600ed46f161e003611fb6208d944471a /custom/uucp-mediaserver | |
parent | 07f00aaa7f19c346060f383f500fb0ad3319d58a (diff) | |
download | nixos-53bf3a2c099192d483bf4108772297b6fc215140.tar nixos-53bf3a2c099192d483bf4108772297b6fc215140.tar.gz nixos-53bf3a2c099192d483bf4108772297b6fc215140.tar.bz2 nixos-53bf3a2c099192d483bf4108772297b6fc215140.tar.xz nixos-53bf3a2c099192d483bf4108772297b6fc215140.zip |
better options
Diffstat (limited to 'custom/uucp-mediaserver')
-rwxr-xr-x | custom/uucp-mediaserver/scripts/queue | 30 |
1 files changed, 7 insertions, 23 deletions
diff --git a/custom/uucp-mediaserver/scripts/queue b/custom/uucp-mediaserver/scripts/queue index 1644bd2d..49c7a3bc 100755 --- a/custom/uucp-mediaserver/scripts/queue +++ b/custom/uucp-mediaserver/scripts/queue | |||
@@ -46,29 +46,13 @@ suffix=${base##*.} | |||
46 | force=0 | 46 | force=0 |
47 | noCall=false | 47 | noCall=false |
48 | prepend=false | 48 | prepend=false |
49 | while getopts "frp" OPT; do | 49 | |
50 | case $OPT in | 50 | typeset -A opts |
51 | r) | 51 | zparseopts -A opts -- r p f:: |
52 | noCall=true | 52 | |
53 | ;; | 53 | force=${opts[-f]:-${+opts[-f]}} |
54 | f) | 54 | [[ -v opts[-p] ]] && prepend=true |
55 | if [[ ${@:$OPTIND} =~ ^[0-9]+$ ]];then | 55 | [[ -v opts[-r] ]] && noCall=true |
56 | force=${@:$OPTIND} | ||
57 | OPTIND=$((OPTIND+1)) | ||
58 | else | ||
59 | force=1 | ||
60 | fi | ||
61 | ;; | ||
62 | p) | ||
63 | prepend=true | ||
64 | ;; | ||
65 | \?) | ||
66 | echo "Invalid option -${OPTARG}" >&2 | ||
67 | exit 2 | ||
68 | ;; | ||
69 | esac | ||
70 | done | ||
71 | shift $((OPTIND-1)) | ||
72 | 56 | ||
73 | printf "force: %d, noCall: %s, prepend: %s\n" ${force} ${noCall} ${prepend} | debug | 57 | printf "force: %d, noCall: %s, prepend: %s\n" ${force} ${noCall} ${prepend} | debug |
74 | 58 | ||