diff options
author | Euro20179 <f> | 2021-03-02 15:56:09 -0800 |
---|---|---|
committer | Euro20179 <f> | 2021-03-02 15:56:09 -0800 |
commit | 77383a459635ee748d5312e17810f7159414930a (patch) | |
tree | 67c860b4b2c45d3d9f5810375de72b65497f2de7 | |
parent | 7b3af8443d8a68b2e8c432d77bc27fab8389eb25 (diff) | |
download | ytfzf-77383a459635ee748d5312e17810f7159414930a.tar.gz |
code prettification
-rwxr-xr-x | ytfzf | 70 |
1 files changed, 35 insertions, 35 deletions
@@ -417,8 +417,8 @@ link_count=1 parse_opt () { #the first arg is the option opt=$1 - #second arg is the optarg defaults to empty - OPTARG="${2-}" + #second arg is the optarg + OPTARG="$2" case ${opt} in #Long options -) @@ -452,52 +452,52 @@ parse_opt () { random-auto-play) parse_opt "r" ;; - *) parse_opt "UNKNOWN" ;; + *) + printf "Illegal option --$OPTARG\n" + usageinfo + exit 2; + ;; esac ;; #Short options h) helpinfo - exit; - ;; - D) is_ext_menu="1" - ;; - m) YTFZF_PREF="bestaudio" - ;; + exit ;; + + D) is_ext_menu="1" ;; + + m) YTFZF_PREF="bestaudio" ;; + d) YTFZF_PLAYER="youtube-dl" - YTFZF_PLAYER_FORMAT="youtube-dl -f " - ;; - f) show_format=1 - ;; - H) get_history - ;; + YTFZF_PLAYER_FORMAT="youtube-dl -f " ;; + f) show_format=1 ;; + + H) get_history ;; + x) [ -e "$history_file" ] && rm "$history_file" && touch "$history_file" && printf "History has been cleared\n" - exit; - ;; - a) auto_select=1 - ;; - r) - random_select=1 - ;; + exit ;; + a) auto_select=1 ;; + + r) random_select=1 ;; + s) search_again=1 - YTFZF_LOOP=1 - ;; - l) YTFZF_LOOP=1 - ;; - t) show_thumbnails=1 - ;; - L) show_link_only=1 - ;; - n) link_count="$OPTARG" - ;; + YTFZF_LOOP=1 ;; + + l) YTFZF_LOOP=1 ;; + + t) show_thumbnails=1 ;; + + L) show_link_only=1 ;; + + n) link_count="$OPTARG" ;; + U) [ -p "$FIFO" ] && preview_img "$OPTARG"; exit; + # This option is reserved for the script, to show image previews # Not to be used by explicitly ;; *) - printf "${OPT-Option} not found!\n" usageinfo - exit 2; - ;; + exit 2 ;; esac } |