diff --git a/pkg/config/print_env.go b/pkg/config/print_env.go index eef9333b..b4d6d3a0 100644 --- a/pkg/config/print_env.go +++ b/pkg/config/print_env.go @@ -1,5 +1,7 @@ package config +import "fmt" + // PrintEnvOptions is the options for the print-env command type PrintEnvOptions struct { // Output is the output format (yaml or json) @@ -31,3 +33,11 @@ func NewPrintEnvImpl(g *GlobalImpl, p *PrintEnvOptions) *PrintEnvImpl { func (c *PrintEnvImpl) Output() string { return c.PrintEnvOptions.Output } + +// ValidateConfig validates the print-env configuration +func (c *PrintEnvImpl) ValidateConfig() error { + if c.PrintEnvOptions.Output != "yaml" && c.PrintEnvOptions.Output != "json" { + return fmt.Errorf("invalid output format %q: must be 'yaml' or 'json'", c.PrintEnvOptions.Output) + } + return nil +}