Add -version option

This commit is contained in:
Evan Phoenix 2015-04-07 09:24:34 -07:00
parent 6302dc553c
commit a0eada9c49
1 changed files with 9 additions and 0 deletions

View File

@ -2,6 +2,7 @@ package main
import ( import (
"flag" "flag"
"fmt"
"log" "log"
"os" "os"
"os/signal" "os/signal"
@ -14,10 +15,18 @@ import (
var fDebug = flag.Bool("debug", false, "show metrics as they're generated to stdout") 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 fTest = flag.Bool("test", false, "gather metrics, print them out, and exit")
var fConfig = flag.String("config", "", "configuration file to load") var fConfig = flag.String("config", "", "configuration file to load")
var fVersion = flag.Bool("version", false, "display the version")
var Version = "unreleased"
func main() { func main() {
flag.Parse() flag.Parse()
if *fVersion {
fmt.Printf("InfluxDB Tivan agent - Version %s\n", Version)
return
}
var ( var (
config *tivan.Config config *tivan.Config
err error err error