-
Notifications
You must be signed in to change notification settings - Fork 323
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Feature Request] Ability to map choose
values to keys
#43
Comments
Hey!
Thank you for the kind words! You can actually accomplish this with pure shell scripting, here is an example: https://github.com/charmbracelet/gum/blob/main/examples/filter-key-value.sh export LIST=$(cat <<END
Cow:Moo
Cat:Meow
Dog:Woof
END)
ANIMAL=$(echo "$LIST" | cut -d':' -f1 | gum filter)
SOUND=$(echo "$LIST" | grep $ANIMAL | cut -d':' -f2)
echo "The $ANIMAL goes $SOUND"
This allows everyone to use whatever delimiters they want and makes it much more flexible instead of prescribing a solution with flags inside of |
😢 That's not really the same and MUCH LESS readable. But thanks for the suggestion. |
Hmm, I may have misinterpreted your original example then. Could you elaborate on what you are trying to do and I can try and put together a more readable example for you? |
No, it seems that your interpretation was correct. :) However, I'll implement new behavior for myself anyway and then I can show the code - maybe you'll reconsider. :) Thanks. |
This is not a suggested syntax - snippet if purely for demonstration purposes:
Motivation: in many cases it would be nice to use some id-values for
choose
command instead of duplicating human-readable values two times: in command and in control script.P.S. Thanks for the tool - it's awesome. Yesterday I integrated in some of my fish functions for administration and it's so much nicer to use now!
The text was updated successfully, but these errors were encountered: