Skip to content

Commit

Permalink
style: Format output_format.go
Browse files Browse the repository at this point in the history
  • Loading branch information
harry97uk committed Nov 18, 2024
1 parent d1d5534 commit 3b91803
Showing 1 changed file with 30 additions and 30 deletions.
60 changes: 30 additions & 30 deletions pkg/config/output_format.go
Original file line number Diff line number Diff line change
@@ -1,30 +1,30 @@
package config

import "fmt"

const (
JSON = "json"
TEXT = "text"
CSV = "csv"
)

// implements pflag.Value to enforce strict string matching for the output format during flag parsing
type OutputFormat string

func (o *OutputFormat) String() string {
return string(*o)
}

func (o *OutputFormat) Set(value string) error {
switch value {
case JSON, TEXT, CSV:
*o = OutputFormat(value)
return nil
default:
return fmt.Errorf("invalid output format: %s (must be one of: json, text, csv)", value)
}
}

func (o *OutputFormat) Type() string {
return "OutputFormat"
}
package config

import "fmt"

const (
JSON = "json"
TEXT = "text"
CSV = "csv"
)

// implements pflag.Value to enforce strict string matching for the output format during flag parsing
type OutputFormat string

func (o *OutputFormat) String() string {
return string(*o)
}

func (o *OutputFormat) Set(value string) error {
switch value {
case JSON, TEXT, CSV:
*o = OutputFormat(value)
return nil
default:
return fmt.Errorf("invalid output format: %s (must be one of: json, text, csv)", value)
}
}

func (o *OutputFormat) Type() string {
return "OutputFormat"
}

0 comments on commit 3b91803

Please sign in to comment.