Use conditional go template, to write the scope of the commit so the user, just needs to type the scope, and make the breaking change a (yes/no) prompt instead of a input

Alan González 2024-06-27 21:15:15 -06:00
parent e9d9dcec3e
commit 00dab3aa2a

@ -388,6 +388,7 @@ Prompts to follow the [conventional commits](https://www.conventionalcommits.org
```yaml
customCommands:
# retrieved from: https://github.com/jesseduffield/lazygit/wiki/Custom-Commands-Compendium#conventional-commit
- key: "<c-v>"
context: "global"
description: "Create new conventional commit"
@ -430,13 +431,17 @@ customCommands:
description: "Adding missing tests or correcting existing tests"
value: "test"
- type: "input"
title: "Scope - Add '(<scope>)'"
title: "Scope"
key: "Scope"
initialValue: ""
- type: "input"
title: "Breaking change - Add '!'"
- type: "menu"
key: "Breaking"
initialValue: ""
title: "Breaking change"
options:
- name: "no"
value: ""
- name: "yes"
value: "!"
- type: "input"
title: "message"
key: "Message"
@ -445,7 +450,7 @@ customCommands:
key: "Confirm"
title: "Commit"
body: "Are you sure you want to commit?"
command: "git commit --message '{{.Form.Type}}{{.Form.Scope}}{{.Form.Breaking}}: {{.Form.Message}}'"
command: "git commit --message '{{.Form.Type}}{{ if .Form.Scope }}({{ .Form.Scope }}){{ end }}{{.Form.Breaking}}: {{.Form.Message}}'"
loadingText: "Creating conventional commit..."
```