fix: stage all confirmation

This commit is contained in:
Maas Lalani 2023-02-27 19:18:12 -05:00
parent 214a9f8b88
commit 07dd11fe45
No known key found for this signature in database
GPG key ID: 5A6ED5CBF1A0A000

View file

@ -10,6 +10,10 @@
#
# alias gcm='git commit -m "$(gum input)" -m "$(gum write)"'
if [ -z "$(git status -s -uno | grep -v '^ ' | awk '{print $2}')" ]; then
gum confirm "Stage all?" && git add .
fi
TYPE=$(gum choose "fix" "feat" "docs" "style" "refactor" "test" "chore" "revert")
SCOPE=$(gum input --placeholder "scope")
@ -20,11 +24,5 @@ test -n "$SCOPE" && SCOPE="($SCOPE)"
SUMMARY=$(gum input --value "$TYPE$SCOPE: " --placeholder "Summary of this change")
DESCRIPTION=$(gum write --placeholder "Details of this change")
# Check if any staged files are present. If there are non, ask the user if
# they want to commit all files
if [ -z "$(git status -s -uno | grep -v '^ ' | awk '{print $2}')" ]; then
gum confirm "No staged files. Commit all?" && git add .
fi
# Commit these changes if user confirms
gum confirm "Commit changes?" && git commit -m "$SUMMARY" -m "$DESCRIPTION"