From e3b281b9415164a467fabe5766dd9da36487e774 Mon Sep 17 00:00:00 2001 From: punkfairie Date: Sun, 16 Mar 2025 12:44:14 -0700 Subject: [PATCH] feat(home/lazygit): Add conventional commit command --- modules/home/programs/tui/lazygit/default.nix | 104 +++++++++++++++++- 1 file changed, 100 insertions(+), 4 deletions(-) diff --git a/modules/home/programs/tui/lazygit/default.nix b/modules/home/programs/tui/lazygit/default.nix index ffa9dff..8bd5d69 100644 --- a/modules/home/programs/tui/lazygit/default.nix +++ b/modules/home/programs/tui/lazygit/default.nix @@ -27,11 +27,107 @@ in { customCommands = [ { key = "C"; - command = "cz c"; - description = "commit with commitizen"; context = "files"; - loadingText = "opening commitizen tool"; - subprocess = true; + description = "Create new conventional commit"; + prompts = [ + { + type = "menu"; + key = "Type"; + title = "Type of change"; + options = [ + { + name = "build"; + description = "Changes that affect the build system or external dependencies"; + value = "build"; + } + { + name = "feat"; + description = "A new feature"; + value = "feat"; + } + { + name = "fix"; + description = "A bug fix"; + value = "fix"; + } + { + name = "chore"; + description = "Other changes that don't modify src or test files"; + value = "chore"; + } + { + name = "ci"; + description = "Changes to CI configuration files and scripts"; + value = "ci"; + } + { + name = "docs"; + description = "Documentation only changes"; + value = "docs"; + } + { + name = "perf"; + description = "A code change that improves performance"; + value = "perf"; + } + { + name = "refactor"; + description = "A code change that neither fixes a bug nor adds a feature"; + value = "refactor"; + } + { + name = "revert"; + description = "Reverts a previous commit"; + value = "revert"; + } + { + name = "style"; + description = "Changes that do not affect the meaning of the code"; + value = "style"; + } + { + name = "test"; + description = "Adding missing tests or correcting existing tests"; + value = "test"; + } + ]; + } + { + type = "input"; + title = "Scope"; + key = "Scope"; + initialValue = ""; + } + { + type = "menu"; + key = "Breaking"; + title = "Breaking change"; + options = [ + { + name = "no"; + value = ""; + } + { + name = "yes"; + value = "!"; + } + ]; + } + { + type = "input"; + title = "message"; + key = "Message"; + initialValue = ""; + } + { + type = "confirm"; + key = "Confirm"; + title = "Commit"; + body = "Are you sure you want to commit?"; + } + ]; + command = "git commit --message '{{.Form.Type}}{{ if .Form.Scope }}({{ .Form.Scope }}){{ end }}{{.Form.Breaking}}: {{.Form.Message}}'"; + loadingText = "Creating conventional commit..."; } ]; };