From 8f7a921e6a788476354049d0225a71a3fb5f1745 Mon Sep 17 00:00:00 2001 From: Maas Lalani Date: Tue, 26 Jul 2022 16:09:33 -0400 Subject: [PATCH] docs: `gum confirm` --- README.md | 12 ++++++++++++ confirm/options.go | 6 +++--- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 05b1542..2002404 100644 --- a/README.md +++ b/README.md @@ -188,6 +188,18 @@ cat foods.txt | gum choose --no-limit 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" +``` + +Shell running gum confirm + + #### Spin Display a spinner while running a script or command. The spinner will diff --git a/confirm/options.go b/confirm/options.go index ceb9c7b..c5360bb 100644 --- a/confirm/options.go +++ b/confirm/options.go @@ -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"` }