func main() { foo := FooConfig{ Bravo: 42, Delta: 2 * time.Minute, } opts.Parse(&foo) }
func main() { config := struct { File string `help:"file to load"` Lines int `help:"number of lines to show"` }{} opts.Parse(&config) fmt.Println(config) }
func main() { c := Config{} opts.Parse(&c) fmt.Printf("%3.0f %s %d\n", c.Foo.Seconds(), c.Bar, c.Bazz) }
func main() { c := Config{} opts.Parse(&c) fmt.Println(c.Foo) fmt.Println(c.Bar) }
func main() { c := Config{} opts.Parse(&c) fmt.Println(c.Cmd) fmt.Println(c.Bar.Zip) fmt.Println(c.Bar.Zap) }
func main() { c := struct { URL string `type:"arg" help:"<url> of where to GET the binary"` Port int `help:"listening port"` Log bool `help:"enable logging"` }{ Port: 3000, Log: true, } opts.Parse(&c) overseer.Run(overseer.Config{ Log: c.Log, Program: func(state overseer.State) { //noop select {} }, Address: ":" + strconv.Itoa(c.Port), Fetcher: &fetcher.HTTP{ URL: c.URL, Interval: 1 * time.Second, }, }) }