-
-
Notifications
You must be signed in to change notification settings - Fork 278
/
flags.go
49 lines (40 loc) · 1009 Bytes
/
flags.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
package config
import (
"k8s.io/cli-runtime/pkg/genericclioptions"
)
// Flags represents Popeye CLI flags.
type Flags struct {
*genericclioptions.ConfigFlags
LintLevel *string
Output *string
ClearScreen *bool
AllNamespaces *bool
Spinach *string
Sections *[]string
}
// NewFlags returns new configuration flags.
func NewFlags() *Flags {
return &Flags{
LintLevel: strPtr(defaultLintLevel),
Output: strPtr("standard"),
AllNamespaces: boolPtr(false),
ClearScreen: boolPtr(false),
Spinach: strPtr(""),
Sections: &[]string{},
ConfigFlags: genericclioptions.NewConfigFlags(false)}
}
// OutputFormat returns the report output format.
func (f *Flags) OutputFormat() string {
if f.Output != nil && *f.Output != "" {
return *f.Output
}
return "cool"
}
// ----------------------------------------------------------------------------
// Helpers...
func boolPtr(b bool) *bool {
return &b
}
func strPtr(s string) *string {
return &s
}