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.

  • lime!@feddit.nu
    link
    fedilink
    English
    arrow-up
    2
    ·
    3 days ago

    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.