Skip to content

Instantly share code, notes, and snippets.

@Lemorz56
Last active December 3, 2023 17:31
Show Gist options
  • Save Lemorz56/84653d19c2c8d62aa80c1b5d15a22b11 to your computer and use it in GitHub Desktop.
Save Lemorz56/84653d19c2c8d62aa80c1b5d15a22b11 to your computer and use it in GitHub Desktop.
Convetional Commit Ps1 script with GUM
# Requires: go install github.com/charmbracelet/gum@latest
function pscom() {
$TYPE = (gum choose "fix" "feat" "docs" "perf" "refacor" "style" "test" "chore" "revert")
$SCOPE = (gum input --placeholder "scope")
# Since the scope is optional, wrap it in parentheses if it has a value.
if ($SCOPE -ne "") { $SCOPE = "($SCOPE)" }
# Pre-populate the input with the type(scope): so that the user may change it
$SUMMARY = (gum input --value "$TYPE$SCOPE`: " --placeholder "Summary of this change")
$DESCRIPTION = (gum write --placeholder "Details of this change (CTRL+D to finish)")
# Commit these changes
gum confirm "Commit changes?" && git commit -m "$SUMMARY" -m "$DESCRIPTION"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment