mirror of
https://github.com/thegeeklab/git-sv.git
synced 2024-11-14 17:50:40 +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/Masterminds/semver/v3"
|
||||||
"github.com/thegeeklab/git-sv/v2/sv"
|
"github.com/thegeeklab/git-sv/v2/sv"
|
||||||
"github.com/thegeeklab/git-sv/v2/sv/formatter"
|
"github.com/thegeeklab/git-sv/v2/sv/formatter"
|
||||||
|
"github.com/thegeeklab/git-sv/v2/templates"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
@ -61,7 +62,6 @@ type GitSV struct {
|
|||||||
MessageProcessor sv.MessageProcessor
|
MessageProcessor sv.MessageProcessor
|
||||||
CommitProcessor sv.CommitProcessor
|
CommitProcessor sv.CommitProcessor
|
||||||
ReleasenotesProcessor sv.ReleaseNoteProcessor
|
ReleasenotesProcessor sv.ReleaseNoteProcessor
|
||||||
|
|
||||||
OutputFormatter formatter.OutputFormatter
|
OutputFormatter formatter.OutputFormatter
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -72,6 +72,9 @@ func New() GitSV {
|
|||||||
}
|
}
|
||||||
|
|
||||||
g.MessageProcessor = sv.NewMessageProcessor(g.Config.CommitMessage, g.Config.Branches)
|
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
|
return g
|
||||||
}
|
}
|
||||||
|
@ -45,7 +45,7 @@ func ReleaseNotesHandler(g app.GitSV) cli.ActionFunc {
|
|||||||
|
|
||||||
output, err := g.OutputFormatter.FormatReleaseNote(releasenote)
|
output, err := g.OutputFormatter.FormatReleaseNote(releasenote)
|
||||||
if err != nil {
|
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)
|
fmt.Println(output)
|
||||||
|
@ -32,10 +32,12 @@ func main() {
|
|||||||
&cli.StringFlag{
|
&cli.StringFlag{
|
||||||
Name: "log-level",
|
Name: "log-level",
|
||||||
Usage: "log level",
|
Usage: "log level",
|
||||||
|
Value: "info",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
Before: func(ctx *cli.Context) error {
|
Before: func(ctx *cli.Context) error {
|
||||||
log.Logger = log.Output(zerolog.ConsoleWriter{Out: os.Stderr})
|
log.Logger = log.Output(zerolog.ConsoleWriter{Out: os.Stderr})
|
||||||
|
|
||||||
lvl, err := zerolog.ParseLevel(ctx.String("log-level"))
|
lvl, err := zerolog.ParseLevel(ctx.String("log-level"))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
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 {
|
if err := app.Run(os.Args); err != nil {
|
||||||
log.Fatal().Err(apperr).Msg("Execution error")
|
log.Fatal().Err(err).Msg("Execution error")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user