Skip to content

Commit 3239b22

Browse files
committed
kops: Don't try to split --set flags on commas
Passing quotes in very difficult with the --set flag, because the pflag library tries to parse it using strict CSV semantics. We switch to using the StringArrayVar, which does not attempt splitting. This is a breaking change; compound flags must now be written as two flags, but I think that is clearer. Example: `--set=a,b` must now be `--set=a --set=b`
1 parent 7c17b16 commit 3239b22

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

cmd/kops/create_cluster.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -408,9 +408,9 @@ func NewCmdCreateCluster(f *util.Factory, out io.Writer) *cobra.Command {
408408
return []string{"json", "yaml"}, cobra.ShellCompDirectiveNoFileComp
409409
})
410410

411-
cmd.Flags().StringSliceVar(&options.Sets, "override", options.Sets, "Directly set values in the spec")
411+
cmd.Flags().StringArrayVar(&options.Sets, "override", options.Sets, "Directly set values in the spec")
412412
cmd.Flags().MarkDeprecated("override", "use --set instead")
413-
cmd.Flags().StringSliceVar(&options.Sets, "set", options.Sets, "Directly set values in the spec")
413+
cmd.Flags().StringArrayVar(&options.Sets, "set", options.Sets, "Directly set values in the spec")
414414
cmd.RegisterFlagCompletionFunc("set", func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
415415
return nil, cobra.ShellCompDirectiveNoFileComp
416416
})

cmd/kops/edit_cluster.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ func NewCmdEditCluster(f *util.Factory, out io.Writer) *cobra.Command {
8484
},
8585
}
8686

87-
cmd.Flags().StringSliceVar(&options.Sets, "set", options.Sets, "Directly set values in the spec")
87+
cmd.Flags().StringArrayVar(&options.Sets, "set", options.Sets, "Directly set values in the spec")
8888
cmd.RegisterFlagCompletionFunc("set", func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
8989
return nil, cobra.ShellCompDirectiveNoFileComp
9090
})

cmd/kops/edit_instancegroup.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ func NewCmdEditInstanceGroup(f *util.Factory, out io.Writer) *cobra.Command {
107107
},
108108
}
109109

110-
cmd.Flags().StringSliceVar(&options.Sets, "set", options.Sets, "Directly set values in the spec")
110+
cmd.Flags().StringArrayVar(&options.Sets, "set", options.Sets, "Directly set values in the spec")
111111
cmd.RegisterFlagCompletionFunc("set", func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
112112
return nil, cobra.ShellCompDirectiveNoFileComp
113113
})

0 commit comments

Comments
 (0)