Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var RootCommand = &cobra.Command{ Use: "get-next-version", Short: "Get the next version according for semantic versioning", Long: "Get the next version according for semantic versioning.", Run: func(_ *cobra.Command, _ []string) { validTargets := []string{ "github-action", "json", "version", } if isValid, prefixValidationError := util.IsValidVersionPrefix(rootPrefixFlag); !isValid { log.Fatal().Msgf("invalid version prefix %+q", prefixValidationError) } if !slices.Contains(validTargets, rootTargetFlag) { log.Fatal().Msg("invalid target") } repository, err := gogit.PlainOpen(rootRepositoryFlag) if err != nil { log.Fatal().Msg(err.Error()) } var nextVersion semver.Version var hasNextVersion bool result, err := git.GetConventionalCommitTypesSinceLastRelease(repository) if err != nil { log.Fatal().Msg(err.Error()) } else { nextVersion, hasNextVersion = versioning.CalculateNextVersion(result.LatestReleaseVersion, result.ConventionalCommitTypes) } err = target.WriteOutput(nextVersion, hasNextVersion, rootTargetFlag, rootPrefixFlag) if err != nil { log.Fatal().Err(err).Msg("could not write output") } }, }
View Source
var VersionCommand = &cobra.Command{ Use: "version", Short: "Prints the get-next-version version", Long: "Prints the get-next-version version.", Run: func(command *cobra.Command, args []string) { fmt.Println("get-next-version " + version.Version) fmt.Println("Revision " + version.GitVersion) }, }
Functions ¶
This section is empty.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.