-
-
Notifications
You must be signed in to change notification settings - Fork 279
/
flags.go
53 lines (44 loc) · 1.12 KB
/
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
50
51
52
53
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
Save *bool
CheckOverAllocs *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),
Save: boolPtr(false),
ClearScreen: boolPtr(false),
CheckOverAllocs: 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
}