forked from joeholley/supergloo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcommon.go
25 lines (20 loc) · 929 Bytes
/
common.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
package flagutils
import (
"github.com/solo-io/solo-kit/pkg/api/v1/resources/core"
"github.com/solo-io/supergloo/cli/pkg/options"
"github.com/spf13/pflag"
)
func AddOutputFlag(set *pflag.FlagSet, strptr *string) {
set.StringVarP(strptr, "output", "o", "", "output format: (yaml, json, table)")
}
func AddInteractiveFlag(set *pflag.FlagSet, boolptr *bool) {
set.BoolVarP(boolptr, "interactive", "i", false, "run in interactive mode")
}
func AddMetadataFlags(set *pflag.FlagSet, in *core.Metadata) {
set.StringVar(&in.Name, "name", "", "name for the resource")
set.StringVar(&in.Namespace, "namespace", "supergloo-system", "namespace for the resource")
}
func AddKubeYamlFlag(set *pflag.FlagSet, opts *options.Options) {
set.BoolVar(&opts.PrintKubeYaml, "dryrun", false, "if true, this command will print "+
"the yaml used to create a kubernetes resource rather than directly trying to create/apply the resource")
}