docs: note on gum confirm exit codes

This commit is contained in:
Maas Lalani 2022-07-27 18:45:59 -04:00
parent d80b425e80
commit e0beb050fd
No known key found for this signature in database
GPG key ID: 5A6ED5CBF1A0A000
2 changed files with 3 additions and 2 deletions

View file

@ -61,6 +61,7 @@ gum write --placeholder "Details of this change"
```
Prompt for a confirmation before committing:
> `gum confirm` exits with status `0` if confirmed and status `1` if cancelled.
```bash
gum confirm "Commit changes?" && git commit -m "$SUMMARY" -m "$DESCRIPTION"
@ -84,7 +85,7 @@ DESCRIPTION=$(gum write --placeholder "Details of this change")
gum confirm "Commit changes?" && git commit -m "$SUMMARY" -m "$DESCRIPTION"
```
<img src="https://stuff.charm.sh/gum/commit_1.gif" width="600" alt="Running the ./examples/commit.sh script to commit to git" />
<img src="https://stuff.charm.sh/gum/commit_2.gif" width="600" alt="Running the ./examples/commit.sh script to commit to git" />
## Installation

View file

@ -21,4 +21,4 @@ SUMMARY=$(gum input --value "$TYPE$SCOPE: " --placeholder "Summary of this chang
DESCRIPTION=$(gum write --placeholder "Details of this change")
# Commit these changes if user confirms
gum confirm && git commit -m "$SUMMARY" -m "$DESCRIPTION"
gum confirm "Commit changes?" && git commit -m "$SUMMARY" -m "$DESCRIPTION"