Skip to content

Commit

Permalink
Consolidate report/list formatting flags
Browse files Browse the repository at this point in the history
Signed-off-by: Matt Rutkowski <[email protected]>
  • Loading branch information
mrutkows committed May 6, 2024
1 parent 03b51e6 commit f2509b8
Showing 1 changed file with 16 additions and 9 deletions.
25 changes: 16 additions & 9 deletions utils/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,25 +70,29 @@ func (persistentFlags PersistentCommandFlags) GetOutputIndentInt() int {
return int(persistentFlags.OutputIndent)
}

type LicenseCommandFlags struct {
// Common flags for all "list" (report) commands (e.g., license list, vulnerability list, etc.)
type ReportCommandFlags struct {
Summary bool
ListLineWrap bool
ListLineWrap bool // NOTE: SHOULD ONLY be used for "text" output; currently only used by "license policy" command.
}

type LicenseCommandFlags struct {
ReportCommandFlags
}

type ValidateCommandFlags struct {
SchemaVariant string
ForcedJsonSchemaFile string
// Uses custom validation flags if "true"; defaults to config. "custom.json"
CustomValidation bool
// error result processing
CustomValidation bool // Uses custom validation flags if "true"; defaults to config. "custom.json"
// validation error result (output) processing
MaxNumErrors int
MaxErrorDescriptionLength int
ColorizeErrorOutput bool
ShowErrorValue bool
}

type VulnerabilityCommandFlags struct {
Summary bool
ReportCommandFlags
}

type DiffCommandFlags struct {
Expand All @@ -97,12 +101,13 @@ type DiffCommandFlags struct {
}

type ResourceCommandFlags struct {
ResourceType string
ReportCommandFlags // NOTE: currently unused; as # columns grows, please implement
ResourceType string
}

type ComponentCommandFlags struct {
Summary bool
Types []string
ReportCommandFlags
Types []string
}

func NewResourceCommandFlags(resourceType string) ResourceCommandFlags {
Expand All @@ -112,8 +117,10 @@ func NewResourceCommandFlags(resourceType string) ResourceCommandFlags {
}

type SchemaCommandFlags struct {
ReportCommandFlags // NOTE: currently unused; as # columns grows, please implement
}

// TODO: unused/unimplemented
type StatsCommandFlags struct {
}

Expand Down

0 comments on commit f2509b8

Please sign in to comment.