in pkg/ecctl/config.go [78:107]
func (c *Config) Validate() error {
var err = multierror.NewPrefixed("invalid configuration options specified")
if !slice.HasString([]string{JSONOutput, TextOutput}, c.Output) {
err = err.Append(errInvalidOutputFormat)
}
var allCreds = c.APIKey != "" && (c.User != "" || c.Pass != "")
if allCreds {
err = err.Append(errInvalidBothAuthenticaitonSettings)
}
var emptyCreds = c.APIKey == "" && (c.User == "" || c.Pass == "")
if emptyCreds {
err = err.Append(errInvalidEmptyAuthenticaitonSettings)
}
if c.Output == JSONOutput && c.Format != "" {
err = err.Append(errCannotSpecifyJSONOutputAndCustomFormat)
}
if c.OutputDevice == nil {
err = err.Append(errInvalidOutputDevice)
}
if c.ErrorDevice == nil {
err = err.Append(errInvalidErrorDevice)
}
return err.ErrorOrNil()
}