1
0
Fork 0
mirror of https://github.com/tldr-pages/tldr.git synced 2025-07-02 09:35:24 +02:00
tldr/pages/common/gum.md

29 lines
982 B
Markdown
Raw Normal View History

2022-08-08 13:12:22 +00:00
# gum
> Make glamorous shell scripts.
2022-08-08 13:12:22 +00:00
> More information: <https://github.com/charmbracelet/gum>.
- Interactively pick a specific option to print to `stdout`:
`gum choose "{{option_1}}" "{{option_2}}" "{{option_3}}"`
- Open an interactive prompt for the user to input a string with a specific placeholder:
`gum input --placeholder "{{value}}"`
- Open an interactive confirmation prompt and exit with either `<0>` or `<1>`:
2022-08-08 13:12:22 +00:00
`gum confirm "{{Continue?}}" --default=false --affirmative "{{Yes}}" --negative "{{No}}" {{&& echo "Yes selected" || echo "No selected"}}`
- Show a spinner while a command is taking place with text alongside:
`gum spin --spinner {{dot|line|minidot|jump|pulse|points|globe|moon|monkey|meter|hamburger}} --title "{{loading...}}" -- {{command}}`
- Format text to include emojis:
`gum format -t {{emoji}} "{{:smile: :heart: hello}}"`
- Interactively prompt for multi-line text (`<Ctrl d>` to save) and write to `data.txt`:
2022-08-08 13:12:22 +00:00
`gum write > {{data.txt}}`