docs: add gum confirm to commit.sh script

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

View file

@ -60,6 +60,12 @@ Prompt for a detailed (multi-line) explanation of the changes:
gum write --placeholder "Details of this change"
```
Prompt for a confirmation before committing:
```bash
gum confirm "Commit changes?" && git commit -m "$SUMMARY" -m "$DESCRIPTION"
```
Putting it all together...
```bash
@ -75,10 +81,10 @@ SUMMARY=$(gum input --value "$TYPE$SCOPE: " --placeholder "Summary of this chang
DESCRIPTION=$(gum write --placeholder "Details of this change")
# Commit these changes
git commit -m "$SUMMARY" -m "$DESCRIPTION"
gum confirm "Commit changes?" && git commit -m "$SUMMARY" -m "$DESCRIPTION"
```
<img src="https://stuff.charm.sh/gum/commit.gif" width="600" alt="Running the ./examples/commit.sh script to commit to git" />
<img src="https://stuff.charm.sh/gum/commit_1.gif" width="600" alt="Running the ./examples/commit.sh script to commit to git" />
## Installation

View file

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