diff --git a/README.md b/README.md index 3494004..b732679 100644 --- a/README.md +++ b/README.md @@ -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" ``` -Running the ./examples/commit.sh script to commit to git +Running the ./examples/commit.sh script to commit to git ## Installation diff --git a/examples/commit.sh b/examples/commit.sh index 0c0afd3..95c34ef 100755 --- a/examples/commit.sh +++ b/examples/commit.sh @@ -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"