Skip to content

Commit 1041f68

Browse files
committed
Add HAS_REFRESH back in, it's still useful
1 parent 896834a commit 1041f68

File tree

2 files changed

+28
-3
lines changed

2 files changed

+28
-3
lines changed

90zfsbootmenu/module-setup.sh

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,16 @@ install() {
250250
mark_hostonly /etc/hostid
251251
fi
252252

253+
# Check if fuzzy finder supports the refresh-preview flag
254+
# Added in fzf 0.22.0
255+
if command -v "${FUZZY_FIND}" >/dev/null 2>&1 && \
256+
echo "abc" | "${FUZZY_FIND}" -f "abc" --bind "alt-l:refresh-preview" --exit-0 >/dev/null 2>&1
257+
then
258+
has_refresh=1
259+
else
260+
has_refresh=
261+
fi
262+
253263
# Check if fuzzy finder supports the --info= flag
254264
# Added in fzf 0.19.0
255265
if command -v "${FUZZY_FIND}" >/dev/null 2>&1 && \
@@ -264,6 +274,7 @@ install() {
264274
# shellcheck disable=SC2154
265275
cat << EOF > "${initdir}/etc/zfsbootmenu.conf"
266276
export BYTE_ORDER=${endian:-le}
277+
export HAS_REFRESH=${has_refresh}
267278
export HAS_INFO=${has_info}
268279
EOF
269280

90zfsbootmenu/zfsbootmenu.sh

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,11 +76,25 @@ fuzzy_default_options=( "--ansi" "--no-clear"
7676
"--bind" '"alt-t:execute[ /sbin/ztrace > ${control_term} ]"'
7777
"--bind" '"ctrl-t:execute[ /sbin/ztrace > ${control_term} ]"'
7878
"--bind" '"ctrl-alt-t:execute[ /sbin/ztrace > ${control_term} ]"'
79-
"--bind" '"alt-l:execute[ /bin/zlogtail -l err,warn -F user,daemon -c ]"'
80-
"--bind" '"ctrl-l:execute[ /bin/zlogtail -l err,warn -F user,daemon -c ]"'
81-
"--bind" '"ctrl-alt-l:execute[ /bin/zlogtail -l err,warn -F user,daemon -c ]"'
8279
)
8380

81+
# refresh-preview will redraw the top header after zlogtail has been executed
82+
# doing so will remove the [!] from warnings/errors
83+
# with out this, a new BE has to be selected to force a preview redraw
84+
if [ -n "${HAS_REFRESH}" ] ; then
85+
fuzzy_default_options+=(
86+
"--bind" '"alt-l:execute[ /bin/zlogtail -l err,warn -F user,daemon -c ]+refresh-preview"'
87+
"--bind" '"ctrl-l:execute[ /bin/zlogtail -l err,warn -F user,daemon -c ]+refresh-preview"'
88+
"--bind" '"ctrl-alt-l:execute[ /bin/zlogtail -l err,warn -F user,daemon -c ]+refresh-preview"'
89+
)
90+
else
91+
fuzzy_default_options+=(
92+
"--bind" '"alt-l:execute[ /bin/zlogtail -l err,warn -F user,daemon -c ]"'
93+
"--bind" '"ctrl-l:execute[ /bin/zlogtail -l err,warn -F user,daemon -c ]"'
94+
"--bind" '"ctrl-alt-l:execute[ /bin/zlogtail -l err,warn -F user,daemon -c ]"'
95+
)
96+
fi
97+
8498
if command -v fzf >/dev/null 2>&1; then
8599
zdebug "using fzf for pager"
86100
export FUZZYSEL=fzf

0 commit comments

Comments
 (0)