Exemple #1
0
func main() {
	foo := FooConfig{
		Bravo: 42,
		Delta: 2 * time.Minute,
	}
	opts.Parse(&foo)
}
Exemple #2
0
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)
}
Exemple #4
0
func main() {

	c := Config{}

	opts.Parse(&c)

	fmt.Println(c.Foo)
	fmt.Println(c.Bar)
}
Exemple #5
0
func main() {

	c := Config{}

	opts.Parse(&c)

	fmt.Println(c.Cmd)
	fmt.Println(c.Bar.Zip)
	fmt.Println(c.Bar.Zap)
}
Exemple #6
0
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,
		},
	})
}