Skip to content

Commit

Permalink
"fuzzy-grep": Fix help action.
Browse files Browse the repository at this point in the history
  • Loading branch information
damiendart committed Jul 25, 2024
1 parent 06c078a commit f7c67c8
Showing 1 changed file with 15 additions and 10 deletions.
25 changes: 15 additions & 10 deletions bin/fuzzy-grep
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,21 @@ FZF_OUTPUT=$(\
--query="$INITIAL_QUERY" \
)
FZF_STATUS="$?"
SELECTED_ACTION=$(echo "$FZF_OUTPUT" | head -1)
SELECTED_OUTPUT=$(echo "$FZF_OUTPUT" | tail -n +2)

case $SELECTED_ACTION in
f1*)
if [ "$VIM_MODE" = 1 ]; then
echo "$SELECTED_ACTION"
else
tput rmcup
help
fi

exit
;;
esac

if [ "$FZF_STATUS" != 0 ]; then
# Allow this script to exit cleanly if fzf exits with a return code of
Expand All @@ -198,17 +213,7 @@ fi

set -e

SELECTED_ACTION=$(echo "$FZF_OUTPUT" | head -1)
SELECTED_OUTPUT=$(echo "$FZF_OUTPUT" | tail -n +2)

case $SELECTED_ACTION in
f1)
if [ "$VIM_MODE" = 1 ]; then
echo "$SELECTED_ACTION"
else
help
fi
;;
*)
if [ "$VIM_MODE" = 1 ]; then
echo "$FZF_OUTPUT"
Expand Down

0 comments on commit f7c67c8

Please sign in to comment.