func LoadFlags(moduleOptions interface{}, globalOptions *GlobalOptions) error {
	argPointers := make(map[string]*argInfo)

	if err := registerTypes(moduleOptions, argPointers); err != nil {
		return err
	}
	if err := registerTypes(globalOptions, argPointers); err != nil {
		return err
	}
	flag.Parse()

	checkForSet(argPointers)

	// special config key needed for loading config file
	// this loads everything from the config file
	if ap, found := argPointers["config"]; found && ap.set {
		configFile := ap.argPtr.(*string)

		configBytes, err := ioutil.ReadFile(*configFile)
		if err != nil {
			return err
		}

		err = yaml.Unmarshal(configBytes, globalOptions)
		if err != nil {
			return err
		}

		err = yaml.Unmarshal(configBytes, moduleOptions)
		if err != nil {
			return err
		}
	}

	fillOptionsWithMap(moduleOptions, argPointers)
	fillOptionsWithMap(globalOptions, argPointers)

	return nil
}
// LoadFlags loads 2 sets of options: global options defined by the GlobalOptions struct
// and local options provided by the passed moduleOptions parameter.
LoadFlags loads 2 sets of options: global options defined by the GlobalOptions struct
and local options provided by the passed moduleOptions parameter.
// LoadFlags loads 2 sets of options : global options defined by the GlobalOptions struct // and local options provided by the passed moduleOptions parameter .
func LoadFlags(moduleOptions interface{}, globalOptions *GlobalOptions) error {
	argPointers := make(map[string]*argInfo)
	if err := registerTypes(moduleOptions, argPointers); err != nil {
		return err
	}
	if err := registerTypes(globalOptions, argPointers); err != nil {
		return err
	}
	flag.Parse()
	checkForSet(argPointers)
	if ap, found := argPointers["config"]; found && ap.set {
		configFile := ap.argPtr.(*string)
		configBytes, err := ioutil.ReadFile(*configFile)
		if err != nil {
			return err
		}
		err = yaml.Unmarshal(configBytes, globalOptions)
		if err != nil {
			return err
		}
		err = yaml.Unmarshal(configBytes, moduleOptions)
		if err != nil {
			return err
		}
	}
	fillOptionsWithMap(moduleOptions, argPointers)
	fillOptionsWithMap(globalOptions, argPointers)
	return nil
}
func LoadFlags ( moduleOptions interface { } , globalOptions * GlobalOptions ) error { argPointers := make ( map [ string ] * argInfo ) if err := registerTypes ( moduleOptions , argPointers ) ; err != nil { return err } if err := registerTypes ( globalOptions , argPointers ) ; err != nil { return err } flag . Parse ( ) checkForSet ( argPointers ) if ap , found := argPointers [ " " ] ; found && ap . set { configFile := ap . argPtr . ( * string ) configBytes , err := ioutil . ReadFile ( * configFile ) if err != nil { return err } err = yaml . Unmarshal ( configBytes , globalOptions ) if err != nil { return err } err = yaml . Unmarshal ( configBytes , moduleOptions ) if err != nil { return err } } fillOptionsWithMap ( moduleOptions , argPointers ) fillOptionsWithMap ( globalOptions , argPointers ) return nil }
LoadFlags loads 2 sets of options: global options defined by the GlobalOptions struct
and local options provided by the passed moduleOptions parameter.
LoadFlags loads 2 sets of options : global options defined by the GlobalOptions struct and local options provided by the passed moduleOptions parameter .
// special config key needed for loading config file // this loads everything from the config file