tcp-proxy/pkg/option/option.go

22 lines
399 B
Go
Raw Normal View History

2020-01-14 09:58:05 +00:00
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 }