diff options
| author | Horus3 | 2014-06-16 15:55:01 +0200 |
|---|---|---|
| committer | Horus3 | 2014-06-16 15:55:01 +0200 |
| commit | 031f90c100ab93ccfab3903d700c86286b057ccc (patch) | |
| tree | fa9db4bd016b0fed3160c3f298d309f52359ac6b | |
| parent | e7275ca5fb912cb32bec2b14d85d76516f97dd6d (diff) | |
| download | dotfiles-031f90c100ab93ccfab3903d700c86286b057ccc.tar.gz | |
parse more command options
| -rwxr-xr-x | bin/play | 22 |
1 files changed, 14 insertions, 8 deletions
@@ -17,7 +17,7 @@ printhelp(){ echo " -n don't ask for moving" echo " -y move to archiv without question" echo " -o ask for a different archiv" - echo " -no-cache Not caching the file, instead play's directly" + echo " --no-cache Not caching the file, instead play's directly" exit 0 } @@ -26,26 +26,32 @@ cache=1 while true; do case "$1" in - -no-cache|-nc) cache=0 + --no-cache|--nc) cache=0 shift ;; - -y|-Y|-yes|-j|-ja) verify="yes" + -y|-Y|--yes|-j|-ja) verify="yes" shift ;; - -r|-rm|-remove) verify="rm" + -d|--rm|--remove) verify="rm" shift ;; - -o|-other|-ot) verify="other" + -o|--other|--ot) verify="other" shift ;; - -n|-no|-nope|-nein) verify="no" + -n|--no|--nope|--nein) verify="no" shift ;; - -d|-download|-down) download="yes" + -g|--download|--down) download="yes" shift ;; -h|--help) printhelp ;; + --) shift #stops processing arguments + break + ;; + -*) echo "'$1' Unknown argument." + exit 1 + ;; *) break ;; esac @@ -62,7 +68,7 @@ fi if [ ! -f "$1" ]; then echo "No valid file input." - exit + exit 1 fi player[0]=$(command -v mpv) #media player of choice |
