mirror of
https://github.com/charmbracelet/gum
synced 2026-03-14 21:55:45 +01:00
docs: add filter example with identification (key / value)
This commit is contained in:
parent
fd50224627
commit
75a10561fa
1 changed files with 7 additions and 2 deletions
|
|
@ -1,7 +1,12 @@
|
|||
#!/bin/bash
|
||||
|
||||
cat <<EOF | gum filter
|
||||
export LIST=$(cat <<END
|
||||
Cow:Moo
|
||||
Cat:Meow
|
||||
Dog:Woof
|
||||
EOF
|
||||
END)
|
||||
|
||||
ANIMAL=$(echo "$LIST" | cut -d':' -f1 | gum filter)
|
||||
SOUND=$(echo "$LIST" | grep $ANIMAL | cut -d':' -f2)
|
||||
|
||||
echo "The $ANIMAL goes $SOUND"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue