From 031f90c100ab93ccfab3903d700c86286b057ccc Mon Sep 17 00:00:00 2001 From: Horus3 Date: Mon, 16 Jun 2014 15:55:01 +0200 Subject: parse more command options --- bin/play | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/bin/play b/bin/play index e88eb63..c568b92 100755 --- a/bin/play +++ b/bin/play @@ -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 -- cgit v1.2.3