~darklands/bkeep

caeff575b79186b4f08bbe569cec09cc4eabb7d8 — Ben O'Neill a month ago 46be757
redundant io redirect
1 files changed, 11 insertions(+), 11 deletions(-)

M bkeep_curses
M bkeep_curses => bkeep_curses +11 -11
@@ 3,11 3,11 @@
[ -z "$outfile" ] && outfile="$HOME/.local/share/bkeep_library.tsv"

add_entry() { \
	TITLE="$(dialog --title "bkeep" --inputbox "Please enter the title of the book." 10 60 3>&1 1>&2 2>&3 3>&1)" || exit
	AUTHOR="$(dialog --title "bkeep" --inputbox "Please enter the author of the book." 10 60 3>&1 1>&2 2>&3 3>&1)" || exit
	DESCRIPTION="$(dialog --title "bkeep" --inputbox "Please enter a short description of the book." 10 60 3>&1 1>&2 2>&3 3>&1)" || exit
	ISBN="$(dialog --title "bkeep" --inputbox "Please enter the ISBN of the book." 10 60 3>&1 1>&2 2>&3 3>&1)" || exit
	TAGS="$(dialog --title "bkeep" --inputbox "Please enter some comma-separated tags for the book." 10 60 3>&1 1>&2 2>&3 3>&1)" || exit
	TITLE="$(dialog --title "bkeep" --inputbox "Please enter the title of the book." 10 60 3>&1 1>&2 2>&3)" || exit
	AUTHOR="$(dialog --title "bkeep" --inputbox "Please enter the author of the book." 10 60 3>&1 1>&2 2>&3)" || exit
	DESCRIPTION="$(dialog --title "bkeep" --inputbox "Please enter a short description of the book." 10 60 3>&1 1>&2 2>&3)" || exit
	ISBN="$(dialog --title "bkeep" --inputbox "Please enter the ISBN of the book." 10 60 3>&1 1>&2 2>&3)" || exit
	TAGS="$(dialog --title "bkeep" --inputbox "Please enter some comma-separated tags for the book." 10 60 3>&1 1>&2 2>&3)" || exit
	bkeep a "$TITLE" "$AUTHOR" "$DESCRIPTION" "$ISBN" "$TAGS"
}



@@ 19,11 19,11 @@ edit_entry() { \
	while [ $editing = "yes" ]; do
		FIELD="$(dialog --title "bkeep" --menu "What do you want to edit?" 10 70 2 Title "" Author "" Description "" ISBN "" Tags "" 3>&1 1>&2 2>&3 3>&1)" || exit
		case "$FIELD" in
			"Title") VALUE="$(dialog --title "bkeep" --inputbox "Enter the new title for the book" 10 60 "$(sed -n "$ID"p "$outfile" | awk -F "\t" '{print $1}')"  3>&1 1>&2 2>&3 3>&1)" || exit ;;
			"Author") VALUE="$(dialog --title "bkeep" --inputbox "Enter the new author for the book" 10 60 "$(sed -n "$ID"p "$outfile" | awk -F "\t" '{print $2}')" 3>&1 1>&2 2>&3 3>&1)" || exit ;;
			"Description") VALUE="$(dialog --title "bkeep" --inputbox "Enter the new description for the book" 10 60 "$(sed -n "$ID"p "$outfile" | awk -F "\t" '{print $3}')" 3>&1 1>&2 2>&3 3>&1)" || exit ;;
			"ISBN") VALUE="$(dialog --title "bkeep" --inputbox "Enter the new ISBN for the book" 10 60 "$(sed -n "$ID"p "$outfile" | awk -F "\t" '{print $4}')" 3>&1 1>&2 2>&3 3>&1)" || exit ;;
			"Tags") VALUE="$(dialog --title "bkeep" --inputbox "Enter the new tags for the book" 10 60 "$(sed -n "$ID"p "$outfile" | awk -F "\t" '{print $5}')" 3>&1 1>&2 2>&3 3>&1)" || exit ;;
			"Title") VALUE="$(dialog --title "bkeep" --inputbox "Enter the new title for the book" 10 60 "$(sed -n "$ID"p "$outfile" | awk -F "\t" '{print $1}')"  3>&1 1>&2 2>&3)" || exit ;;
			"Author") VALUE="$(dialog --title "bkeep" --inputbox "Enter the new author for the book" 10 60 "$(sed -n "$ID"p "$outfile" | awk -F "\t" '{print $2}')" 3>&1 1>&2 2>&3)" || exit ;;
			"Description") VALUE="$(dialog --title "bkeep" --inputbox "Enter the new description for the book" 10 60 "$(sed -n "$ID"p "$outfile" | awk -F "\t" '{print $3}')" 3>&1 1>&2 2>&3)" || exit ;;
			"ISBN") VALUE="$(dialog --title "bkeep" --inputbox "Enter the new ISBN for the book" 10 60 "$(sed -n "$ID"p "$outfile" | awk -F "\t" '{print $4}')" 3>&1 1>&2 2>&3)" || exit ;;
			"Tags") VALUE="$(dialog --title "bkeep" --inputbox "Enter the new tags for the book" 10 60 "$(sed -n "$ID"p "$outfile" | awk -F "\t" '{print $5}')" 3>&1 1>&2 2>&3)" || exit ;;
		esac
		bkeep e "$ID" "$FIELD" "$VALUE"
	done


@@ 36,7 36,7 @@ rm_entry() { \
	bkeep r "$ID"
}

res="$(dialog --title "bkeep" --menu "What would you like to do?" 10 70 10 Add "Add a new book" Edit "Modify an entry" Remove "Remove a book by ID" 3>&1 1>&2 2>&3 3>&1)"
res="$(dialog --title "bkeep" --menu "What would you like to do?" 10 70 10 Add "Add a new book" Edit "Modify an entry" Remove "Remove a book by ID" 3>&1 1>&2 2>&3)"

case "$res" in
	"Add") add_entry ;;