Skip to content

Commit

Permalink
fix nits and add comments
Browse files Browse the repository at this point in the history
  • Loading branch information
tejal29 committed May 22, 2019
1 parent 60c3058 commit 0722b77
Showing 1 changed file with 18 additions and 14 deletions.
32 changes: 18 additions & 14 deletions cmd/skaffold/app/cmd/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,14 @@ type Flag struct {
DefinedOn []string
}

// FlagResitry is a list of all Skaffold CLI flags.
// FlagRegistry is a list of all Skaffold CLI flags.
// When adding a new flag to the registry, please specify the
// command/commands to which the flag belongs in `DefinedOn` field.
// If the flag is a global flag, or belongs to all the subcommands,
/// specify "all"
// FlagAddMethod is method which defines a flag value with specified
// name, default value, and usage string. e.g. `StringVar`, `BoolVar`
var FlagResitry = []Flag{
var FlagRegistry = []Flag{
{
Name: "filename",
Shorthand: "f",
Expand Down Expand Up @@ -144,22 +144,16 @@ var FlagResitry = []Flag{
FlagAddMethod: "BoolVar",
DefinedOn: []string{"dev", "build", "run", "debug", "deploy"},
},
// We need opts.Tail and opts.TailDev since cobra, overwrites the default value
// when registering the flag twice.
{
Name: "tail",
Usage: "Stream logs from deployed objects",
Usage: "Stream logs from deployed objects. (default false)",
Value: &opts.Tail,
DefValue: false,
FlagAddMethod: "BoolVar",
DefinedOn: []string{"deploy"},
},
{
Name: "force",
Usage: "Recreate kubernetes resources if necessary for deployment, warning: might cause downtime!)",
Value: &opts.Force,
DefValue: false,
FlagAddMethod: "BoolVar",
DefinedOn: []string{"deploy"},
},
{
Name: "tail",
Usage: "Stream logs from deployed objects",
Expand All @@ -168,9 +162,19 @@ var FlagResitry = []Flag{
FlagAddMethod: "BoolVar",
DefinedOn: []string{"dev", "run", "debug"},
},
// We need opts.Force and opts.ForceDev since cobra, overwrites the default value
// when registering the flag twice.
{
Name: "force",
Usage: "Recreate kubernetes resources if necessary for deployment (default false, warning: might cause downtime!)",
Value: &opts.Force,
DefValue: false,
FlagAddMethod: "BoolVar",
DefinedOn: []string{"deploy"},
},
{
Name: "force",
Usage: "Recreate kubernetes resources if necessary for deployment, warning: might cause downtime!)",
Usage: "Recreate kubernetes resources if necessary for deployment (warning: might cause downtime!)",
Value: &opts.ForceDev,
DefValue: true,
FlagAddMethod: "BoolVar",
Expand Down Expand Up @@ -222,8 +226,8 @@ var commandFlags []*pflag.Flag

// SetUpFlags creates pflag.Flag for all registered flags
func SetUpFlags() {
commandFlags = make([]*pflag.Flag, len(FlagResitry))
for i, fl := range FlagResitry {
commandFlags = make([]*pflag.Flag, len(FlagRegistry))
for i, fl := range FlagRegistry {
fs := pflag.NewFlagSet(fl.Name, pflag.ContinueOnError)
inputs := []reflect.Value{
reflect.ValueOf(fl.Value),
Expand Down

0 comments on commit 0722b77

Please sign in to comment.