From 3df07d762232e0c24a60adba78f1acf4459a4d67 Mon Sep 17 00:00:00 2001 From: Arthur Roberts Date: Thu, 21 Aug 2025 02:11:55 +0100 Subject: [PATCH] Added some more explanation around the script --- scryfall_deser/scripts/search_with_rofi.sh | 20 ++++++++++++++++++++ scryfall_deser/src/main.rs | 2 +- 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/scryfall_deser/scripts/search_with_rofi.sh b/scryfall_deser/scripts/search_with_rofi.sh index 0e44f81..a9aca80 100755 --- a/scryfall_deser/scripts/search_with_rofi.sh +++ b/scryfall_deser/scripts/search_with_rofi.sh @@ -1,9 +1,15 @@ #!/bin/sh +# Note to self in this... The whitespace seemed to fuck the ifs up. Not sure why. +# This is why it's all flat and ugly + CARDS=$(/home/arthurr/code/mini_projects/scryfall_deser/target/debug/scryfall_deser $@) RETURN=$? echo $RETURN +####################### +## Cards to select from +####################### if [ $RETURN -eq 0 ]; then SELECTION=$(rofi -dmenu -i << EOF @@ -21,8 +27,13 @@ sleep 0.05 rofi -e "$CARD_OUTPUT" fi +########################## +## Not even one card that matched - try a close string +########################## if [ $RETURN -eq 105 ]; then +# TODO do something different with no matching string at all - perhaps even a different ExitCode? + SELECTION=$(rofi -dmenu -p "Did you mean?" -i << EOF $CARDS EOF @@ -42,3 +53,12 @@ sleep 0.05 rofi -e "$CARD_OUTPUT" fi + +############################### +## No seach string input at all +############################### +if [ $RETURN -eq 101 ]; then + +rofi -e "No search string found" + +fi diff --git a/scryfall_deser/src/main.rs b/scryfall_deser/src/main.rs index bc01378..1d7060d 100644 --- a/scryfall_deser/src/main.rs +++ b/scryfall_deser/src/main.rs @@ -78,7 +78,7 @@ fn main() -> MtgCardExit { return MtgCardExit::Success; } if args.search_text.is_empty() { - println!("You need to put some card text to search"); + dbg!("You need to put some card text to search"); return MtgCardExit::EmptySearchString; }