Option to show version (fixes #24)

This commit is contained in:
Jakob Borg 2014-01-08 14:37:33 +01:00
parent 1ef86379fb
commit 17e78d6f7e

View File

@ -3,6 +3,7 @@ package main
import (
"compress/gzip"
"crypto/tls"
"fmt"
"log"
"net"
"net/http"
@ -30,6 +31,7 @@ type Options struct {
NoStats bool `long:"no-stats" description:"Don't print model and connection statistics"`
NoGUI bool `long:"no-gui" description:"Don't start GUI"`
GUIAddr string `long:"gui-addr" description:"GUI listen address" default:"127.0.0.1:8080" value-name:"ADDR"`
ShowVersion bool `short:"v" long:"version" description:"Show version"`
Discovery DiscoveryOptions `group:"Discovery Options"`
Advanced AdvancedOptions `group:"Advanced Options"`
Debug DebugOptions `group:"Debugging Options"`
@ -71,8 +73,14 @@ var (
func main() {
_, err := flags.Parse(&opts)
if err != nil {
fatalln(err)
}
if opts.ShowVersion {
fmt.Println(Version)
os.Exit(0)
}
if len(opts.Debug.TraceModel) > 0 || opts.Debug.LogSource {
logger = log.New(os.Stderr, "", log.Lshortfile|log.Ldate|log.Ltime|log.Lmicroseconds)
}