Skip to content

Commit 5dc5ed1

Browse files
committed
kepctl: add support to query all SIGs
Signed-off-by: Nabarun Pal <[email protected]>
1 parent 0f59248 commit 5dc5ed1

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

cmd/kepctl/query.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ func buildQueryCommand(k *kepctl.Client) *cobra.Command {
4040
}
4141

4242
f := cmd.Flags()
43-
f.StringSliceVar(&opts.SIG, "sig", nil, "SIG")
43+
f.StringSliceVar(&opts.SIG, "sig", nil, "SIG. If not specified, KEPs from all SIGs are shown.")
4444
f.StringSliceVar(&opts.Status, "status", nil, "Status")
4545
f.StringSliceVar(&opts.Stage, "stage", nil, "Stage")
4646
f.StringSliceVar(&opts.PRRApprover, "prr", nil, "Prod Readiness Approver")

pkg/kepctl/query.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,17 +55,21 @@ type QueryOpts struct {
5555
Output string
5656
}
5757

58-
58+
// Validate checks the query options and cleans them up if needed
5959
func (c *QueryOpts) Validate() error {
60+
groups := util.Groups()
6061
if len(c.SIG) > 0 {
61-
sigs, err := selectByRegexp(util.Groups(), c.SIG)
62+
sigs, err := selectByRegexp(groups, c.SIG)
6263
if err != nil {
6364
return err
6465
}
6566
if len(sigs) == 0 {
6667
return fmt.Errorf("No SIG matches any of the passed regular expressions")
6768
}
6869
c.SIG = sigs
70+
} else {
71+
// if no SIGs are passed, list KEPs from all SIGs
72+
c.SIG = groups
6973
}
7074

7175
// check if the Output specified is one of "", "json" or "yaml"

0 commit comments

Comments
 (0)