22 lines
399 B
Go
22 lines
399 B
Go
package option
|
|
|
|
import "flag"
|
|
|
|
// Option -
|
|
type Option struct {
|
|
Config string
|
|
}
|
|
|
|
var opts *Option
|
|
|
|
// Parse flags
|
|
func Parse() {
|
|
opts = &Option{}
|
|
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.Parse()
|
|
}
|
|
|
|
// Get parsed options
|
|
func Get() *Option { return opts }
|