[Abcde-users] [PATCH 4/6] Add more help in match choice prompt
Snild Dolkow
snild at dolkow.se
Sun Aug 20 08:36:56 BST 2023
By inputting '?' (or any unknown non-number input), you will get some
short info about the result of your choice here. Also adding 'd', as a
hint that diffing is possible.
Before:
Which entry would you like abcde to use (0 for none)? [0-4]:
After:
Which entry would you like abcde to use? [0,1,2,3,4,d,?]:
Closes Issue 98: https://abcde.einval.com/bugzilla/show_bug.cgi?id=98
---
abcde | 14 ++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)
diff --git a/abcde b/abcde
index 5d86b35..097f0ef 100755
--- a/abcde
+++ b/abcde
@@ -2917,11 +2917,15 @@ do_cddbedit ()
CDDBCHOICENUM=""
# Setting the choice to an impossible integer to avoid errors in the numeric comparisons
CDCHOICENUM=-1
+ ENTRYLIST=($(f_seq_row 1 $NUM_CDDB_MATCHES))
+ ENTRYLIST=$(IFS=,; echo "${ENTRYLIST[*]}") # if I had the real seq, I could use `-s,`
# I'll take CDDB read #3 for $400, Alex
while [ $CDCHOICENUM -lt 0 ] || [ $CDCHOICENUM -gt $NUM_CDDB_MATCHES ]; do
- echo -n "Which entry would you like abcde to use (0 for none)? [0-$NUM_CDDB_MATCHES]: " >&2
+ echo -n "Which entry would you like abcde to use? [0,$ENTRYLIST,d,?]: " >&2
read CDDBCHOICE
- if echo $CDDBCHOICE | grep -E "[[:space:]]*[[:digit:]]+,[[:digit:]]+[[:space:]]*" > /dev/null 2>&1 ; then
+ if [ "$CDDBCHOICE" = "d" ]; then
+ echo "To diff two entries, input two numbers separated by a comma, e.g. 1,2 or 3,5" >&2
+ elif echo $CDDBCHOICE | grep -E "[[:space:]]*[[:digit:]]+,[[:digit:]]+[[:space:]]*" > /dev/null 2>&1 ; then
if [ ! X"$DIFF" = "X" ]; then
PARSECHOICE1=$(echo $CDDBCHOICE | cut -d"," -f1 | xargs printf %d 2>/dev/null)
PARSECHOICE2=$(echo $CDDBCHOICE | cut -d"," -f2 | xargs printf %d 2>/dev/null)
@@ -2953,6 +2957,12 @@ do_cddbedit ()
if [ "$CDCHOICENUM" -lt 0 ] || [ "$CDCHOICENUM" -gt "$NUM_CDDB_MATCHES" ]; then
echo "Invalid selection. Please choose a number between 0 and $NUM_CDDB_MATCHES." >&2
fi
+ else
+ echo "0: Continue with no match; you will have the option to input metadata manually." >&2
+ echo "<number>: Continue with the selected match; you will be able to make adjustments." >&2
+ echo "<n>,<m>: Show a diff between entries n and m, e.g. 1,2 or 3,5." >&2
+ echo "d: Just a hint that diffing is possible; outputs instructions for how to do it." >&2
+ echo "?: Show this help text." >&2
fi
done
if [ "$CDCHOICENUM" = "0" ]; then
--
2.41.0
More information about the Abcde-users
mailing list