Skip to content

Commit 299f0de

Browse files
authored
fix(autocomplete): complete arg of multiple word resources (#3066)
1 parent fe2a6cb commit 299f0de

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

internal/core/autocomplete_utils.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,8 @@ func AutocompleteGetArg(ctx context.Context, cmd *Command, argSpec *ArgSpec, com
9494
// ex with "scw instance private-nic list server-id=<tab>"
9595
// we get server as resource instead of private-nic to find command "scw instance server list"
9696
if !strings.HasPrefix(argName, cmd.Resource) {
97-
dashIndex := strings.Index(argName, "-")
97+
// Use last index as resource name might contain a dash (ex: security-group-id)
98+
dashIndex := strings.LastIndex(argName, "-")
9899
if dashIndex > 0 {
99100
argResource = argName[:dashIndex]
100101
}

0 commit comments

Comments
 (0)