diff options
author | cbreton <corentin.breton@fullsave.com> | 2020-01-20 09:59:04 +0100 |
---|---|---|
committer | cbreton <corentin.breton@fullsave.com> | 2020-01-20 09:59:04 +0100 |
commit | bcda7acbba9c4e4eaa76084edb2c80e27668aa6f (patch) | |
tree | bd92ab8da8186784075108f6ad1a90bdb1e2c233 /dotfiles | |
parent | ec1a06dca4f3b2caf4f4cad1e6a0b38ff6a29d46 (diff) | |
download | dotfiles_dotdrop-bcda7acbba9c4e4eaa76084edb2c80e27668aa6f.tar.xz dotfiles_dotdrop-bcda7acbba9c4e4eaa76084edb2c80e27668aa6f.zip |
Add script to edit a cheatsheet by tag
Diffstat (limited to 'dotfiles')
-rwxr-xr-x | dotfiles/scripts/cheate | 15 | ||||
-rwxr-xr-x | dotfiles/zsh/01-aliases.zsh | 2 |
2 files changed, 16 insertions, 1 deletions
diff --git a/dotfiles/scripts/cheate b/dotfiles/scripts/cheate new file mode 100755 index 0000000..ad3ad8e --- /dev/null +++ b/dotfiles/scripts/cheate @@ -0,0 +1,15 @@ +#!/bin/bash + +nb_cheats=$(cheat -l | grep -w "$2" | grep -w $1 | wc -l) + +if [ $nb_cheats -gt 1 ]; then + echo "Please chose between the tags:" + cheat -l | grep -w "$2" | grep -w $1 | awk '{print $3}' + echo "Usage: $0 <name> <tag>" + exit +fi +if [ -Z $2 ]; then + cheat -e $1 +else + cheat -p $2 -e $1 +fi diff --git a/dotfiles/zsh/01-aliases.zsh b/dotfiles/zsh/01-aliases.zsh index 3fa422e..94f57f8 100755 --- a/dotfiles/zsh/01-aliases.zsh +++ b/dotfiles/zsh/01-aliases.zsh @@ -196,7 +196,7 @@ alias an2lperso="an2l ~/.ssh/id_rsa_mail 212.47.251.250 tun0" alias has="HAS_ALLOW_UNSAFE=y has" alias cheatl="cheat -l" alias cheatv="~/.scripts/cheatv" -alias cheate="cheat -e" +alias cheate="~/.scripts/cheate" alias bc="bc -l" alias calc="bc -l" |