// Parse parses flag definitions from the argument list.
Parse parses flag definitions from the argument list.
// Parse parses flag definitions from the argument list .
func (c *Config) Parse(arguments []string) error {
	err := c.FlagSet.Parse(arguments)
	if err != nil {
		return errors.Trace(err)
	}
	if c.ConfigFile != "" {
		err = c.configFromFile(c.ConfigFile)
		if err != nil {
			return errors.Trace(err)
		}
	}
	err = c.FlagSet.Parse(arguments)
	if err != nil {
		return errors.Trace(err)
	}
	if len(c.FlagSet.Args()) != 0 {
		return errors.Errorf("'%s' is an invalid flag", c.FlagSet.Arg(0))
	}
	return nil
}
func ( c * Config ) Parse ( arguments [ ] string ) error { err := c . FlagSet . Parse ( arguments ) if err != nil { return errors . Trace ( err ) } if c . ConfigFile != " " { err = c . configFromFile ( c . ConfigFile ) if err != nil { return errors . Trace ( err ) } } err = c . FlagSet . Parse ( arguments ) if err != nil { return errors . Trace ( err ) } if len ( c . FlagSet . Args ( ) ) != 0 { return errors . Errorf ( " " , c . FlagSet . Arg ( 0 ) ) } return nil }
Parse parses flag definitions from the argument list.
Parse parses flag definitions from the argument list .
// Parse first to get config file. // Load config file if specified. // Parse again to replace with command line options.