From c31338854b6c5993e2728c3584511a7dc2805916 Mon Sep 17 00:00:00 2001 From: Kevin van Zonneveld Date: Tue, 6 Sep 2016 08:58:59 +0200 Subject: [PATCH] Add version outputting --- main.go | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/main.go b/main.go index 192b27c..b5ea26e 100644 --- a/main.go +++ b/main.go @@ -1,6 +1,7 @@ package main import ( + "flag" "fmt" "io/ioutil" "os" @@ -9,7 +10,17 @@ import ( "github.com/Acconut/hcl/json/parser" ) +// VERSION is what is returned by the `-v` flag +var VERSION = "v0.0.4" + func main() { + version := flag.Bool("version", false, "Prints current app version") + flag.Parse() + if *version { + fmt.Println(VERSION) + os.Exit(0) + } + if err := convert(); err != nil { fmt.Fprintln(os.Stderr, err) os.Exit(1)