From 9825a6f880d8e7ec924c141a01991a75979ae86d Mon Sep 17 00:00:00 2001 From: charles-chenzz Date: Wed, 13 Dec 2023 17:28:30 +0600 Subject: [PATCH] remove option init --- kustomize/commands/edit/add/addreplacement.go | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/kustomize/commands/edit/add/addreplacement.go b/kustomize/commands/edit/add/addreplacement.go index 170fea25cdb..17fd91526bc 100644 --- a/kustomize/commands/edit/add/addreplacement.go +++ b/kustomize/commands/edit/add/addreplacement.go @@ -20,14 +20,11 @@ type addReplacementOptions struct { func newCmdAddReplacement(fSys filesys.FileSystem) *cobra.Command { var o addReplacementOptions - o.Replacement.Source = &types.SourceSelector{} - o.Replacement.Targets = append(o.Replacement.Targets, &types.TargetSelector{}) cmd := &cobra.Command{ Use: "replacement", Short: "add an item to replacement field", Long: `this command will add an item to replacement field in the kustomization file. -the item will be: - - be either a file, or an inline string +The item must be either a file, or an inline string. `, Example: ` # Adds a replacement file to the kustomization file @@ -66,13 +63,6 @@ func (o *addReplacementOptions) RunAddReplacement(fSys filesys.FileSystem) error return fmt.Errorf("failed to read kustomization file: %w", err) } - if o.Replacement.Targets != nil { - o.Replacement.Targets = nil - } - if o.Replacement.Source != nil { - o.Replacement.Source = nil - } - for _, r := range m.Replacements { if len(r.Path) > 0 && r.Path == o.Replacement.Path { return fmt.Errorf("replacement for path %q already in %s file", r.Path, konfig.DefaultKustomizationFileName())