diff --git a/app/app.go b/app/app.go index 3b88fd2..c2b151f 100644 --- a/app/app.go +++ b/app/app.go @@ -14,6 +14,7 @@ import ( "github.com/Masterminds/semver/v3" "github.com/thegeeklab/git-sv/v2/sv" "github.com/thegeeklab/git-sv/v2/sv/formatter" + "github.com/thegeeklab/git-sv/v2/templates" ) const ( @@ -61,8 +62,7 @@ type GitSV struct { MessageProcessor sv.MessageProcessor CommitProcessor sv.CommitProcessor ReleasenotesProcessor sv.ReleaseNoteProcessor - - OutputFormatter formatter.OutputFormatter + OutputFormatter formatter.OutputFormatter } // New constructor. @@ -72,6 +72,9 @@ func New() GitSV { } g.MessageProcessor = sv.NewMessageProcessor(g.Config.CommitMessage, g.Config.Branches) + g.CommitProcessor = sv.NewSemVerCommitProcessor(g.Config.Versioning, g.Config.CommitMessage) + g.ReleasenotesProcessor = sv.NewReleaseNoteProcessor(g.Config.ReleaseNotes) + g.OutputFormatter = formatter.NewOutputFormatter(templates.New(configDir)) return g } diff --git a/app/commands/releasenotes.go b/app/commands/releasenotes.go index e920cf4..04e9fa3 100644 --- a/app/commands/releasenotes.go +++ b/app/commands/releasenotes.go @@ -45,7 +45,7 @@ func ReleaseNotesHandler(g app.GitSV) cli.ActionFunc { output, err := g.OutputFormatter.FormatReleaseNote(releasenote) if err != nil { - return fmt.Errorf("could not format release notes, message: %w", err) + return fmt.Errorf("could not format release notes: %w", err) } fmt.Println(output) diff --git a/cmd/git-sv/main.go b/cmd/git-sv/main.go index 2543a7f..0f4b101 100644 --- a/cmd/git-sv/main.go +++ b/cmd/git-sv/main.go @@ -32,10 +32,12 @@ func main() { &cli.StringFlag{ Name: "log-level", Usage: "log level", + Value: "info", }, }, Before: func(ctx *cli.Context) error { log.Logger = log.Output(zerolog.ConsoleWriter{Out: os.Stderr}) + lvl, err := zerolog.ParseLevel(ctx.String("log-level")) if err != nil { return err @@ -132,7 +134,7 @@ When flag range is "date", if "end" is YYYY-MM-DD the range will be inclusive.`, }, } - if apperr := app.Run(os.Args); apperr != nil { - log.Fatal().Err(apperr).Msg("Execution error") + if err := app.Run(os.Args); err != nil { + log.Fatal().Err(err).Msg("Execution error") } }