mtgbot/modules/options/options.go

26 lines
496 B
Go
Raw Normal View History

2018-12-24 06:34:13 +00:00
package options
import "flag"
// Options -
type Options struct {
Config string
DBTool bool
}
var opts *Options
// RegFlag -
func RegFlag() {
opts = &Options{}
flag.StringVar(&opts.Config, "config", "", "config file path (default {PWD}/config.yml)")
flag.StringVar(&opts.Config, "f", "", "config file path (short) (default {PWD}/config.yml")
flag.BoolVar(&opts.DBTool, "dbtool", false, "run deploy database script")
flag.Parse()
}
// GetOpts -
func GetOpts() *Options {
return opts
}