Skip to content

Commit bee883e

Browse files
committed
kepctl query: support --stage none
I wanted to find KEPs for my sig that didn't yet have a stage so I could clean them up, which is why I now know that way cobra implements StringSliceVar is slightly non-intuitive: - `--stage ""` becomes `[]string{}` - `--stage "",""` becomes `[]string{"",""}` It seemed nicer to support `--stage none` as a sentinel value
1 parent 015c031 commit bee883e

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

pkg/repo/query.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,13 @@ func (r *Repo) PrepareQueryOpts(opts *QueryOpts) error {
7272
// if no SIGs are passed, list KEPs from all SIGs
7373
opts.Groups = groups
7474
}
75+
76+
for i, v := range opts.Stage {
77+
if v == "none" {
78+
opts.Stage[i] = ""
79+
}
80+
}
81+
7582
return nil
7683
}
7784

pkg/repo/query_test.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,15 @@ func TestQuery(t *testing.T) {
162162
"1-the-bare-minimum",
163163
},
164164
},
165+
{
166+
name: "none",
167+
queryOpts: repo.QueryOpts{
168+
Stage: []string{"none"},
169+
},
170+
kepNames: []string{
171+
"1-the-bare-minimum",
172+
},
173+
},
165174
{
166175
name: "alpha",
167176
queryOpts: repo.QueryOpts{

0 commit comments

Comments
 (0)