Added version tracking support
This commit is contained in:
parent
a750e7e344
commit
1356c84627
17
main.go
17
main.go
|
@ -15,6 +15,13 @@ import (
|
||||||
"strings"
|
"strings"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// VERSION holds the Current version of spruce
|
||||||
|
var VERSION = "0.1.0" // SED MARKER FOR AUTO VERSION BUMPING
|
||||||
|
// BUILD holds CURRENT BUILD OF SPRUCE
|
||||||
|
var BUILD = "master" // updated by build.sh
|
||||||
|
// DIRTY holds Whether any uncommitted changes were found in the working copy
|
||||||
|
var DIRTY = "" // updated by build.sh
|
||||||
|
|
||||||
var debug bool
|
var debug bool
|
||||||
var trace bool
|
var trace bool
|
||||||
|
|
||||||
|
@ -89,6 +96,7 @@ func main() {
|
||||||
Host string `goptions:"-H, --elasticsearch_url, description='ElasticSearch URL. Defaults to http://localhost:9200'"`
|
Host string `goptions:"-H, --elasticsearch_url, description='ElasticSearch URL. Defaults to http://localhost:9200'"`
|
||||||
SkipSSLVerify bool `goptions:"-k, --skip-ssl-validation, description='Disable SSL certificate checking'"`
|
SkipSSLVerify bool `goptions:"-k, --skip-ssl-validation, description='Disable SSL certificate checking'"`
|
||||||
Help bool `goptions:"-h, --help"`
|
Help bool `goptions:"-h, --help"`
|
||||||
|
Version bool `goptions:"-v, --version"`
|
||||||
}
|
}
|
||||||
|
|
||||||
goptions.ParseAndFail(&options)
|
goptions.ParseAndFail(&options)
|
||||||
|
@ -113,6 +121,15 @@ func main() {
|
||||||
debug = true
|
debug = true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if options.Version {
|
||||||
|
plus := ""
|
||||||
|
if BUILD != "release" {
|
||||||
|
plus = "+"
|
||||||
|
}
|
||||||
|
fmt.Fprintf(os.Stderr, "%s - Version %s%s (%s%s)\n", os.Args[0], VERSION, plus, BUILD, DIRTY)
|
||||||
|
os.Exit(0)
|
||||||
|
}
|
||||||
|
|
||||||
if options.SkipSSLVerify {
|
if options.SkipSSLVerify {
|
||||||
SkipSSLValidation = true
|
SkipSSLValidation = true
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue