wire printflags through additional cmds
This commit is contained in:
@@ -79,6 +79,20 @@ func (f *PrintFlags) AddFlags(cmd *cobra.Command) {
|
||||
}
|
||||
}
|
||||
|
||||
// WithDefaultOutput sets a default output format if one is not provided through a flag value
|
||||
func (f *PrintFlags) WithDefaultOutput(output string) *PrintFlags {
|
||||
existingFormat := ""
|
||||
if f.OutputFormat != nil {
|
||||
existingFormat = *f.OutputFormat
|
||||
}
|
||||
if len(existingFormat) == 0 {
|
||||
existingFormat = output
|
||||
}
|
||||
f.OutputFormat = &existingFormat
|
||||
|
||||
return f
|
||||
}
|
||||
|
||||
func NewPrintFlags(operation string) *PrintFlags {
|
||||
outputFormat := ""
|
||||
|
||||
|
||||
Reference in New Issue
Block a user