summaryrefslogtreecommitdiff
path: root/home/xyz/.local/bin
diff options
context:
space:
mode:
authorxyz <gky44px1999@gmail.com>2021-11-26 00:22:37 -0800
committerxyz <gky44px1999@gmail.com>2021-11-26 00:22:37 -0800
commitb50ba7ac13e7df4b32b5e664151d4a177806c880 (patch)
tree78aada89de35af55cfbee0dbbd627a8d36df52ee /home/xyz/.local/bin
parent18c3c32eb76bb37720dc4b6bac36ce0795984c45 (diff)
curlncm, less die
Diffstat (limited to 'home/xyz/.local/bin')
-rwxr-xr-xhome/xyz/.local/bin/curlncm22
1 files changed, 3 insertions, 19 deletions
diff --git a/home/xyz/.local/bin/curlncm b/home/xyz/.local/bin/curlncm
index 65d9056e..73a6e66f 100755
--- a/home/xyz/.local/bin/curlncm
+++ b/home/xyz/.local/bin/curlncm
@@ -26,32 +26,16 @@ die () {
exit 1
}
-# let a i r mutually exclusive
# artist, song, djradio id
-flag=0
while getopts a:i:r: opt; do
case $opt in
- a)
- [ "$flag" -eq 1 ] && die "options a,i,r are mutually exclusive"
- aid="$OPTARG"
- flag=1
- ;;
- i)
- [ "$flag" -eq 1 ] && die "options a,i,r are mutually exclusive"
- ids="$OPTARG"
- flag=1
- ;;
- r)
- [ "$flag" -eq 1 ] && die "options a,i,r are mutually exclusive"
- rid="$OPTARG"
- flag=1
- ;;
+ a) aid="$OPTARG";;
+ i) ids="$OPTARG";;
+ r) rid="$OPTARG";;
\?) exit 1;;
esac
done
-[ $flag -eq 0 ] && die "please specify at least one option"
shift $((OPTIND-1))
-[ $# -gt 1 ] && die "directory name should be at the end"
download_dir="${1:-"$PWD"}"
[ -d "$download_dir" ] || mkdir -p "$download_dir"