This commit uses the embedded style struct for styling in all components. The most notable example is `gum write` where there are many styles that are used and composed for each component of the command.
The magic example shows the user a bash magic trick by asking them to choose a card and then showing them their card.
A script never reveals its secrets. (unless you look at ./examples/magic.sh)
gum choose allows the user to be prompted for a choice from a list of choices.
For example, let's ask the user to pick a card from a deck.
gum choose --height 15 {Ace,King,Queen,Jack,Ten,Nine,Eight,Seven,Six,Five,Four,Three,Two}" of "{Spades,Hearts,Clubs,Diamonds}
This commit adds usage examples to the README.md on how users can use
gum in their workflows. In fact, this commit message is being created
through the `gum write` command as shown in the example!
Write provides a shell script interface for the text area bubble. It can
be used to ask the user to write some long form of text (multi-line)
input. The text the user entered will be sent to stdout.
```
gum write > output.text
```
Style provides a shell script interface for Lip Gloss. It allows you to
use Lip Gloss to style text without needing to use Go. All of the
styling options are available as flags.
Let's make some text glamorous using bash:
```
gum style \
--foreground "#FF06B7" --border "double" \
--margin 2 --padding "2 4" --width 50 \
"And oh gosh, how delicious the fabulous frizzy frobscottle" \
"was! It was sweet and refreshing. It tasted of vanilla and" \
"cream, with just the faintest trace of raspberries on the" \
"edge of the flavour. And the bubbles were wonderful."
```
Output:
```
╔══════════════════════════════════════════════════╗
║ ║
║ ║
║ And oh gosh, how delicious the fabulous ║
║ frizzy frobscottle was It was sweet and ║
║ refreshing. It tasted of vanilla and ║
║ cream, with just the faintest trace of ║
║ raspberries on the edge of the flavour. ║
║ And the bubbles were wonderful. ║
║ ║
║ ║
╚══════════════════════════════════════════════════╝
```
Spin provides a shell script interface for the spinner bubble. It is
useful for displaying that some task is running in the background while
consuming it's output so that it is not shown to the user.
For example, let's do a long running task:
```
sleep 5
```
We can simply prepend a spinner to this task to show it to the user,
while performing the task / command in the background.
```
gum spin -t "Taking a nap..." -- sleep 5
```
The spinner will automatically exit when the task is complete.
Search provides a fuzzy searching text input to allow filtering a list
of options to select one option.
i.e. Let's pick from a list of gum flavors:
```
cat flavors.text | gum search
```
Input provides a shell script interface for the text input bubble. It
can be used to prompt the user for some input. The text the user entered
will be sent to `stdout`.
```
gum input --placeholder "What's your Bubble Gum flavor?" > answer.text
````