mirror of
https://github.com/ItsDrike/dotfiles.git
synced 2024-12-26 05:04:34 +00:00
Add cheat.sh script
This commit is contained in:
parent
656f29b333
commit
7d3eb5ae69
16
home/.local/bin/scripts/cheat.sh
Executable file
16
home/.local/bin/scripts/cheat.sh
Executable file
|
@ -0,0 +1,16 @@
|
|||
#!/bin/sh
|
||||
languages=`echo "python rust golang lua cpp c typescript nodejs javascript js" | tr ' ' '\n'`
|
||||
core_utils=`echo "xargs find sed awk" | tr ' ' '\n'`
|
||||
|
||||
selected=`printf "$languages\n$core_utils" | fzf`
|
||||
read -p "query: " query
|
||||
query=`echo "$query" | tr ' ' '+'`
|
||||
|
||||
|
||||
if printf "$languages" | grep -qs "$selected"; then
|
||||
url="cheat.sh/$selected/$query"
|
||||
else
|
||||
url="cheat.sh/$selected~$query"
|
||||
fi
|
||||
|
||||
curl "$url"
|
Loading…
Reference in a new issue