From 00dab3aa2a7a3af319f01628f2080e474ae65260 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alan=20Gonz=C3=A1lez?= Date: Thu, 27 Jun 2024 21:15:15 -0600 Subject: [PATCH] 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 --- Custom-Commands-Compendium.md | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/Custom-Commands-Compendium.md b/Custom-Commands-Compendium.md index b7500c4..6c08121 100644 --- a/Custom-Commands-Compendium.md +++ b/Custom-Commands-Compendium.md @@ -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: "" 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 '()'" + 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..." ```