AddFlags registers flags for a cli
(cmd *cobra.Command)
| 224 | |
| 225 | // AddFlags registers flags for a cli |
| 226 | func (flags *ApplyFlags) AddFlags(cmd *cobra.Command) { |
| 227 | // bind flag structs |
| 228 | flags.DeleteFlags.AddFlags(cmd) |
| 229 | flags.RecordFlags.AddFlags(cmd) |
| 230 | flags.PrintFlags.AddFlags(cmd) |
| 231 | |
| 232 | cmdutil.AddValidateFlags(cmd) |
| 233 | cmdutil.AddDryRunFlag(cmd) |
| 234 | cmdutil.AddServerSideApplyFlags(cmd) |
| 235 | cmdutil.AddFieldManagerFlagVar(cmd, &flags.FieldManager, FieldManagerClientSideApply) |
| 236 | cmdutil.AddLabelSelectorFlagVar(cmd, &flags.Selector) |
| 237 | cmdutil.AddPruningFlags(cmd, &flags.Prune, &flags.PruneAllowlist, &flags.All, &flags.ApplySetRef) |
| 238 | cmd.Flags().BoolVar(&flags.Overwrite, "overwrite", flags.Overwrite, "Automatically resolve conflicts between the modified and live configuration by using values from the modified configuration") |
| 239 | cmd.Flags().BoolVar(&flags.OpenAPIPatch, "openapi-patch", flags.OpenAPIPatch, "If true, use openapi to calculate diff when the openapi presents and the resource can be found in the openapi spec. Otherwise, fall back to use baked-in types.") |
| 240 | cmdutil.AddSubresourceFlags(cmd, &flags.Subresource, "If specified, apply will operate on the subresource of the requested object. Only allowed when using --server-side.") |
| 241 | } |
| 242 | |
| 243 | // ToOptions converts from CLI inputs to runtime inputs |
| 244 | func (flags *ApplyFlags) ToOptions(f cmdutil.Factory, cmd *cobra.Command, baseName string, args []string) (*ApplyOptions, error) { |