From ec1a06dca4f3b2caf4f4cad1e6a0b38ff6a29d46 Mon Sep 17 00:00:00 2001 From: cbreton Date: Mon, 20 Jan 2020 09:58:18 +0100 Subject: [cheat] Add warning to choose the tags when multi tags --- dotfiles/scripts/cheatv | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) 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 " + exit +fi + +cheat_path=$(cheat -l | grep -w "$2" | grep -w $1 | awk '{print $2}') ~/bin/clima -p $cheat_path -- cgit v1.2.1