default to usage on bad arguments, require no args to run

fixup
This commit is contained in:
2021-05-04 19:59:42 -05:00
parent 4fd4316e51
commit df1d74b2fc

47
subs
View File

@@ -15,7 +15,7 @@
: "${SUBS:=${XDG_CACHE_HOME:-~/.cache}/subs}" : "${SUBS:=${XDG_CACHE_HOME:-~/.cache}/subs}"
: "${SUBS_LINKS:=$SUBS/links}" : "${SUBS_LINKS:=$SUBS/links}"
: "${SUBS_CACHE:=$SUBS/cache}" : "${SUBS_CACHE:=$SUBS/cache}"
: "${SUBS_SLEEP_VALUE:=0.1}" # raise this if you experience problems : "${SUBS_SLEEP_VALUE:=0.25}" # raise this if you experience problems
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
SEP=^^^^^ # shouldn't need to change this SEP=^^^^^ # shouldn't need to change this
# -/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/ # -/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/-/
@@ -242,23 +242,34 @@ daemonize() {
main() { main() {
mkdir -p "$SUBS" mkdir -p "$SUBS"
case ${1#-} in if [ "$1" ] ; then
n) case ${1#-} in
DONT_PLAY=true g)
;; gen_links
m) ;;
export MPV_OPTS="$MPV_OPTS --no-video" u)
shift update_subs
esac ;;
c)
case ${1#-} in cat_subs
h) usage ;; ;;
g) gen_links ;; d)
u) update_subs ;; daemonize
c) cat_subs ;; ;;
d) daemonize ;; m)
*) get_sel MPV_OPTS="$MPV_OPTS --no-video" \
esac get_sel
;;
n)
DONT_PLAY=true \
get_sel
;;
*)
usage
esac
else
get_sel
fi
} }
main "$@" main "$@"