Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion cli/completer.go
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,13 @@ func findAutocompleteAPI(arg *config.APIArg, apiFound *config.API, apiMap map[st
// Heuristic: user is trying to autocomplete for id/ids arg for a list API
relatedNoun = apiFound.Noun
if apiFound.Verb != "list" {
relatedNoun += "s"
config.Debug("relatedNoun before suffix check: ", relatedNoun)
if strings.HasSuffix(relatedNoun, "y") && len(relatedNoun) > 1 && !strings.ContainsAny(string(relatedNoun[len(relatedNoun)-2]), "aeiou") {
// Handle words ending in consonant + y (e.g., policy -> policies)
relatedNoun = relatedNoun[:len(relatedNoun)-1] + "ies"
} else if !strings.HasSuffix(relatedNoun, "ies") {
relatedNoun += "s"
}
Comment on lines +224 to +230
Copy link
Contributor

@shwstppr shwstppr Sep 3, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Pearl1594 can we make this a separate method. I gues we are trying to do something similar around line 258 as well for autocompleting for name param. Maybe we can reuse?

}
case argName == "account":
// Heuristic: user is trying to autocomplete for accounts
Expand Down