fix:kustomize cfg grep with no arguments causes panic (#5707)

* fix:kustomize cfg grep with no arguments causes panic

* add test for kustomize cfg grep with no arguments
This commit is contained in:
Dennis Zhou
2024-07-10 15:46:40 +08:00
committed by GitHub
parent 735ad0beef
commit 7cbaf78b1a
2 changed files with 17 additions and 0 deletions

View File

@@ -54,6 +54,9 @@ type GrepRunner struct {
}
func (r *GrepRunner) preRunE(c *cobra.Command, args []string) error {
if len(args) == 0 {
return fmt.Errorf("missing required argument: QUERY")
}
r.GrepFilter.Compare = func(a, b string) (int, error) {
qa, err := resource.ParseQuantity(a)
if err != nil {