diff --git a/cmd/config/internal/commands/cmdlistsetters.go b/cmd/config/internal/commands/cmdlistsetters.go index 63075574e..3b54ab582 100644 --- a/cmd/config/internal/commands/cmdlistsetters.go +++ b/cmd/config/internal/commands/cmdlistsetters.go @@ -108,7 +108,7 @@ func (r *ListSettersRunner) ListSetters(w io.Writer, openAPIPath, resourcePath s return err } table := newTable(w, r.Markdown) - table.SetHeader([]string{"NAME", "VALUE", "SET BY", "DESCRIPTION", "COUNT", "REQUIRED"}) + table.SetHeader([]string{"NAME", "VALUE", "SET BY", "DESCRIPTION", "COUNT", "REQUIRED", "IS SET"}) for i := range r.List.Setters { s := r.List.Setters[i] v := s.Value @@ -118,14 +118,17 @@ func (r *ListSettersRunner) ListSetters(w io.Writer, openAPIPath, resourcePath s v = strings.Join(s.ListValues, ",") v = fmt.Sprintf("[%s]", v) } - var required string + required := "No" if s.Required { required = "Yes" - } else { - required = "No" } + isSet := "No" + if s.IsSet { + isSet = "Yes" + } + table.Append([]string{ - s.Name, v, s.SetBy, s.Description, fmt.Sprintf("%d", s.Count), required}) + s.Name, v, s.SetBy, s.Description, fmt.Sprintf("%d", s.Count), required, isSet}) } table.Render() diff --git a/cmd/config/internal/commands/cmdlistsetters_test.go b/cmd/config/internal/commands/cmdlistsetters_test.go index 28a3a08d7..17c4e43e2 100644 --- a/cmd/config/internal/commands/cmdlistsetters_test.go +++ b/cmd/config/internal/commands/cmdlistsetters_test.go @@ -46,8 +46,8 @@ metadata: spec: replicas: 3 # {"$ref": "#/definitions/io.k8s.cli.setters.replicas"} `, - expected: ` NAME VALUE SET BY DESCRIPTION COUNT REQUIRED - replicas 3 me hello world 1 Yes + expected: ` NAME VALUE SET BY DESCRIPTION COUNT REQUIRED IS SET + replicas 3 me hello world 1 Yes No `, }, @@ -72,8 +72,8 @@ metadata: spec: replicas: 3 # {"$ref": "#/definitions/io.k8s.cli.setters.replicas"} `, - expected: ` NAME VALUE SET BY DESCRIPTION COUNT REQUIRED - replicas 4 me hello world 1 No + expected: ` NAME VALUE SET BY DESCRIPTION COUNT REQUIRED IS SET + replicas 4 me hello world 1 No No `, }, { @@ -131,10 +131,10 @@ spec: - name: nginx2 image: nginx # {"$ref": "#/definitions/io.k8s.cli.setters.image"} `, - expected: ` NAME VALUE SET BY DESCRIPTION COUNT REQUIRED - image nginx me2 hello world 2 2 No - replicas 3 me1 hello world 1 1 No - tag 1.7.9 me3 hello world 3 1 Yes + expected: ` NAME VALUE SET BY DESCRIPTION COUNT REQUIRED IS SET + image nginx me2 hello world 2 2 No No + replicas 3 me1 hello world 1 1 No No + tag 1.7.9 me3 hello world 3 1 Yes No --------------- ----------- -------------- SUBSTITUTION PATTERN REFERENCES image IMAGE:TAG [image,tag] @@ -207,10 +207,10 @@ spec: - name: nginx2 image: nginx `, - expected: ` NAME VALUE SET BY DESCRIPTION COUNT REQUIRED - image nginx me2 hello world 2 3 No - replicas 3 me1 hello world 1 2 No - tag 1.7.9 me3 hello world 3 2 No + expected: ` NAME VALUE SET BY DESCRIPTION COUNT REQUIRED IS SET + image nginx me2 hello world 2 3 No No + replicas 3 me1 hello world 1 2 No No + tag 1.7.9 me3 hello world 3 2 No No --------------- ----------- -------------- SUBSTITUTION PATTERN REFERENCES image IMAGE:TAG [image,tag] @@ -284,8 +284,8 @@ spec: - name: nginx2 image: nginx `, - expected: ` NAME VALUE SET BY DESCRIPTION COUNT REQUIRED - image nginx me2 hello world 2 3 Yes + expected: ` NAME VALUE SET BY DESCRIPTION COUNT REQUIRED IS SET + image nginx me2 hello world 2 3 Yes No `, }, @@ -324,8 +324,8 @@ spec: - "b" - "c" `, - expected: ` NAME VALUE SET BY DESCRIPTION COUNT REQUIRED - list [a,b,c] me hello world 1 Yes + expected: ` NAME VALUE SET BY DESCRIPTION COUNT REQUIRED IS SET + list [a,b,c] me hello world 1 Yes No `, }, @@ -390,10 +390,10 @@ openAPI: name: my-other-setter value: nginxotherthing `, - expected: ` NAME VALUE SET BY DESCRIPTION COUNT REQUIRED - my-image-setter nginx 2 No - my-other-setter nginxotherthing 1 No - my-tag-setter 1.7.9 2 Yes + expected: ` NAME VALUE SET BY DESCRIPTION COUNT REQUIRED IS SET + my-image-setter nginx 2 No No + my-other-setter nginxotherthing 1 No No + my-tag-setter 1.7.9 2 Yes Yes ------------------ ------------------------------------------------ ----------------------------------- SUBSTITUTION PATTERN REFERENCES my-image-subst ${my-image-setter}::${my-tag-setter} [my-image-setter,my-tag-setter] @@ -476,20 +476,20 @@ func TestListSettersSubPackages(t *testing.T) { expected: ` test/testdata/dataset-with-setters/mysql/ - NAME VALUE SET BY DESCRIPTION COUNT REQUIRED - image mysql 1 No - namespace myspace 1 No - tag 1.7.9 1 No + NAME VALUE SET BY DESCRIPTION COUNT REQUIRED IS SET + image mysql 1 No No + namespace myspace 1 No No + tag 1.7.9 1 No No --------------- ----------------- -------------- SUBSTITUTION PATTERN REFERENCES image-tag ${image}:${tag} [image,tag] test/testdata/dataset-with-setters/mysql/nosetters/ - NAME VALUE SET BY DESCRIPTION COUNT REQUIRED + NAME VALUE SET BY DESCRIPTION COUNT REQUIRED IS SET test/testdata/dataset-with-setters/mysql/storage/ - NAME VALUE SET BY DESCRIPTION COUNT REQUIRED - namespace myspace 1 No + NAME VALUE SET BY DESCRIPTION COUNT REQUIRED IS SET + namespace myspace 1 No No `, }, { @@ -499,10 +499,10 @@ test/testdata/dataset-with-setters/mysql/storage/ expected: ` test/testdata/dataset-with-setters/mysql/ - NAME VALUE SET BY DESCRIPTION COUNT REQUIRED - image mysql 1 No - namespace myspace 1 No - tag 1.7.9 1 No + NAME VALUE SET BY DESCRIPTION COUNT REQUIRED IS SET + image mysql 1 No No + namespace myspace 1 No No + tag 1.7.9 1 No No `, }, } diff --git a/cmd/config/internal/commands/e2e/list_setters_test.go b/cmd/config/internal/commands/e2e/list_setters_test.go index 0d73132a3..93f886227 100644 --- a/cmd/config/internal/commands/e2e/list_setters_test.go +++ b/cmd/config/internal/commands/e2e/list_setters_test.go @@ -35,8 +35,8 @@ openAPI: }, expectedStdOut: ` ./ - NAME VALUE SET BY DESCRIPTION COUNT REQUIRED - replicas 3 1 No + NAME VALUE SET BY DESCRIPTION COUNT REQUIRED IS SET + replicas 3 1 No No `, }, }