You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by ro...@apache.org on 2018/12/01 18:17:14 UTC
[cloudstack-cloudmonkey] 02/02: cli: use cyan as selected colour,
don't bolden the input
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 1001560b4f2879f1c9447d20c751c47d9fd807fe
Author: Rohit Yadav <ro...@apache.org>
AuthorDate: Sat Dec 1 23:46:04 2018 +0530
cli: use cyan as selected colour, don't bolden the input
Signed-off-by: Rohit Yadav <ro...@apache.org>
---
cli/prompt.go | 14 +++++++++++---
cmd/api.go | 4 ++--
vendor/github.com/c-bata/go-prompt/completion.go | 2 +-
3 files changed, 14 insertions(+), 6 deletions(-)
diff --git a/cli/prompt.go b/cli/prompt.go
index 3aa22df..1e42349 100644
--- a/cli/prompt.go
+++ b/cli/prompt.go
@@ -51,21 +51,29 @@ func ExecPrompt() {
}),
prompt.OptionMaxSuggestion(5),
prompt.OptionPrefixTextColor(prompt.DefaultColor),
- prompt.OptionPreviewSuggestionTextColor(prompt.DarkBlue),
+ prompt.OptionPreviewSuggestionTextColor(prompt.DefaultColor),
prompt.OptionSelectedSuggestionTextColor(prompt.White),
- prompt.OptionSelectedSuggestionBGColor(prompt.DarkBlue),
+ prompt.OptionSelectedSuggestionBGColor(prompt.Cyan),
prompt.OptionSelectedDescriptionTextColor(prompt.White),
prompt.OptionSelectedDescriptionBGColor(prompt.DarkGray),
prompt.OptionSuggestionTextColor(prompt.Black),
prompt.OptionSuggestionBGColor(prompt.White),
prompt.OptionDescriptionTextColor(prompt.Black),
prompt.OptionDescriptionBGColor(prompt.LightGray),
- prompt.OptionScrollbarThumbColor(prompt.DarkBlue),
+ prompt.OptionScrollbarThumbColor(prompt.Cyan),
prompt.OptionScrollbarBGColor(prompt.LightGray),
prompt.OptionAddKeyBind(prompt.KeyBind{
Key: prompt.Tab,
Fn: tabHandler,
}),
+ prompt.OptionAddKeyBind(prompt.KeyBind{
+ Key: prompt.Up,
+ Fn: tabHandler,
+ }),
+ prompt.OptionAddKeyBind(prompt.KeyBind{
+ Key: prompt.Down,
+ Fn: tabHandler,
+ }),
)
shell.Run()
}
diff --git a/cmd/api.go b/cmd/api.go
index 3ba7ea4..b84f919 100644
--- a/cmd/api.go
+++ b/cmd/api.go
@@ -62,7 +62,7 @@ func init() {
for _, required := range api.RequiredArgs {
provided := false
for _, arg := range apiArgs {
- if strings.HasPrefix(arg, required) {
+ if strings.Contains(arg, "=") && strings.HasPrefix(arg, required) {
provided = true
}
}
@@ -72,7 +72,7 @@ func init() {
}
if len(missingArgs) > 0 {
- fmt.Println("💩 Missing required arguments: ", strings.Join(missingArgs, ", "))
+ fmt.Println("💩 Missing required parameters: ", strings.Join(missingArgs, ", "))
return nil
}
diff --git a/vendor/github.com/c-bata/go-prompt/completion.go b/vendor/github.com/c-bata/go-prompt/completion.go
index 6687987..bbb8dbb 100644
--- a/vendor/github.com/c-bata/go-prompt/completion.go
+++ b/vendor/github.com/c-bata/go-prompt/completion.go
@@ -41,7 +41,7 @@ type CompletionManager struct {
// GetSelectedSuggestion returns the selected item.
func (c *CompletionManager) GetSelectedSuggestion() (s Suggest, ok bool) {
- if c.selected == -1 {
+ if c.selected == -1 || len(c.tmp) < 1 {
return Suggest{}, false
} else if c.selected < -1 {
log.Printf("[ERROR] shoud be reached here, selected=%d", c.selected)