summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHorus32014-06-16 15:55:01 +0200
committerHorus32014-06-16 15:55:01 +0200
commit031f90c100ab93ccfab3903d700c86286b057ccc (patch)
treefa9db4bd016b0fed3160c3f298d309f52359ac6b
parente7275ca5fb912cb32bec2b14d85d76516f97dd6d (diff)
downloaddotfiles-031f90c100ab93ccfab3903d700c86286b057ccc.tar.gz
parse more command options
-rwxr-xr-xbin/play22
1 files 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