mirror of
https://github.com/charmbracelet/gum
synced 2024-05-15 20:56:41 +02:00
docs: Add examples of gum choose --limit and --no-limit
This commit is contained in:
parent
54f85439fa
commit
eae3cf8c64
23
README.md
23
README.md
|
@ -111,7 +111,6 @@ cat flavors.text | gum filter > selection.text
|
|||
|
||||
Ask your users to choose an option from a list of choices.
|
||||
|
||||
|
||||
```bash
|
||||
echo "Pick a card, any card..."
|
||||
CARD=$(gum choose --height 15 {{A,K,Q,J},{10..2}}" "{♠,♥,♣,♦})
|
||||
|
@ -120,6 +119,20 @@ echo "Was your card the $CARD?"
|
|||
|
||||
<img src="https://stuff.charm.sh/gum/choose.gif" width="400" alt="Shell running gum choose on a deck of cards, picking the Ace of Hearts">
|
||||
|
||||
You can also set a limit on the number of items to choose with the `--limit` flag.
|
||||
|
||||
```bash
|
||||
echo "Pick your top 5 songs."
|
||||
cat songs.txt | gum choose --limit 5
|
||||
```
|
||||
|
||||
Or, allow any number of selections with the `--no-limit` flag.
|
||||
|
||||
```bash
|
||||
echo "What do you need from the grocery store?"
|
||||
cat foods.txt | gum choose --no-limit
|
||||
```
|
||||
|
||||
#### Progress
|
||||
|
||||
Display a progress bar while loading. The following command will display a
|
||||
|
@ -250,6 +263,14 @@ commit hash of the selected commit.
|
|||
git log --oneline | gum filter | cut -d' ' -f1 # | copy
|
||||
```
|
||||
|
||||
#### Choose packages to uninstall
|
||||
|
||||
List all packages installed by your package manager (we'll use `brew`) and
|
||||
choose which packages to uninstall.
|
||||
|
||||
```bash
|
||||
brew list | gum choose --no-limit | xargs brew uninstall
|
||||
```
|
||||
|
||||
## Feedback
|
||||
|
||||
|
|
Loading…
Reference in a new issue