changelog generator & diff tool stormlightlabs.github.io/git-storm/
changelog changeset markdown golang git
at main 1.3 kB view raw
1package main 2 3import ( 4 "context" 5 "fmt" 6 7 "github.com/charmbracelet/fang" 8 "github.com/charmbracelet/log" 9 "github.com/spf13/cobra" 10 "github.com/stormlightlabs/git-storm/internal/style" 11) 12 13var ( 14 repoPath string 15 output string 16) 17 18// TODO: use ldflags 19const versionString string = "0.1.0-dev" 20 21func versionCmd() *cobra.Command { 22 return &cobra.Command{ 23 Use: "version", 24 Short: "Print the current storm version", 25 RunE: func(cmd *cobra.Command, args []string) error { 26 fmt.Println(versionString) 27 return nil 28 }, 29 } 30} 31 32func main() { 33 ctx := context.Background() 34 root := &cobra.Command{ 35 Use: "storm", 36 Short: "A Git-aware changelog manager for Go projects", 37 Long: `storm is a modern changelog generator inspired by Towncrier. 38It manages .changes/ entries, generates Keep a Changelog sections, 39and can review commits interactively through a TUI.`, 40 } 41 42 root.PersistentFlags().StringVar(&repoPath, "repo", ".", "Path to the Git repository") 43 root.PersistentFlags().StringVarP(&output, "output", "o", "CHANGELOG.md", "Output changelog file path") 44 root.AddCommand(generateCmd(), unreleasedCmd(), releaseCmd(), bumpCmd(), diffCmd(), checkCmd(), versionCmd()) 45 46 if err := fang.Execute(ctx, root, fang.WithColorSchemeFunc(style.NewColorScheme)); err != nil { 47 log.Fatalf("Execution failed: %v", err) 48 } 49}