Skip to content

Commit

Permalink
bugfix: invalid argument for "-D, --argument" flag: parse error, bare…
Browse files Browse the repository at this point in the history
… " in non-quoted-field (#111)
  • Loading branch information
howieyuen committed Aug 4, 2022
1 parent 2109bf4 commit 7611976
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 24 deletions.
9 changes: 1 addition & 8 deletions pkg/kusionctl/cmd/apply/apply.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,16 +50,9 @@ func NewCmdApply() *cobra.Command {
},
}

cmd.Flags().StringVarP(&o.CompileOptions.WorkDir, "workdir", "w", "",
i18n.T("Specify the work directory"))
o.AddCompileFlags(cmd)
cmd.Flags().StringVarP(&o.Operator, "operator", "", "",
i18n.T("Specify the operator"))
cmd.Flags().StringSliceVarP(&o.CompileOptions.Arguments, "argument", "D", []string{},
i18n.T("Specify the arguments to apply KCL"))
cmd.Flags().StringSliceVarP(&o.CompileOptions.Settings, "setting", "Y", []string{},
i18n.T("Specify the command line setting files"))
cmd.Flags().StringSliceVarP(&o.CompileOptions.Overrides, "overrides", "O", []string{},
i18n.T("Specify the configuration override path and value"))
cmd.Flags().BoolVarP(&o.Yes, "yes", "y", false,
i18n.T("Automatically approve and perform the update after previewing it"))
cmd.Flags().BoolVarP(&o.Detail, "detail", "d", false,
Expand Down
20 changes: 12 additions & 8 deletions pkg/kusionctl/cmd/compile/compile.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,20 +56,24 @@ func NewCmdCompile() *cobra.Command {
},
}

cmd.Flags().StringSliceVarP(&o.Arguments, "argument", "D", []string{},
i18n.T("Specify the top-level argument"))
cmd.Flags().StringSliceVarP(&o.Settings, "setting", "Y", []string{},
i18n.T("Specify the command line setting files"))
o.AddCompileFlags(cmd)
cmd.Flags().StringVarP(&o.Output, "output", "o", "",
i18n.T("Specify the output file"))
cmd.Flags().StringVarP(&o.WorkDir, "workdir", "w", "",
i18n.T("Specify the work directory"))
cmd.Flags().BoolVarP(&o.DisableNone, "disable-none", "n", false,
i18n.T("Disable dumping None values"))
cmd.Flags().BoolVarP(&o.OverrideAST, "override-AST", "a", false,
i18n.T("Specify the override option"))
cmd.Flags().StringSliceVarP(&o.Overrides, "overrides", "O", []string{},
i18n.T("Specify the configuration override path and value"))

return cmd
}

func (o *CompileOptions) AddCompileFlags(cmd *cobra.Command) {
cmd.Flags().StringVarP(&o.WorkDir, "workdir", "w", "",
i18n.T("Specify the work directory"))
cmd.Flags().StringSliceVarP(&o.Settings, "setting", "Y", []string{},
i18n.T("Specify the command line setting files"))
cmd.Flags().StringArrayVarP(&o.Arguments, "argument", "D", []string{},
i18n.T("Specify the top-level argument"))
cmd.Flags().StringSliceVarP(&o.Overrides, "overrides", "O", []string{},
i18n.T("Specify the configuration override path and value"))
}
9 changes: 1 addition & 8 deletions pkg/kusionctl/cmd/destroy/destroy.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,16 +43,9 @@ func NewCmdDestroy() *cobra.Command {
},
}

cmd.Flags().StringVarP(&o.CompileOptions.WorkDir, "workdir", "w", "",
i18n.T("Specify the work directory"))
o.AddCompileFlags(cmd)
cmd.Flags().StringVarP(&o.Operator, "operator", "", "",
i18n.T("Specify the operator"))
cmd.Flags().StringSliceVarP(&o.CompileOptions.Arguments, "argument", "D", []string{},
i18n.T("Specify the arguments for compile KCL"))
cmd.Flags().StringSliceVarP(&o.CompileOptions.Settings, "setting", "Y", []string{},
i18n.T("Specify the command line setting files"))
cmd.Flags().StringSliceVarP(&o.CompileOptions.Overrides, "overrides", "O", []string{},
i18n.T("Specify the configuration override path and value"))
cmd.Flags().BoolVarP(&o.Yes, "yes", "y", false,
i18n.T("Automatically approve and perform the update after previewing it"))
cmd.Flags().BoolVarP(&o.Detail, "detail", "d", false,
Expand Down

0 comments on commit 7611976

Please sign in to comment.