From b2b06e7a1e0547db5ca0c7e71062092dafa5afbb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=ABl=20Stemmer?= Date: Fri, 4 Oct 2019 00:07:33 +0100 Subject: [PATCH] Add -version flag to print current version --- go-junit-report.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/go-junit-report.go b/go-junit-report.go index 1332f3b6..5206eb3e 100644 --- a/go-junit-report.go +++ b/go-junit-report.go @@ -9,16 +9,28 @@ import ( "github.com/jstemmer/go-junit-report/parser" ) +var ( + Version = "v0.9.1-dev" + Revision = "HEAD" + BuildTime string +) + var ( noXMLHeader = flag.Bool("no-xml-header", false, "do not print xml header") packageName = flag.String("package-name", "", "specify a package name (compiled test have no package name in output)") goVersionFlag = flag.String("go-version", "", "specify the value to use for the go.version property in the generated XML") setExitCode = flag.Bool("set-exit-code", false, "set exit code to 1 if tests failed") + version = flag.Bool("version", false, "print version") ) func main() { flag.Parse() + if *version { + fmt.Printf("go-junit-report %s %s (%s)\n", Version, BuildTime, Revision) + return + } + if flag.NArg() != 0 { fmt.Fprintf(os.Stderr, "%s does not accept positional arguments\n", os.Args[0]) flag.Usage()