Skip to content

Commit

Permalink
Merge pull request #12 from zetamatta/fork
Browse files Browse the repository at this point in the history
goversioninfo.exe: add options: product-ver-major/minor/patch/build
  • Loading branch information
josephspurrier committed Aug 1, 2017
2 parents 53f6213 + d197df0 commit 6239356
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions cmd/goversioninfo/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,11 @@ func main() {
flagVerPatch := flag.Int("ver-patch", -1, "FileVersion.Patch")
flagVerBuild := flag.Int("ver-build", -1, "FileVersion.Build")

flagProductVerMajor := flag.Int("product-ver-major", -1, "ProductVersion.Major")
flagProductVerMinor := flag.Int("product-ver-minor", -1, "ProductVersion.Minor")
flagProductVerPatch := flag.Int("product-ver-patch", -1, "ProductVersion.Patch")
flagProductVerBuild := flag.Int("product-ver-build", -1, "ProductVersion.Build")

flag.Usage = func() {
fmt.Fprintf(os.Stderr, "Usage: %s [flags] <versioninfo.json>\n\nPossible flags:\n", os.Args[0])
flag.PrintDefaults()
Expand Down Expand Up @@ -146,6 +151,19 @@ func main() {
vi.FixedFileInfo.FileVersion.Build = *flagVerBuild
}

if *flagProductVerMajor >= 0 {
vi.FixedFileInfo.ProductVersion.Major = *flagProductVerMajor
}
if *flagProductVerMinor >= 0 {
vi.FixedFileInfo.ProductVersion.Minor = *flagProductVerMinor
}
if *flagProductVerPatch >= 0 {
vi.FixedFileInfo.ProductVersion.Patch = *flagProductVerPatch
}
if *flagProductVerBuild >= 0 {
vi.FixedFileInfo.ProductVersion.Build = *flagProductVerBuild
}

// Fill the structures with config data
vi.Build()

Expand Down

0 comments on commit 6239356

Please sign in to comment.