This is an automated email from the ASF dual-hosted git repository.

rohit pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/cloudstack-cloudmonkey.git

commit 06b38b73bdbb2431ed151d183ae1367de0c78803
Author: Rohit Yadav <ro...@apache.org>
AuthorDate: Fri Apr 13 18:21:32 2018 +0530

    cli: improve selector and autocompletion
    
    Signed-off-by: Rohit Yadav <ro...@apache.org>
---
 cli/completer.go | 6 +++---
 cli/selector.go  | 8 ++++----
 cmd/api.go       | 2 +-
 config/cache.go  | 2 +-
 config/config.go | 2 +-
 5 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/cli/completer.go b/cli/completer.go
index 1a4c0a2..58dadcc 100644
--- a/cli/completer.go
+++ b/cli/completer.go
@@ -233,10 +233,10 @@ func (t *CliCompleter) Do(line []rune, pos int) (options 
[][]rune, offset int) {
                                })
                                fmt.Println()
                                selectedOption := 
ShowSelector(autocompleteOptions)
-                               if arg.Name == "account" {
-                                       selected = selectedOption.Name
-                               } else {
+                               if strings.HasSuffix(arg.Name, "id") || 
strings.HasSuffix(arg.Name, "ids") {
                                        selected = selectedOption.Id
+                               } else {
+                                       selected = selectedOption.Name
                                }
                        } else {
                                if len(autocompleteOptions) == 1 {
diff --git a/cli/selector.go b/cli/selector.go
index bb1696e..d0c3656 100644
--- a/cli/selector.go
+++ b/cli/selector.go
@@ -59,10 +59,10 @@ func ShowSelector(options []SelectOption) SelectOption {
        defer selector.unlock()
 
        templates := &promptui.SelectTemplates{
-               Label:    "{{ . }}?",
-               Active:   "🐡 {{ .Name | cyan }} ({{ .Id | red }})",
+               Label:    "{{ . }}",
+               Active:   "β–Ά {{ .Name | cyan }} ({{ .Id | red }})",
                Inactive: "  {{ .Name | cyan }} ({{ .Id | red }})",
-               Selected: "Selected: {{ .Name | cyan }} ({{ .Id | red }})",
+               Selected: "πŸ‘ŠSelected: {{ .Name | cyan }} ({{ .Id | red }})",
                Details: `
 --------- Current Selection ----------
 {{ "Id:" | faint }}  {{ .Id }}
@@ -79,7 +79,7 @@ func ShowSelector(options []SelectOption) SelectOption {
        }
 
        prompt := promptui.Select{
-               Label:             "Use the arrow keys to navigate: ↓ ↑ β†’ ←  
and / toggles search",
+               Label:             "Use the arrow keys to navigate: ↓ ↑ β†’ ←. 
Press / to toggle πŸ”search",
                Items:             options,
                Templates:         templates,
                Size:              5,
diff --git a/cmd/api.go b/cmd/api.go
index ff9d0ce..9dc5c9a 100644
--- a/cmd/api.go
+++ b/cmd/api.go
@@ -76,7 +76,7 @@ func init() {
                        }
 
                        if len(missingArgs) > 0 {
-                               fmt.Println("Missing required arguments: ", 
strings.Join(missingArgs, ", "))
+                               fmt.Println("πŸ’© Missing required arguments: ", 
strings.Join(missingArgs, ", "))
                                return nil
                        }
 
diff --git a/config/cache.go b/config/cache.go
index 27b431f..e908cea 100644
--- a/config/cache.go
+++ b/config/cache.go
@@ -96,7 +96,7 @@ func (c *Config) UpdateCache(response map[string]interface{}) 
interface{} {
        for _, node := range apiList {
                api, valid := node.(map[string]interface{})
                if !valid {
-                       //fmt.Println("Errro, moving on")
+                       fmt.Println("Errro, moving on 🍌")
                        continue
                }
                apiName := api["name"].(string)
diff --git a/config/config.go b/config/config.go
index 0f2d71e..1a445a6 100644
--- a/config/config.go
+++ b/config/config.go
@@ -135,7 +135,7 @@ func (c *Config) UpdateGlobalConfig(key string, value 
string) {
 }
 
 func (c *Config) UpdateConfig(namespace string, key string, value string) {
-       fmt.Println("Updating for key", key, ", value=", value, ", in ns=", 
namespace)
+       fmt.Println("πŸ‘Œ Updating for key", key, ", value=", value, ", in ns=", 
namespace)
        if key == "profile" {
                //FIXME
                c.ActiveProfile.Name = value

-- 
To stop receiving notification emails like this one, please contact
ro...@apache.org.

Reply via email to