diff options
author | Harshith <notpiestardust@gmail.com> | 2021-03-02 18:10:19 +0530 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-03-02 18:10:19 +0530 |
commit | 51a278bb9936434ec942304d703988f48a840c04 (patch) | |
tree | 2d8b5d4f7806e16e38f0e587e18a6952d2a333b8 | |
parent | 091b472a57f5d515ff8fa542e0d6ac8fd242d92b (diff) | |
parent | 00ddae5fb987c7eeddd8046f4c8843cec359aaa7 (diff) | |
download | ytfzf-51a278bb9936434ec942304d703988f48a840c04.tar.gz |
Merge pull request #58 from cybarspace/patch-1
Exit earlier if dependency missing
-rwxr-xr-x | ytfzf | 42 |
1 files changed, 22 insertions, 20 deletions
@@ -30,29 +30,39 @@ thumb_dir="$YTFZF_CACHE"/thumb [ -d $thumb_dir ] || mkdir -p $thumb_dir +# DEP CHECK +dep_ck () { + for dep in "$@"; do + command -v "$dep" 1>/dev/null || { printf "$dep not found. Please install it.\n" ; exit 2; } + done +} +dep_ck "jq" "youtube-dl" "$YTFZF_PLAYER"; + + ############################ # Help Texts # ############################ helpinfo () { -printf "Usage: %bytfzf %b<search query>%b\n" "\033[1;32m" "\033[1;33m" "\033[0m"; +printf "Usage: %bytfzf [OPTIONS] %b<search-query>%b\n" "\033[1;32m" "\033[1;33m" "\033[0m"; +printf " OPTIONS:\n" printf " -h Show this help text\n"; printf " -t Show thumbnails (requires ueberzug)\n"; printf " Doesn't work with -H -D\n"; printf " -D Use external menu(default dmenu) instead of fzf \n"; printf " -H Choose from history \n"; printf " -x Delete history\n"; -printf " -m <search query> Audio only (for music)\n"; -printf " -d <search query> Download to current directory\n"; -printf " -f <search query> Show available formats before proceeding\n"; -printf " -a <search query> Auto play the first result, no selector\n"; -printf " -r <search query> Auto play a random result, no selector\n"; -printf " -n <link count> To specify number of videos to select with -a or -r\n"; -printf " -l <search query> Loop: prompt selector again after video ends\n"; -printf " -s <search query> After the video ends make another search \n"; -printf " -L <search query> Prints the selected URL only, helpful for scripting\n"; -printf " Use - instead of <query> for stdin\n"; +printf " -m <search-query> Audio only (for music)\n"; +printf " -d <search-query> Download to current directory\n"; +printf " -f <search-query> Show available formats before proceeding\n"; +printf " -a <search-query> Auto play the first result, no selector\n"; +printf " -r <search-query> Auto play a random result, no selector\n"; +printf " -n <link-count> To specify number of videos to select with -a or -r\n"; +printf " -l <search-query> Loop: prompt selector again after video ends\n"; +printf " -s <search-query> After the video ends make another search \n"; +printf " -L <search-query> Prints the selected URL only, helpful for scripting\n"; +printf " Use - instead of <search-query> for stdin\n"; printf "\n" -printf " Option can be combines. Like\n" +printf " Option can be combined. Like\n" printf " ytfzf -fDH to show history using external \n" printf " menu and show formats\n" printf "\n" @@ -391,14 +401,6 @@ get_history () { } -# DEP CHECK -dep_ck () { - for dep in "$@"; do - command -v "$dep" 1>/dev/null || { printf "$dep not found. Please install it.\n" ; exit 2; } - done -} -dep_ck "jq" "youtube-dl" "mpv"; - # Opt variables is_ext_menu=0 show_thumbnails=0 |