Merge duplicated attr/secret/kv flag handling into one function (#2720)

This commit is contained in:
Jeff Mitchell authored and GitHub committed 2022-12-15 13:01:57 -05:00
1 parent 1596b02e53
commit 5353725278
6 files changed
+154 -133

No files matched your search

+11 -1
View File
@@ -145,6 +145,7 @@ func TestPopulateAttrFlags(t *testing.T) {
flagSet := c.FlagSet(base.FlagSetNone)
f := flagSet.NewFlagSet("Attribute Options")
cmd := "create"
flagNames := map[string][]string{
cmd: {
"attributes",
@@ -155,7 +156,16 @@ func TestPopulateAttrFlags(t *testing.T) {
},
}
PopulateAttributeFlags(c, f, flagNames, cmd)
attrsInput := CombinedSliceFlagValuePopulationInput{
FlagSet: f,
FlagNames: flagNames[cmd],
FullPopulationFlag: &c.FlagAttributes,
FullPopulationInputName: "attributes",
PiecewisePopulationFlag: &c.FlagAttrs,
PiecewisePopulationInputBaseName: "attr",
}
PopulateCombinedSliceFlagValue(attrsInput)
err := flagSet.Parse(tt.args)
if tt.expectedErr != "" {
require.Error(err)