to specify different branch in first parameter

This commit is contained in:
David Vennik
2022-12-21 14:26:27 +00:00
parent 0f66b6beb3
commit 814ce3e17b
2 changed files with 6 additions and 5 deletions

View File

@@ -212,7 +212,8 @@ func Version() string {
"\tMinor:", Minor, "\n",
"\tPatch:", Patch, "\n",
)
branch := os.Args[1]
br := strings.Split(GitRef, "/")
branch := br[len(br)-1]
if major || minor {
branch = os.Args[2]
}

View File

@@ -13,11 +13,11 @@ var (
// GitRef is the gitref, as in refs/heads/branchname.
GitRef = "refs/heads/main"
// ParentGitCommit is the commit hash of the parent HEAD.
ParentGitCommit = "1b1e983892e6cb03034442fd286259984046e108"
ParentGitCommit = "2abadd782265b1103b5cc259ea3eba60d03a5f0c"
// BuildTime stores the time when the current binary was built.
BuildTime = "2022-12-21T14:22:57Z"
BuildTime = "2022-12-21T14:26:27Z"
// SemVer lists the (latest) git tag on the build.
SemVer = "v0.0.203"
SemVer = "v0.0.204"
// PathBase is the path base returned from runtime caller.
PathBase = "/home/loki/src/github.com/Indra-Labs/indra/"
// Major is the major number from the tag.
@@ -25,7 +25,7 @@ var (
// Minor is the minor number from the tag.
Minor = 0
// Patch is the patch version number from the tag.
Patch = 203
Patch = 204
)
// Version returns a pretty printed version information string.