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

	c := Config{}

	opts.Parse(&c)

	fmt.Printf("%3.0f %s %d\n", c.Foo.Seconds(), c.Bar, c.Bazz)
}
示例#4
0
func main() {

	c := Config{}

	opts.Parse(&c)

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

	c := Config{}

	opts.Parse(&c)

	fmt.Println(c.Cmd)
	fmt.Println(c.Bar.Zip)
	fmt.Println(c.Bar.Zap)
}
示例#6
0
文件: main.go 项目: efueger/overseer
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,
		},
	})
}