From f7c67c877d4f517103e89836ac28e807d259063c Mon Sep 17 00:00:00 2001 From: Damien Dart Date: Thu, 25 Jul 2024 22:40:18 +0100 Subject: [PATCH] "fuzzy-grep": Fix help action. --- bin/fuzzy-grep | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/bin/fuzzy-grep b/bin/fuzzy-grep index 874d40d..9b1bdf7 100755 --- a/bin/fuzzy-grep +++ b/bin/fuzzy-grep @@ -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 @@ -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"