Question about gum

Is anyone familiar with gum?

I have a simple:

while true; do
    CHOICE=$(gum choose "one" "two" "three")
    case "$CHOICE" in
        "one")
            <do something>
        "two")
            <do something>
        "three")
            <do something>
    esac
done

If the user hits ESC, gum displays "nothing selected" and exits.

Is there a way to disable the "nothing selected"? I tried redirecting 2>/dev/null but it suppresses the entire menu. I also tried adding $'\x1b' to the case, but it did nothing.

I also tried adding:

    if [ -z "$CHOICE" ]; then
        exit 0
    fi

directly after CHOICE=$(gum choose...).

No dice.

6 points · 2 comments · view on lemmy.world

2 Comments

lime@feddit.nu · 2 pts · 1y (1 reply)

looking at the code it doesn't seem possible to suppress the message. gum prints its menu to stderr, just like it does with any errors.

honestly you should probably file an issue for this, it seems like an oversight.

mike_wooskey@lemmy.thewooskeys.com · 1 pts · 1y

Thanks for taking a look.