docs: gum confirm

This commit is contained in:
Maas Lalani 2022-07-26 16:09:33 -04:00
parent cb2c6ca2dd
commit 8f7a921e6a
No known key found for this signature in database
GPG key ID: 5A6ED5CBF1A0A000
2 changed files with 15 additions and 3 deletions

View file

@ -188,6 +188,18 @@ cat foods.txt | gum choose --no-limit
<img src="https://stuff.charm.sh/gum/choose.gif?cache=1" width="600" alt="Shell running gum choose with numbers and gum flavors" />
#### Confirm
Confirm whether to perform an action. Exits with code `0` (affirmative) or `1`
(negative) depending on selection.
```bash
gum confirm && rm file.txt || echo "File not removed"
```
<img src="https://stuff.charm.sh/gum/confirm.gif?cache=1" width="600" alt="Shell running gum confirm" />
#### Spin
Display a spinner while running a script or command. The spinner will

View file

@ -8,7 +8,7 @@ type Options struct {
Negative string `help:"The title of the negative action" default:"No"`
Prompt string `arg:"" help:"Prompt to display." default:"Are you sure?"`
Vertical bool `help:"Whether to display the options vertically" default:"false"`
PromptStyle style.Styles `embed:"" prefix:"prompt." help:"The style of the prompt"`
UnselectedStyle style.Styles `embed:"" prefix:"unselected." help:"The style of the unselected action" set:"defaultBackground=0" set:"defaultPadding=0 3" set:"defaultMargin=1 1"`
SelectedStyle style.Styles `embed:"" prefix:"selected." help:"The style of the selected action" set:"defaultBackground=8" set:"defaultForeground=212" set:"defaultPadding=0 3" set:"defaultMargin=1 1"`
PromptStyle style.Styles `embed:"" prefix:"prompt." help:"The style of the prompt" set:"defaultMargin=1 0 0 0"`
UnselectedStyle style.Styles `embed:"" prefix:"unselected." help:"The style of the unselected action" set:"defaultBackground=237" set:"defaultPadding=0 3" set:"defaultMargin=1 1"`
SelectedStyle style.Styles `embed:"" prefix:"selected." help:"The style of the selected action" set:"defaultBackground=240" set:"defaultForeground=212" set:"defaultPadding=0 3" set:"defaultMargin=1 1"`
}