TheMathemagicians/sevenkeys/storagemanager

52 lines
754 B
Bash
Executable File

#!/bin/bash
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
while true; do
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
done