-
Notifications
You must be signed in to change notification settings - Fork 160
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
30 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" | ||
} |