Copilot commented on code in PR #194:
URL: 
https://github.com/apache/cloudstack-cloudmonkey/pull/194#discussion_r3830812740


##########
cli/completer.go:
##########
@@ -221,7 +237,7 @@ 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"
+                       relatedNoun = pluralizeNoun(relatedNoun)
                }

Review Comment:
   In the id/ids heuristic, pluralizeNoun(apiFound.Noun) is applied whenever 
apiFound.Verb != "list". This breaks APIs whose noun is already plural (e.g., 
deleteAlerts/deleteEvents have noun "alerts"/"events"): pluralizeNoun("alerts") 
becomes "alertses", so the lookup won’t match listAlerts/listEvents. 
Suggestion: first try findAPI(apiMap, apiFound.Noun) as-is, and only pluralize 
when no list API matches the original noun.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to