fblook/module/options/options.go
2018-09-21 22:58:41 +08:00

27 lines
492 B
Go

package options
import (
"flag"
)
// Options - flag options
type Options struct {
Help bool
Config string
}
var opts *Options
// RegFlag - register flag
func RegFlag() {
opts = &Options{}
flag.StringVar(&opts.Config, "config", "", "config file path (defualt {PWD}/config.yml")
flag.StringVar(&opts.Config, "f", "", "config file path (short) (defualt {PWD}/config.yml")
flag.BoolVar(&opts.Help, "help", false, "show help")
}
// GetFlag -
func GetFlag() *Options {
return opts
}