Skip to content

Commit b2b06e7

Browse files
committed
Add -version flag to print current version
1 parent 984a47c commit b2b06e7

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

go-junit-report.go

+12
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,28 @@ import (
99
"github.com/jstemmer/go-junit-report/parser"
1010
)
1111

12+
var (
13+
Version = "v0.9.1-dev"
14+
Revision = "HEAD"
15+
BuildTime string
16+
)
17+
1218
var (
1319
noXMLHeader = flag.Bool("no-xml-header", false, "do not print xml header")
1420
packageName = flag.String("package-name", "", "specify a package name (compiled test have no package name in output)")
1521
goVersionFlag = flag.String("go-version", "", "specify the value to use for the go.version property in the generated XML")
1622
setExitCode = flag.Bool("set-exit-code", false, "set exit code to 1 if tests failed")
23+
version = flag.Bool("version", false, "print version")
1724
)
1825

1926
func main() {
2027
flag.Parse()
2128

29+
if *version {
30+
fmt.Printf("go-junit-report %s %s (%s)\n", Version, BuildTime, Revision)
31+
return
32+
}
33+
2234
if flag.NArg() != 0 {
2335
fmt.Fprintf(os.Stderr, "%s does not accept positional arguments\n", os.Args[0])
2436
flag.Usage()

0 commit comments

Comments
 (0)