dorisbot/pkg/options/options.go

29 lines
495 B
Go
Raw Normal View History

2019-06-28 09:37:37 +00:00
package options
import "flag"
// Options -
type Options struct {
Help bool
Config string
}
var opts *Options
// GetOptions -
func GetOptions() *Options { return opts }
// RegOptions -
func RegOptions() {
opts = &Options{}
flag.StringVar(&opts.Config, "config", "", "config file path")
flag.StringVar(&opts.Config, "f", "", "config file path (short)")
flag.BoolVar(&opts.Help, "h", false, "show usage")
flag.Parse()
}
// ShowUsage -
func (p *Options) ShowUsage() {
flag.Usage()
}