diff --git a/app/commands/changelog.go b/app/commands/changelog.go index 4233e15..ff798bf 100644 --- a/app/commands/changelog.go +++ b/app/commands/changelog.go @@ -31,7 +31,7 @@ func ChangelogFlags(settings *app.ChangelogSettings) []cli.Flag { }, &cli.BoolFlag{ Name: "strict", - Usage: "only show tags 'SemVer-ish'", + Usage: "only include semver comliant tags", Destination: &settings.Strict, }, &cli.StringFlag{ diff --git a/app/commands/nextversion.go b/app/commands/nextversion.go index cb7d4e4..fb7e8ec 100644 --- a/app/commands/nextversion.go +++ b/app/commands/nextversion.go @@ -3,6 +3,7 @@ package commands import ( "fmt" + "github.com/rs/zerolog/log" "github.com/thegeeklab/git-sv/app" "github.com/thegeeklab/git-sv/sv" "github.com/urfave/cli/v2" @@ -22,7 +23,12 @@ func NextVersionHandler(g app.GitSV) cli.ActionFunc { return fmt.Errorf("error getting git log: %w", err) } - nextVer, _ := g.CommitProcessor.NextVersion(currentVer, commits) + nextVer, updated := g.CommitProcessor.NextVersion(currentVer, commits) + if !updated { + log.Info().Msgf("nothing to do: current version %s unchanged", currentVer) + + return nil + } fmt.Printf("%d.%d.%d\n", nextVer.Major(), nextVer.Minor(), nextVer.Patch()) diff --git a/app/commands/tag.go b/app/commands/tag.go index 75b0339..25980a9 100644 --- a/app/commands/tag.go +++ b/app/commands/tag.go @@ -3,6 +3,7 @@ package commands import ( "fmt" + "github.com/rs/zerolog/log" "github.com/thegeeklab/git-sv/app" "github.com/thegeeklab/git-sv/sv" "github.com/urfave/cli/v2" @@ -22,15 +23,20 @@ func TagHandler(g app.GitSV) cli.ActionFunc { return fmt.Errorf("error getting git log: %w", err) } - nextVer, _ := g.CommitProcessor.NextVersion(currentVer, commits) + nextVer, updated := g.CommitProcessor.NextVersion(currentVer, commits) + if !updated { + log.Info().Msgf("nothing to do: current version %s unchanged", currentVer) + + return nil + } + tagname, err := g.Tag(*nextVer) - - fmt.Println(tagname) - if err != nil { return fmt.Errorf("error generating tag version: %s: %w", nextVer.String(), err) } + fmt.Println(tagname) + return nil } }