Skip to content

Commit 7611976

Browse files
authored
bugfix: invalid argument for "-D, --argument" flag: parse error, bare " in non-quoted-field (#111)
1 parent 2109bf4 commit 7611976

File tree

3 files changed

+14
-24
lines changed

3 files changed

+14
-24
lines changed

pkg/kusionctl/cmd/apply/apply.go

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -50,16 +50,9 @@ func NewCmdApply() *cobra.Command {
5050
},
5151
}
5252

53-
cmd.Flags().StringVarP(&o.CompileOptions.WorkDir, "workdir", "w", "",
54-
i18n.T("Specify the work directory"))
53+
o.AddCompileFlags(cmd)
5554
cmd.Flags().StringVarP(&o.Operator, "operator", "", "",
5655
i18n.T("Specify the operator"))
57-
cmd.Flags().StringSliceVarP(&o.CompileOptions.Arguments, "argument", "D", []string{},
58-
i18n.T("Specify the arguments to apply KCL"))
59-
cmd.Flags().StringSliceVarP(&o.CompileOptions.Settings, "setting", "Y", []string{},
60-
i18n.T("Specify the command line setting files"))
61-
cmd.Flags().StringSliceVarP(&o.CompileOptions.Overrides, "overrides", "O", []string{},
62-
i18n.T("Specify the configuration override path and value"))
6356
cmd.Flags().BoolVarP(&o.Yes, "yes", "y", false,
6457
i18n.T("Automatically approve and perform the update after previewing it"))
6558
cmd.Flags().BoolVarP(&o.Detail, "detail", "d", false,

pkg/kusionctl/cmd/compile/compile.go

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -56,20 +56,24 @@ func NewCmdCompile() *cobra.Command {
5656
},
5757
}
5858

59-
cmd.Flags().StringSliceVarP(&o.Arguments, "argument", "D", []string{},
60-
i18n.T("Specify the top-level argument"))
61-
cmd.Flags().StringSliceVarP(&o.Settings, "setting", "Y", []string{},
62-
i18n.T("Specify the command line setting files"))
59+
o.AddCompileFlags(cmd)
6360
cmd.Flags().StringVarP(&o.Output, "output", "o", "",
6461
i18n.T("Specify the output file"))
65-
cmd.Flags().StringVarP(&o.WorkDir, "workdir", "w", "",
66-
i18n.T("Specify the work directory"))
6762
cmd.Flags().BoolVarP(&o.DisableNone, "disable-none", "n", false,
6863
i18n.T("Disable dumping None values"))
6964
cmd.Flags().BoolVarP(&o.OverrideAST, "override-AST", "a", false,
7065
i18n.T("Specify the override option"))
71-
cmd.Flags().StringSliceVarP(&o.Overrides, "overrides", "O", []string{},
72-
i18n.T("Specify the configuration override path and value"))
7366

7467
return cmd
7568
}
69+
70+
func (o *CompileOptions) AddCompileFlags(cmd *cobra.Command) {
71+
cmd.Flags().StringVarP(&o.WorkDir, "workdir", "w", "",
72+
i18n.T("Specify the work directory"))
73+
cmd.Flags().StringSliceVarP(&o.Settings, "setting", "Y", []string{},
74+
i18n.T("Specify the command line setting files"))
75+
cmd.Flags().StringArrayVarP(&o.Arguments, "argument", "D", []string{},
76+
i18n.T("Specify the top-level argument"))
77+
cmd.Flags().StringSliceVarP(&o.Overrides, "overrides", "O", []string{},
78+
i18n.T("Specify the configuration override path and value"))
79+
}

pkg/kusionctl/cmd/destroy/destroy.go

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -43,16 +43,9 @@ func NewCmdDestroy() *cobra.Command {
4343
},
4444
}
4545

46-
cmd.Flags().StringVarP(&o.CompileOptions.WorkDir, "workdir", "w", "",
47-
i18n.T("Specify the work directory"))
46+
o.AddCompileFlags(cmd)
4847
cmd.Flags().StringVarP(&o.Operator, "operator", "", "",
4948
i18n.T("Specify the operator"))
50-
cmd.Flags().StringSliceVarP(&o.CompileOptions.Arguments, "argument", "D", []string{},
51-
i18n.T("Specify the arguments for compile KCL"))
52-
cmd.Flags().StringSliceVarP(&o.CompileOptions.Settings, "setting", "Y", []string{},
53-
i18n.T("Specify the command line setting files"))
54-
cmd.Flags().StringSliceVarP(&o.CompileOptions.Overrides, "overrides", "O", []string{},
55-
i18n.T("Specify the configuration override path and value"))
5649
cmd.Flags().BoolVarP(&o.Yes, "yes", "y", false,
5750
i18n.T("Automatically approve and perform the update after previewing it"))
5851
cmd.Flags().BoolVarP(&o.Detail, "detail", "d", false,

0 commit comments

Comments
 (0)