From 5f2482179f07db7080f81fbfe1fb1e4ccc5460b6 Mon Sep 17 00:00:00 2001 From: Alex Epstein Date: Mon, 3 Jul 2017 20:26:57 -0400 Subject: [PATCH] Adding script exit after successfull run --- README.md | 2 +- ytview/ytview | 13 ++++++++----- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 279f43c..b845f6f 100644 --- a/README.md +++ b/README.md @@ -44,7 +44,7 @@ Provides a way to watch youtube videos from the terminal. You can use ```ytview -c [channel name]``` to see recent videos by that artist. -You can use ```youtubeviewer -s '[videoToSearch]'``` to search for videos. +You can use ```ytview -s [videoToSearch]``` or just ```ytview [videoToSearch]``` to search for videos.
diff --git a/ytview/ytview b/ytview/ytview index cfe48e3..17e926f 100755 --- a/ytview/ytview +++ b/ytview/ytview @@ -190,7 +190,7 @@ do search=$(printf '%s ' "$@") flag="search" else - echo "Error: search and channel options are mutually exclusive" + echo "Error: search and channel options are mutually exclusive" >&2 exit 1 fi ;; @@ -199,22 +199,25 @@ do channel="$OPTARG" flag="channel" else - echo "Error: search and channel options are mutually exclusive" + echo "Error: search and channel options are mutually exclusive" >&2 exit 1 fi ;; - h) usage ;; - u) update ;; - *) usage ;; + h) usage && exit 0 ;; + u) update && exit 0 ;; + *) usage && exit 0 ;; esac done if [[ $# == "0" ]]; then usage + exit 0 elif [[ $1 == "help" ]];then usage + exit 0 elif [[ $1 == "update" ]]; then update + exit 0 elif [[ $flag == "search" ]]; then searchview || exit 1 elif [[ $flag == "channel" ]]; then