From a0eada9c49c701dcdc67631eaa9133f1203b3510 Mon Sep 17 00:00:00 2001 From: Evan Phoenix Date: Tue, 7 Apr 2015 09:24:34 -0700 Subject: [PATCH] Add -version option --- cmd/tivan/tivan.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/cmd/tivan/tivan.go b/cmd/tivan/tivan.go index d1ef8d94e..6cb5e4733 100644 --- a/cmd/tivan/tivan.go +++ b/cmd/tivan/tivan.go @@ -2,6 +2,7 @@ package main import ( "flag" + "fmt" "log" "os" "os/signal" @@ -14,10 +15,18 @@ import ( var fDebug = flag.Bool("debug", false, "show metrics as they're generated to stdout") var fTest = flag.Bool("test", false, "gather metrics, print them out, and exit") var fConfig = flag.String("config", "", "configuration file to load") +var fVersion = flag.Bool("version", false, "display the version") + +var Version = "unreleased" func main() { flag.Parse() + if *fVersion { + fmt.Printf("InfluxDB Tivan agent - Version %s\n", Version) + return + } + var ( config *tivan.Config err error