mirror of
https://github.com/thegeeklab/git-sv.git
synced 2024-11-24 11:10:39 +00:00
fix: add missing processors and fix logging
This commit is contained in:
parent
ac9b7496c5
commit
eb7bea48e2
@ -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
|
||||
}
|
||||
|
@ -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)
|
||||
|
@ -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")
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user