Skip to content

Commit

Permalink
removed validator object
Browse files Browse the repository at this point in the history
  • Loading branch information
renan-campos committed Jul 5, 2022
1 parent 2f9ac70 commit a4d977c
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 56 deletions.
5 changes: 4 additions & 1 deletion cmd/edit/service/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,10 @@ func run(cmd *cobra.Command, argv []string) {
}

addonParameters := addOn.Parameters()
arguments.AddParameterFlags(cmd, addonParameters)
addonParameters.Each(func(param *cmv1.AddOnParameter) bool {
arguments.AddStringFlag(cmd, param.ID())
return true
})

err = arguments.ParseKnownFlags(cmd, argv, true)
if err != nil {
Expand Down
11 changes: 3 additions & 8 deletions pkg/arguments/arguments.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ import (
"github.com/spf13/cobra"
"github.com/spf13/pflag"

cmv1 "github.com/openshift-online/ocm-sdk-go/clustersmgmt/v1"
"github.com/openshift/rosa/pkg/aws/profile"
"github.com/openshift/rosa/pkg/aws/region"
"github.com/openshift/rosa/pkg/debug"
Expand Down Expand Up @@ -185,14 +184,10 @@ func ParseKnownFlags(cmd *cobra.Command, argv []string, failOnUnknown bool) erro
return nil
}

// Adds the flags that are addon parameters to the command flagset.
func AddParameterFlags(cmd *cobra.Command, params *cmv1.AddOnParameterList) {
func AddStringFlag(cmd *cobra.Command, flagName string) {
flags := cmd.Flags()
params.Each(func(param *cmv1.AddOnParameter) bool {
var pStrVal *string = new(string)
flags.StringVar(pStrVal, param.ID(), "", param.Description())
return true
})
var pStrVal *string = new(string)
flags.StringVar(pStrVal, flagName, "", "")
}

// HasUnknownFlags returns whether the flag parser detected any unknown flags
Expand Down
47 changes: 0 additions & 47 deletions pkg/arguments/validator.go

This file was deleted.

0 comments on commit a4d977c

Please sign in to comment.