Skip to content

Commit

Permalink
code review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
tejal29 committed Apr 29, 2019
1 parent e704e4e commit dfb956f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
8 changes: 8 additions & 0 deletions cmd/skaffold/app/cmd/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,14 @@ func getAnnotatedFlags(name string, annotations map[string]string) *flag.FlagSet
return allFlags
}

// This is hack to get around an existing issue.
// Flag "--tail" is used for setting "opts.TailDev" and "opts.Tail".
// In Deploy flow, "--tail" is set to opts.Tail with default set to false.
// However, in Run and Dev flow, "--tail" is set to opts.TailDev with default set to true.
// Dev and Run, both run deploy, and hence default to --tail is set to false based on order
// of the keys in *cobra.Command.Annotations (determined at runtime)
// Dev and Run commands should first call addTailDevFlag() and register "--tail" flag with default set to true.
// This will ignore the "--tail" flag added in `AddFlags` function
func addTailDevFlag(cmd *cobra.Command) {
cmd.Flags().BoolVar(&opts.TailDev, "tail", true, "Stream logs from deployed objects")
}
2 changes: 1 addition & 1 deletion cmd/skaffold/app/cmd/flags_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ func TestAddFlags(t *testing.T) {
expectedFlags: nil,
},
{
description: "union of anotations",
description: "union of annotations",
annotations: map[string]string{"cleanup": "true", "test": "true"},
expectedFlags: []string{"skip-tests", "cleanup", "no-prune"},
},
Expand Down

0 comments on commit dfb956f

Please sign in to comment.