fblook/module/options/options.go

27 lines
492 B
Go
Raw Normal View History

2018-09-21 14:58:41 +00:00
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
}