diff --git a/cli/pkg/kctrl/cmd/core/print_table.go b/cli/pkg/kctrl/cmd/core/print_table.go index a1165d721..43ca14c6e 100644 --- a/cli/pkg/kctrl/cmd/core/print_table.go +++ b/cli/pkg/kctrl/cmd/core/print_table.go @@ -16,7 +16,7 @@ func validateColumns(headers *[]uitable.Header, cols *[]string) error { for _, col := range *cols { found := false for _, head := range *headers { - if col == head.Key || col == head.Title { + if uitable.KeyifyHeader(col) == head.Key || col == head.Title { found = true break } diff --git a/cli/test/e2e/package_available_test.go b/cli/test/e2e/package_available_test.go index fe9cbc319..27551e9b0 100644 --- a/cli/test/e2e/package_available_test.go +++ b/cli/test/e2e/package_available_test.go @@ -140,6 +140,16 @@ spec: require.Exactly(t, expectedOutputRows, output.Tables[0].Rows) }) + logger.Section("listing packages with column names in mixed cases", func() { + out := kappCtrl.Run([]string{"package", "available", "list", "--json", "--column=nAMe,NameSpace"}) + output := uitest.JSONUIFromBytes(t, []byte(out)) + expectedOutputRows := []map[string]string{{ + "name": packageName, + "namespace": env.Namespace, + }} + require.Exactly(t, expectedOutputRows, output.Tables[0].Rows) + }) + logger.Section("listing packages with non existing column names", func() { _, err := kappCtrl.RunWithOpts([]string{"package", "available", "list", "--json", "--column=name,invalid,namespace,ns"}, RunOpts{ AllowError: true,