func NewOptions(defaults *Options, filename string, ctx *cli.Context) (Options, error) {
	res := DefaultOptions
	if defaults != nil {
		res = *defaults
	}

	if len(filename) > 0 {
		fmt.Printf("reading configuration from '%s'\n", filename)
		file, err := ReadOptionsFromFile(filename)
		if err != nil {
			return res, err
		}
		err = res.MergeFrom(file)
		if err != nil {
			return res, err
		}
	}

	if ctx != nil {
		fmt.Printf("applying CLI options to configuration\n")
		applyCLIOptions(ctx, &res)
	}

	return res, res.Verify()
}
//NewOptions compiles the Options object from the provided sources.
//Will use a custom defaults, or if nil the DefaultOptions object is used.
//Then will search the fileName json file (if provided) for options.
//Then will combine the CLI options provided from main().
//These options cascade in order where applicable for the option.
//Will run the Options.Verify() method and return the error after compilation
NewOptions compiles the Options object from the provided sources.
Will use a custom defaults, or if nil the DefaultOptions object is used.
Then will search the fileName json file (if provided) for options.
Then will combine the CLI options provided from main().
These options cascade in order where applicable for the option.
Will run the Options.Verify() method and return the error after compilation
// NewOptions compiles the Options object from the provided sources . // Will use a custom defaults or if nil the DefaultOptions object is used . // Then will search the fileName json file ( if provided ) for options . // Then will combine the CLI options provided from main () . // These options cascade in order where applicable for the option . // Will run the Options . Verify () method and return the error after compilation
func NewOptions(defaults *Options, filename string, ctx *cli.Context) (Options, error) {
	res := DefaultOptions
	if defaults != nil {
		res = *defaults
	}
	if len(filename) > 0 {
		fmt.Printf("reading configuration from '%s'\n", filename)
		file, err := ReadOptionsFromFile(filename)
		if err != nil {
			return res, err
		}
		err = res.MergeFrom(file)
		if err != nil {
			return res, err
		}
	}
	if ctx != nil {
		fmt.Printf("applying CLI options to configuration\n")
		applyCLIOptions(ctx, &res)
	}
	return res, res.Verify()
}
func NewOptions ( defaults * Options , filename string , ctx * cli . Context ) ( Options , error ) { res := DefaultOptions if defaults != nil { res = * defaults } if len ( filename ) > 0 { fmt . Printf ( " \n " , filename ) file , err := ReadOptionsFromFile ( filename ) if err != nil { return res , err } err = res . MergeFrom ( file ) if err != nil { return res , err } } if ctx != nil { fmt . Printf ( " \n " ) applyCLIOptions ( ctx , & res ) } return res , res . Verify ( ) }
NewOptions compiles the Options object from the provided sources.
NewOptions compiles the Options object from the provided sources .