aboutsummaryrefslogtreecommitdiff
path: root/dotfiles/scripts/cheatv
diff options
context:
space:
mode:
Diffstat (limited to 'dotfiles/scripts/cheatv')
-rwxr-xr-xdotfiles/scripts/cheatv11
1 files changed, 10 insertions, 1 deletions
diff --git a/dotfiles/scripts/cheatv b/dotfiles/scripts/cheatv
index b052dfe..a3286fd 100755
--- a/dotfiles/scripts/cheatv
+++ b/dotfiles/scripts/cheatv
@@ -1,5 +1,14 @@
#!/bin/bash
-cheat_path=$(cheat -l | grep $1 | awk '{print $2}')
+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
+
+cheat_path=$(cheat -l | grep -w "$2" | grep -w $1 | awk '{print $2}')
~/bin/clima -p $cheat_path