File tree 2 files changed +12
-0
lines changed
2 files changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -22,6 +22,10 @@ var addCmd = &cobra.Command{
22
22
// Verify filter exist
23
23
invalidFilters := []string {}
24
24
for _ , f := range filters {
25
+ if f == "" {
26
+ color .Red ("Filter cannot be empty. Please use correct syntax." )
27
+ os .Exit (1 )
28
+ }
25
29
foundFilter := false
26
30
for _ , filter := range analyzer .ListFilters () {
27
31
if filter == f {
Original file line number Diff line number Diff line change @@ -24,6 +24,14 @@ var removeCmd = &cobra.Command{
24
24
defaultFilters = []string {}
25
25
}
26
26
27
+ // Check if input filters is not empty
28
+ for _ , f := range filters {
29
+ if f == "" {
30
+ color .Red ("Filter cannot be empty. Please use correct syntax." )
31
+ os .Exit (1 )
32
+ }
33
+ }
34
+
27
35
// verify dupplicate filters example: k8sgpt filters remove Pod Pod
28
36
uniqueFilters , dupplicatedFilters := util .RemoveDuplicates (filters )
29
37
if len (dupplicatedFilters ) != 0 {
You can’t perform that action at this time.
0 commit comments