From 1c73a80dfc6dd3b34c24c81549281c7b9dd51f2e Mon Sep 17 00:00:00 2001 From: ItsDrike Date: Fri, 24 Dec 2021 04:46:48 +0100 Subject: [PATCH] Fix cheat.sh non-default query ability --- home/.local/bin/scripts/cheat.sh | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/home/.local/bin/scripts/cheat.sh b/home/.local/bin/scripts/cheat.sh index e41de68..ac659c9 100755 --- a/home/.local/bin/scripts/cheat.sh +++ b/home/.local/bin/scripts/cheat.sh @@ -15,13 +15,18 @@ else fi # If the cheatsheet doesn't already include a query, select a query -if echo "$selected" | grep -q "/"; then +if echo "$selected" | grep -qe "[/:]"; then query="" elif [ -n "$2" ]; then query="$2" else options=$(curl -s "cheat.sh/$selected/:list") - query=$(printf "\n$options" | fzf --bind=enter:print-query --prompt="cheat.sh query (can be empty): ") + query="$(printf "\n$options" | \ + fzf --bind=alt-enter:print-query \ + --prompt="cheat.sh query>" \ + --header="use alt-enter to enter non-listed query"\ + )" + query=$(echo "$query" | tail -1) fi query="$(echo "$query" | tr ' ' '+')"