diff --git a/cmd/crowdsec-cli/utils.go b/cmd/crowdsec-cli/utils.go index a96f91253..eb52737ec 100644 --- a/cmd/crowdsec-cli/utils.go +++ b/cmd/crowdsec-cli/utils.go @@ -112,12 +112,8 @@ func compAllItems(itemType string, args []string, toComplete string) ([]string, comp := make([]string, 0) hubItems := cwhub.GetHubStatusForItemType(itemType, "", true) for _, item := range hubItems { - if toComplete == "" { + if !inSlice(item.Name, args) && strings.Contains(item.Name, toComplete) { comp = append(comp, item.Name) - } else { - if strings.Contains(item.Name, toComplete) { - comp = append(comp, item.Name) - } } } cobra.CompDebugln(fmt.Sprintf("%s: %+v", itemType, comp), true)