Add version flag (specially für sava)
This commit is contained in:
parent
86cbbcb8bd
commit
b3edc45526
|
@ -15,6 +15,8 @@ import (
|
||||||
goxmpp "gosrc.io/xmpp"
|
goxmpp "gosrc.io/xmpp"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
const version string = "1.2.1-dev"
|
||||||
|
|
||||||
var sm *goxmpp.StreamManager
|
var sm *goxmpp.StreamManager
|
||||||
var component *goxmpp.Component
|
var component *goxmpp.Component
|
||||||
var err error
|
var err error
|
||||||
|
@ -28,8 +30,14 @@ func main() {
|
||||||
var configPath = flag.String("config", "config.yml", "Config file path")
|
var configPath = flag.String("config", "config.yml", "Config file path")
|
||||||
// JSON schema (not for editing by a user)
|
// JSON schema (not for editing by a user)
|
||||||
var schemaPath = flag.String("schema", "./config_schema.json", "Schema file path")
|
var schemaPath = flag.String("schema", "./config_schema.json", "Schema file path")
|
||||||
|
var versionFlag = flag.Bool("version", false, "Print the version and exit")
|
||||||
flag.Parse()
|
flag.Parse()
|
||||||
|
|
||||||
|
if *versionFlag {
|
||||||
|
fmt.Printf("%v\n", version)
|
||||||
|
os.Exit(0)
|
||||||
|
}
|
||||||
|
|
||||||
if *profilingPort > 0 {
|
if *profilingPort > 0 {
|
||||||
go func() {
|
go func() {
|
||||||
log.Println(http.ListenAndServe(fmt.Sprintf("localhost:%v", *profilingPort), nil))
|
log.Println(http.ListenAndServe(fmt.Sprintf("localhost:%v", *profilingPort), nil))
|
||||||
|
|
Loading…
Reference in a new issue