24 lines
481 B
Go
24 lines
481 B
Go
|
package option
|
||
|
|
||
|
import "flag"
|
||
|
|
||
|
// Options -
|
||
|
type Options struct {
|
||
|
Help bool
|
||
|
Config string
|
||
|
}
|
||
|
|
||
|
var opts *Options
|
||
|
|
||
|
// RegOptions -
|
||
|
func RegOptions() {
|
||
|
opts = &Options{}
|
||
|
flag.StringVar(&opts.Config, "config", "", "config file path - default: `pwd/config.yml`")
|
||
|
flag.StringVar(&opts.Config, "f", "", "config file path - default: `pwd/config.yml`")
|
||
|
flag.BoolVar(&opts.Help, "help", false, "show help")
|
||
|
flag.Parse()
|
||
|
}
|
||
|
|
||
|
// GetOptions -
|
||
|
func GetOptions() *Options { return opts }
|