mirror of
https://github.com/charmbracelet/gum
synced 2024-06-15 20:15:08 +02:00
Add staged file check for commit example
This commit is contained in:
parent
46dee843db
commit
214a9f8b88
|
@ -20,5 +20,11 @@ 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"
|
||||
|
|
Loading…
Reference in a new issue