forked from openshift/rosa
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
edit service can update parameters that weren't originally defined.
- Loading branch information
1 parent
e0bb518
commit d7e73ea
Showing
3 changed files
with
94 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
// This file defines an object to check if Flags are valid. | ||
|
||
package arguments | ||
|
||
import "github.com/spf13/pflag" | ||
|
||
type FlagCheck struct { | ||
validFlags map[string]struct{} | ||
} | ||
|
||
func NewFlagCheck() *FlagCheck { | ||
return &FlagCheck{ | ||
validFlags: map[string]struct{}{}, | ||
} | ||
} | ||
|
||
func (f *FlagCheck) AddValidFlag(flag *pflag.Flag) *FlagCheck { | ||
f.validFlags[flag.Name] = struct{}{} | ||
return f | ||
} | ||
|
||
func (f *FlagCheck) AddValidParameter(parameterName string) *FlagCheck { | ||
f.validFlags[parameterName] = struct{}{} | ||
return f | ||
} | ||
|
||
func (f *FlagCheck) IsValidFlag(flag *pflag.Flag) bool { | ||
_, found := f.validFlags[flag.Name] | ||
return found | ||
} | ||
|
||
func (f *FlagCheck) IsValidParameter(parameterName string) bool { | ||
_, found := f.validFlags[parameterName] | ||
return found | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters