working commit
This commit is contained in:
@@ -109,20 +109,23 @@ func (conf *Config) ReadOptions() error {
|
||||
|
||||
// TODO: make local scope of flags
|
||||
|
||||
//flag.Int64Var(&conf.Service.Port, "port", conf.Service.Port, "listen port")
|
||||
//flag.BoolVar(&conf.AsDaemon, "daemon", conf.AsDaemon, "run as daemon")
|
||||
flagSet := flag.NewFlagSet(exename, flag.ExitOnError)
|
||||
flagSet.Int64Var(&conf.Service.Port, "port", conf.Service.Port, "listen port")
|
||||
flagSet.BoolVar(&conf.AsDaemon, "daemon", conf.AsDaemon, "run as daemon")
|
||||
|
||||
help := func() {
|
||||
fmt.Println("")
|
||||
fmt.Printf("Usage: %s [option]\n", exename)
|
||||
fmt.Println("")
|
||||
fmt.Println("Options:")
|
||||
flag.PrintDefaults()
|
||||
flagSet.PrintDefaults()
|
||||
fmt.Println("")
|
||||
}
|
||||
flag.Usage = help
|
||||
flag.Parse()
|
||||
|
||||
flagSet.Usage = help
|
||||
args := flag.Args()
|
||||
if len(args) > 1 {
|
||||
flagSet.Parse(args)
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user