Skip to content

Commit

Permalink
fix: #712
Browse files Browse the repository at this point in the history
fix: the last var when setting env variables is not read
  • Loading branch information
Euro20179 committed Nov 10, 2023
1 parent f48e708 commit f18630f
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 5 deletions.
5 changes: 5 additions & 0 deletions docs/man/ytfzf.5
Original file line number Diff line number Diff line change
Expand Up @@ -745,6 +745,11 @@ Misc

.RS

.TP
.RB $ gap_space
The amount of space after the title in the thumbnail viewer menu.
.IR default: "' '"

.TP
.RB $ scrape_search_exclude
The scrapers to not ask for a search query.
Expand Down
16 changes: 11 additions & 5 deletions ytfzf
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

# versioning system:
# major.minor.bugs
YTFZF_VERSION="git-2065.4a27783"
YTFZF_VERSION="git-2066.f48e708"

#ENVIRONMENT VARIABLES {{{
: "${YTFZF_CONFIG_DIR:=${XDG_CONFIG_HOME:-$HOME/.config}/ytfzf}"
Expand Down Expand Up @@ -1304,15 +1304,15 @@ set_vars() {
# save the ecurrent environment so that any user set variables will be saved
if [ "$check_exists" -eq 1 ]; then
tmp_env="${YTFZF_TEMP_DIR}/ytfzf-env-$$"
export -p >"$tmp_env"
export -p > "$tmp_env"
fi

# debugging
log_level="2" thumbnail_debug_log="/dev/null"

# global vars

gap_space=" "
gap_space=" "
new_line='
' tab_space=$(printf '\t')
#necessary as a seperator for -W
Expand Down Expand Up @@ -1435,6 +1435,11 @@ set_vars() {
*) _current_var_value="${_current_var_value}${new_line}${_var}" ;;
esac
done <"$tmp_env"
[ "$_current_var_name" ] && {
export "${_current_var_name}"="$(eval echo "$_current_var_value")"
_current_var_name=""
_current_var_value=""
}

rm "$tmp_env"
fi
Expand Down Expand Up @@ -2624,6 +2629,8 @@ interface_text() {
_fzf_start_bind="${_fzf_start_bind%"+"}"
fi

_init_video_info_text "$TTY_COLS"

[ "$show_thumbnails" -eq 1 ] && {
interface_thumbnails "$@"
return
Expand All @@ -2632,8 +2639,6 @@ interface_text() {
video_json_file=$1
selected_id_file=$2

_init_video_info_text "$TTY_COLS"

unset IFS

_c_SORTED_VIDEO_DATA="$(create_sorted_video_data)"
Expand Down Expand Up @@ -3043,6 +3048,7 @@ interface_thumbnails() {

printf "%s\n" "$_c_SORTED_VIDEO_DATA" |
jq -r '"\(.title)'"$gap_space"'\t|\(.channel)\t|\(.duration)\t|\(.views)\t|\(.date)\t|\(.viewed)\t|\(.url)"' |
_post_video_info_text |
SHELL="$(command -v sh)" fzf -m --sync \
--expect="$shortcut_binds" \
--preview "__is_fzf_preview=1 YTFZF_CHECK_VARS_EXISTS=1 session_cache_dir='$session_cache_dir' session_temp_dir='$session_temp_dir' fzf_preview_side='$fzf_preview_side' scrape='$scrape' thumbnail_viewer='$thumbnail_viewer' ytfzf_video_json_file='$ytfzf_video_json_file' $0 -W \"preview_img"$EOT"{f}\"" \
Expand Down

0 comments on commit f18630f

Please sign in to comment.