mirror of
https://github.com/ItsDrike/dotfiles.git
synced 2024-12-26 13:14:35 +00:00
Fix cheat.sh non-default query ability
This commit is contained in:
parent
d04842084a
commit
1c73a80dfc
|
@ -15,13 +15,18 @@ else
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# If the cheatsheet doesn't already include a query, select a query
|
# 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=""
|
query=""
|
||||||
elif [ -n "$2" ]; then
|
elif [ -n "$2" ]; then
|
||||||
query="$2"
|
query="$2"
|
||||||
else
|
else
|
||||||
options=$(curl -s "cheat.sh/$selected/:list")
|
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
|
fi
|
||||||
query="$(echo "$query" | tr ' ' '+')"
|
query="$(echo "$query" | tr ' ' '+')"
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue