Exemplo n.º 1
0
func ExampleSetup(t *testing.T) {
	// make a config var to hold some flags
	var Config struct {
		Value int           `default:"20" usage:"this is some value"`
		Time  time.Duration `default:"10s" usage:"some duration"`
		What  string        `default:"such a string" usage:"quite the string"`
	}

	// this creates flags with names
	//     prefix.value
	//     prefix.time
	//     prefix.what
	utils.Setup("prefix", &Config)

	// this loads the flags into config. flagfile automatically adds a flag
	// named flagfile, which when specified will load the key/value pairs in
	// that file as if they were specified on the command line.
	flagfile.Load()
}
Exemplo n.º 2
0
func init() {
	utils.Setup("log", &config)
}
Exemplo n.º 3
0
// Setup is a deprecated wrapper around flagfile/utils.Setup
// http://godoc.org/github.com/spacemonkeygo/flagfile/utils#Setup
func Setup(prefix string, x interface{}) {
	utils.Setup(prefix, x)
}