Debian Codegraph @

examples/git/main.go

raw symbols SCIP
1 package main
2
3 import (
4 "github.com/charmbracelet/huh"
5 )
6
7 // types is the possible commit types specified by the conventional commit spec.
8 var types = []string{"fix", "feat", "docs", "style", "refactor", "test", "chore", "revert"}
9
10 // This form is used to write a conventional commit message. It prompts the user
11 // to choose the type of commit as specified in the conventional commit spec.
12 // And then prompts for the summary and detailed description of the message and
13 // uses the values provided as the summary and details of the message.
14 func main() {
15 var commit, scope string
16 var summary, description string
17 var confirm bool
18
19 huh.NewForm(
20 huh.NewGroup(
21 huh.NewInput().Title("Type").Value(&commit).Placeholder("feat").Suggestions(types),
22 huh.NewInput().Title("Scope").Value(&scope).Placeholder("scope"),
23 ),
24 huh.NewGroup(
25 huh.NewInput().Title("Summary").Value(&summary).Placeholder("Summary of changes"),
26 huh.NewText().Title("Description").Value(&description).Placeholder("Detailed description of changes"),
27 ),
28 huh.NewGroup(huh.NewConfirm().Title("Commit changes?").Value(&confirm)),
29 ).Run()
30 }