Example #1
0
// Inits and sets up the CLI options with defaults
// @params {nil}
// @return {Options} - returns the Options struct
func (o Options) Init() Options {
	// get our local config holding our defaults
	configuration := new(config.Config).Init()
	configData := configuration.GetAll()

	// setup our flags binding the pointer to variables
	of := flag.String("file", configData.DefaultFile, "Path and filename to process (e.g. files/list.csv)")
	oc := flag.Int("column", configData.UrlColumn, "Column where the URL is at")
	flag.Parse()

	// update and return struct
	o.file = *of
	o.column = *oc
	return o
}