mirror of
https://github.com/charmbracelet/gum
synced 2024-05-29 03:42:26 +02:00
docs(examples): Add example of conventional commit script
This change adds an example script of how to prompt the user for the necessary information for a conventional commit.
This commit is contained in:
parent
593cf711be
commit
11e7e18256
23
examples/commit.sh
Executable file
23
examples/commit.sh
Executable file
|
@ -0,0 +1,23 @@
|
|||
#!/bin/bash
|
||||
|
||||
# This script is used to write a conventional commit message.
|
||||
# It prompts the user to choose the type of commit as specified in the
|
||||
# conventional commit spec. And then prompts for the summary and detailed
|
||||
# description of the message and uses the values provided. as the summary and
|
||||
# details of the message.
|
||||
#
|
||||
# If you want to add a simpler version of this script to your dotfiles, use:
|
||||
#
|
||||
# alias gcm='git commit -m "$(gum input)" -m "$(gum write)"'
|
||||
|
||||
|
||||
TYPE=$(gum choose "fix" "feat" "docs" "style" "refactor" "test" "chore" "revert")
|
||||
SCOPE=$(gum input --placeholder "scope")
|
||||
|
||||
if [ -n "$SCOPE" ]; then
|
||||
SCOPE="($SCOPE)"
|
||||
fi
|
||||
|
||||
git commit \
|
||||
-m "$(gum input --value "$TYPE$SCOPE: " --placeholder "Summary of this change")" \
|
||||
-m "$(gum write --placeholder "Details of this change")"
|
Loading…
Reference in a new issue