From 8df6018686359fa8af7106991bd364e99e3b906f Mon Sep 17 00:00:00 2001 From: Pearl Dsilva Date: Thu, 5 Dec 2024 10:55:20 -0500 Subject: [PATCH 1/2] List free IPs when performing associate IPAddress operation --- cli/completer.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/cli/completer.go b/cli/completer.go index af8cab0..6d44405 100644 --- a/cli/completer.go +++ b/cli/completer.go @@ -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) @@ -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 } @@ -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...") From fa2061bd855083e4b6b7a2cb1df6db26c9f2cad9 Mon Sep 17 00:00:00 2001 From: Pearl Dsilva Date: Fri, 6 Dec 2024 06:32:39 -0500 Subject: [PATCH 2/2] remove unnecessary code --- cli/completer.go | 2 -- 1 file changed, 2 deletions(-) diff --git a/cli/completer.go b/cli/completer.go index 6d44405..13712d2 100644 --- a/cli/completer.go +++ b/cli/completer.go @@ -200,7 +200,6 @@ 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) @@ -375,7 +374,6 @@ 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 }