Skip to content

Commit 09e8b60

Browse files
committed
change
Signed-off-by: Abhishek Kumar <[email protected]>
1 parent 1f24c66 commit 09e8b60

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

cli/completer.go

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,10 @@ import (
2828
"github.com/apache/cloudstack-cloudmonkey/config"
2929
)
3030

31+
var nameSupportingApis = []string{
32+
"configuration",
33+
}
34+
3135
func buildAPICacheMap(apiMap map[string][]*config.API) map[string][]*config.API {
3236
for _, cmd := range cmd.AllCommands() {
3337
verb := cmd.Name
@@ -237,8 +241,13 @@ func findAutocompleteAPI(arg *config.APIArg, apiFound *config.API, apiMap map[st
237241
base = strings.TrimSuffix(argName, "id")
238242
} else if strings.HasSuffix(argName, "ids") {
239243
base = strings.TrimSuffix(argName, "ids")
240-
} else if argName == "name" && strings.HasPrefix(apiFound.Noun, "configuration") {
241-
base = "configuration"
244+
} else if argName == "name" {
245+
for _, noun := range nameSupportingApis {
246+
if strings.HasPrefix(apiFound.Noun, noun) {
247+
base = noun
248+
break
249+
}
250+
}
242251
}
243252
// Handle common cases where base ends with a vowel and needs "es"
244253
if strings.HasSuffix(base, "s") || strings.HasSuffix(base, "x") || strings.HasSuffix(base, "z") || strings.HasSuffix(base, "ch") || strings.HasSuffix(base, "sh") {

0 commit comments

Comments
 (0)