Skip to content

Commit

Permalink
List free IPs when performing associate IPAddress operation
Browse files Browse the repository at this point in the history
  • Loading branch information
Pearl1594 committed Dec 5, 2024
1 parent 1f45761 commit 8df6018
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions cli/completer.go
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,7 @@ func findAutocompleteAPI(arg *config.APIArg, apiFound *config.API, apiMap map[st
if arg.Type == "map" {
return nil
}
config.Debug("PEARL apiFound: ", apiFound)

var autocompleteAPI *config.API
argName := strings.Replace(arg.Name, "=", "", -1)
Expand Down Expand Up @@ -374,6 +375,7 @@ func (t *autoCompleter) Do(line []rune, pos int) (options [][]rune, offset int)
}

autocompleteAPI := findAutocompleteAPI(arg, apiFound, apiMap)
config.Debug("api: ", autocompleteAPI)
if autocompleteAPI == nil {
return nil, 0
}
Expand All @@ -391,6 +393,8 @@ func (t *autoCompleter) Do(line []rune, pos int) (options [][]rune, offset int)
autocompleteAPIArgs = append(autocompleteAPIArgs, "type=Routing")
} else if apiFound.Name == "migrateSystemVm" {
autocompleteAPI.Name = "listSystemVms"
} else if apiFound.Name == "associateIpAddress" {
autocompleteAPIArgs = append(autocompleteAPIArgs, "state=Free")
}

spinner := t.Config.StartSpinner("fetching options, please wait...")
Expand Down

0 comments on commit 8df6018

Please sign in to comment.