TheMathemagicians/sevenkeys/storagemanager

52 lines
754 B
Plaintext
Raw Normal View History

2024-05-27 12:31:53 +00:00
#!/bin/bash
2024-05-27 12:48:38 +00:00
printLastInsertedCard() {
printf "Last inserted card: "
if test -n "$1"; then
printf "$1"
else
printf "None"
fi
printf "\n"
}
searchForCard() {
# TODO: Add keybinding to show card image with feh
./printinglist | fzf
}
declare g_lastInsertedCardId
declare g_lastInsertedCardName
2024-05-27 12:31:53 +00:00
while true; do
2024-05-27 12:48:38 +00:00
clear
printLastInsertedCard "$g_lastInsertedCardName"
printf "search? (y/N)"
read response
if [[ "$response" == "y" ]]; then
selection="$(searchForCard)"
case "$?" in
0)
# Insert the card
printf "$selection\n"
# TODO: set last inserted card name and id
;;
1)
# Print "no match" error
;;
2)
# Print error
;;
130)
# User cancelled search
;;
esac
else
break
fi
2024-05-27 12:31:53 +00:00
done