aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHarshith <notpiestardust@gmail.com>2021-03-03 12:38:53 +0530
committerGitHub <noreply@github.com>2021-03-03 12:38:53 +0530
commit8738f16ff5f35dd71038a00fe1552cf09056cd78 (patch)
tree044d6e73bec3581f01efdd47cd14ccae686c3277
parent51a278bb9936434ec942304d703988f48a840c04 (diff)
parent54f3911b46881312927e5328b0ebc06702f642cc (diff)
downloadytfzf-8738f16ff5f35dd71038a00fe1552cf09056cd78.tar.gz
Merge pull request #61 from Euro20179/config-file
feature: config file
-rwxr-xr-xytfzf17
1 files changed, 15 insertions, 2 deletions
diff --git a/ytfzf b/ytfzf
index 2bc603c..9e1332d 100755
--- a/ytfzf
+++ b/ytfzf
@@ -7,10 +7,11 @@
############################
# Defaults #
############################
+
[ -z "$YTFZF_HIST" ] && YTFZF_HIST=1
[ -z "$YTFZF_LOOP" ] && YTFZF_LOOP=0
[ -z "$YTFZF_CUR" ] && YTFZF_CUR=1
-[ -z "$YTFZF_CACHE" ] && YTFZF_CACHE=~/.cache/ytfzf
+[ -z "$YTFZF_CACHE" ] && YTFZF_CACHE="$HOME/.cache/ytfzf"
[ -z "$YTFZF_PREF" ] && YTFZF_PREF=""
[ -z "$YTFZF_EXTMENU" ] && YTFZF_EXTMENU='dmenu -i -l 30 -p Search:'
[ -z "$YTFZF_EXTMENU_LEN" ] && YTFZF_EXTMENU_LEN=220
@@ -26,9 +27,21 @@
history_file="$YTFZF_CACHE"/ytfzf_hst
current_file="$YTFZF_CACHE"/ytfzf_cur
thumb_dir="$YTFZF_CACHE"/thumb
+#> make folders that don't exist
[ -d $YTFZF_CACHE ] || mkdir -p $YTFZF_CACHE
[ -d $thumb_dir ] || mkdir -p $thumb_dir
+#> Setting and reading the config file
+config_dir="$HOME/.config/ytfzf"
+config_file="$config_dir/ytfzf.sh"
+if [ -e $config_file ]
+then
+ #source config file if exists (overrides env variables)
+ . "$config_file"
+fi
+
+#> settings only set in config
+search_prompt="${search_prompt-Search Youtube: }"
# DEP CHECK
dep_ck () {
@@ -296,7 +309,7 @@ get_search_query () {
if [ $is_ext_menu -eq 1 ]; then
search_query="$(printf "" | $YTFZF_EXTMENU)"
else
- printf "Search Youtube: "
+ printf "$search_prompt"
read search_query
fi
[ -z "$search_query" ] && { exit 0; }
Un proyecto texto-plano.xyz