26 lines
496 B
Go
26 lines
496 B
Go
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
|
|
}
|