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:12 UTC

[cloudstack-cloudmonkey] branch master updated (a8beed7 -> 1001560)

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

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


    from a8beed7  network: fix segfault
     new 977d6bd  vendor: update vendoring dependencies
     new 1001560  cli: use cyan as selected colour, don't bolden the input

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 cli/prompt.go                                      | 14 +++-
 cmd/api.go                                         |  4 +-
 go.mod                                             |  4 +-
 go.sum                                             | 11 ++-
 vendor/github.com/c-bata/go-prompt/CHANGELOG.md    | 19 +++++-
 vendor/github.com/c-bata/go-prompt/README.md       | 28 +++++++-
 vendor/github.com/c-bata/go-prompt/completion.go   |  3 +-
 vendor/github.com/c-bata/go-prompt/emacs.go        |  7 +-
 vendor/github.com/c-bata/go-prompt/filter.go       | 79 +++++++++++-----------
 vendor/github.com/c-bata/go-prompt/input_posix.go  |  9 ++-
 vendor/github.com/c-bata/go-prompt/option.go       | 14 +++-
 vendor/github.com/c-bata/go-prompt/output.go       | 13 ++++
 vendor/github.com/c-bata/go-prompt/output_posix.go | 41 +++++++++--
 vendor/github.com/c-bata/go-prompt/output_vt100.go |  4 +-
 .../github.com/c-bata/go-prompt/output_windows.go  | 17 ++++-
 vendor/github.com/c-bata/go-prompt/prompt.go       |  8 +++
 vendor/modules.txt                                 |  2 +-
 17 files changed, 210 insertions(+), 67 deletions(-)


[cloudstack-cloudmonkey] 01/02: vendor: update vendoring dependencies

Posted by ro...@apache.org.
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 977d6bd31b5b2f9a8cc03564513b7526c4cb387b
Author: Rohit Yadav <ro...@apache.org>
AuthorDate: Sat Dec 1 23:21:59 2018 +0530

    vendor: update vendoring dependencies
    
    Signed-off-by: Rohit Yadav <ro...@apache.org>
---
 go.mod                                             |  4 +-
 go.sum                                             | 11 ++-
 vendor/github.com/c-bata/go-prompt/CHANGELOG.md    | 19 +++++-
 vendor/github.com/c-bata/go-prompt/README.md       | 28 +++++++-
 vendor/github.com/c-bata/go-prompt/completion.go   |  1 +
 vendor/github.com/c-bata/go-prompt/emacs.go        |  7 +-
 vendor/github.com/c-bata/go-prompt/filter.go       | 79 +++++++++++-----------
 vendor/github.com/c-bata/go-prompt/input_posix.go  |  9 ++-
 vendor/github.com/c-bata/go-prompt/option.go       | 14 +++-
 vendor/github.com/c-bata/go-prompt/output.go       | 13 ++++
 vendor/github.com/c-bata/go-prompt/output_posix.go | 41 +++++++++--
 vendor/github.com/c-bata/go-prompt/output_vt100.go |  4 +-
 .../github.com/c-bata/go-prompt/output_windows.go  | 17 ++++-
 vendor/github.com/c-bata/go-prompt/prompt.go       |  8 +++
 vendor/modules.txt                                 |  2 +-
 15 files changed, 196 insertions(+), 61 deletions(-)

diff --git a/go.mod b/go.mod
index d403cd0..99642a2 100644
--- a/go.mod
+++ b/go.mod
@@ -19,12 +19,13 @@ module github.com/apache/cloudstack-cloudmonkey
 
 require (
 	github.com/briandowns/spinner v0.0.0-20181018151057-dd69c579ff20
-	github.com/c-bata/go-prompt v0.2.2
+	github.com/c-bata/go-prompt v0.2.3
 	github.com/fatih/color v1.7.0 // indirect
 	github.com/gofrs/flock v0.7.0
 	github.com/google/shlex v0.0.0-20150127133951-6f45313302b9
 	github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1 // indirect
 	github.com/jtolds/gls v4.2.1+incompatible // indirect
+	github.com/kr/pretty v0.1.0 // indirect
 	github.com/mattn/go-colorable v0.0.9 // indirect
 	github.com/mattn/go-isatty v0.0.4 // indirect
 	github.com/mattn/go-runewidth v0.0.3 // indirect
@@ -35,5 +36,6 @@ require (
 	github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d // indirect
 	github.com/smartystreets/goconvey v0.0.0-20180222194500-ef6db91d284a // indirect
 	golang.org/x/sys v0.0.0-20181019160139-8e24a49d80f8 // indirect
+	gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 // indirect
 	gopkg.in/ini.v1 v1.39.0
 )
diff --git a/go.sum b/go.sum
index 5bf1766..e19de37 100644
--- a/go.sum
+++ b/go.sum
@@ -1,7 +1,7 @@
 github.com/briandowns/spinner v0.0.0-20181018151057-dd69c579ff20 h1:kWWOFAhyzkpi4/+L3++mYiZbuxh1TqYkDMHfFjk6ZfE=
 github.com/briandowns/spinner v0.0.0-20181018151057-dd69c579ff20/go.mod h1:hw/JEQBIE+c/BLI4aKM8UU8v+ZqrD3h7HC27kKt8JQU=
-github.com/c-bata/go-prompt v0.2.2 h1:uyKRz6Z6DUyj49QVijyM339UJV9yhbr70gESwbNU3e0=
-github.com/c-bata/go-prompt v0.2.2/go.mod h1:VzqtzE2ksDBcdln8G7mk2RX9QyGjH+OVqOCSiVIqS34=
+github.com/c-bata/go-prompt v0.2.3 h1:jjCS+QhG/sULBhAaBdjb2PlMRVaKXQgn+4yzaauvs2s=
+github.com/c-bata/go-prompt v0.2.3/go.mod h1:VzqtzE2ksDBcdln8G7mk2RX9QyGjH+OVqOCSiVIqS34=
 github.com/fatih/color v1.7.0 h1:DkWD4oS2D8LGGgTQ6IvwJJXSL5Vp2ffcQg58nFV38Ys=
 github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4=
 github.com/gofrs/flock v0.7.0 h1:pGFUjl501gafK9HBt1VGL1KCOd/YhIooID+xgyJCf3g=
@@ -12,6 +12,11 @@ github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1 h1:EGx4pi6eqNxGa
 github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY=
 github.com/jtolds/gls v4.2.1+incompatible h1:fSuqC+Gmlu6l/ZYAoZzx2pyucC8Xza35fpRVWLVmUEE=
 github.com/jtolds/gls v4.2.1+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU=
+github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI=
+github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
+github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
+github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE=
+github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
 github.com/mattn/go-colorable v0.0.9 h1:UVL0vNpWh04HeJXV0KLcaT7r06gOH2l4OW6ddYRUIY4=
 github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU=
 github.com/mattn/go-isatty v0.0.4 h1:bnP0vzxcAdeI1zdubAl5PjU6zsERjGZb7raWodagDYs=
@@ -32,5 +37,7 @@ github.com/smartystreets/goconvey v0.0.0-20180222194500-ef6db91d284a h1:JSvGDIbm
 github.com/smartystreets/goconvey v0.0.0-20180222194500-ef6db91d284a/go.mod h1:XDJAKZRPZ1CvBcN2aX5YOUTYGHki24fSF0Iv48Ibg0s=
 golang.org/x/sys v0.0.0-20181019160139-8e24a49d80f8 h1:R91KX5nmbbvEd7w370cbVzKC+EzCTGqZq63Zad5IcLM=
 golang.org/x/sys v0.0.0-20181019160139-8e24a49d80f8/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
+gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY=
+gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
 gopkg.in/ini.v1 v1.39.0 h1:Jf2sFGT+sAd7i+4ftUN1Jz90uw8XNH8NXbbOY16taA8=
 gopkg.in/ini.v1 v1.39.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k=
diff --git a/vendor/github.com/c-bata/go-prompt/CHANGELOG.md b/vendor/github.com/c-bata/go-prompt/CHANGELOG.md
index a1fcb27..b9e21f1 100644
--- a/vendor/github.com/c-bata/go-prompt/CHANGELOG.md
+++ b/vendor/github.com/c-bata/go-prompt/CHANGELOG.md
@@ -4,6 +4,24 @@
 
 next release.
 
+## v0.2.3 (2018/10/25)
+
+### What's new?
+
+* Add `prompt.FuzzyFilter` for fuzzy matching at [#92](https://github.com/c-bata/go-prompt/pull/92).
+* Add `OptionShowCompletionAtStart` to show completion at start at [#100](https://github.com/c-bata/go-prompt/pull/100).
+* Add `prompt.NewStderrWriter` at [#102](https://github.com/c-bata/go-prompt/pull/102).
+
+### Fixed
+
+* Fix resetting display attributes (please see [pull #104](https://github.com/c-bata/go-prompt/pull/104) for more details).
+* Fix error handling of Flush function in ConsoleWriter (please see [pull #97](https://github.com/c-bata/go-prompt/pull/97) for more details).
+* Fix panic problem when reading from stdin before starting the prompt (please see [issue #88](https://github.com/c-bata/go-prompt/issues/88) for more details).
+
+### Removed or Deprecated
+
+* `prompt.NewStandardOutputWriter` is deprecated. Please use `prompt.NewStdoutWriter`.
+
 ## v0.2.2 (2018/06/28)
 
 ### What's new?
@@ -17,7 +35,6 @@ next release.
 
 ### Removed or Deprecated
 
-* SetColor method in ConsoleWriter is deprecated. Please use SetDisplayAttributes instead.
 * prompt.Choose shortcut function is deprecated.
 
 ## v0.2.1 (2018/02/14)
diff --git a/vendor/github.com/c-bata/go-prompt/README.md b/vendor/github.com/c-bata/go-prompt/README.md
index a949b8b..ccfdaec 100644
--- a/vendor/github.com/c-bata/go-prompt/README.md
+++ b/vendor/github.com/c-bata/go-prompt/README.md
@@ -2,6 +2,8 @@
 
 [![Go Report Card](https://goreportcard.com/badge/github.com/c-bata/go-prompt)](https://goreportcard.com/report/github.com/c-bata/go-prompt)
 ![Software License](https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square)
+[![Backers on Open Collective](https://opencollective.com/go-prompt/backers/badge.svg)](#backers) [![Sponsors on Open Collective](https://opencollective.com/go-prompt/sponsors/badge.svg)](#sponsors)
+[![GoDoc](https://godoc.org/github.com/c-bata/go-prompt?status.svg)](https://godoc.org/github.com/c-bata/go-prompt) 
 
 A library for building powerful interactive prompts inspired by [python-prompt-toolkit](https://github.com/jonathanslenders/python-prompt-toolkit),
 making it easier to build cross-platform command line tools using Go.
@@ -103,8 +105,32 @@ Masashi Shibata
 
 * Twitter: [@c\_bata\_](https://twitter.com/c_bata_/)
 * Github: [@c-bata](https://github.com/c-bata/)
-* Facebook: [Masashi Shibata](https://www.facebook.com/masashi.cbata)
+
+## Supporting go-prompt
+
+### Contributors
+
+This project exists thanks to all the people who contribute. 
+
+<a href="graphs/contributors"><img src="https://opencollective.com/go-prompt/contributors.svg?width=890&button=false" /></a>
+
+### Backers and Sponsors (OpenCollective)
+
+Started getting support via opencollective. If you support this project by becoming a sponsor, your logo will show up here with a link to your website.
+
+[![Become a backer](https://opencollective.com/go-prompt/tiers/backer.svg?avatarHeight=64)](https://opencollective.com/go-prompt#backers)
+<a href="https://opencollective.com/go-prompt/sponsor/0/website" target="_blank"><img src="https://opencollective.com/go-prompt/sponsor/0/avatar.svg"></a>
+<a href="https://opencollective.com/go-prompt/sponsor/1/website" target="_blank"><img src="https://opencollective.com/go-prompt/sponsor/1/avatar.svg"></a>
+<a href="https://opencollective.com/go-prompt/sponsor/2/website" target="_blank"><img src="https://opencollective.com/go-prompt/sponsor/2/avatar.svg"></a>
+<a href="https://opencollective.com/go-prompt/sponsor/3/website" target="_blank"><img src="https://opencollective.com/go-prompt/sponsor/3/avatar.svg"></a>
+<a href="https://opencollective.com/go-prompt/sponsor/4/website" target="_blank"><img src="https://opencollective.com/go-prompt/sponsor/4/avatar.svg"></a>
+<a href="https://opencollective.com/go-prompt/sponsor/5/website" target="_blank"><img src="https://opencollective.com/go-prompt/sponsor/5/avatar.svg"></a>
+<a href="https://opencollective.com/go-prompt/sponsor/6/website" target="_blank"><img src="https://opencollective.com/go-prompt/sponsor/6/avatar.svg"></a>
+<a href="https://opencollective.com/go-prompt/sponsor/7/website" target="_blank"><img src="https://opencollective.com/go-prompt/sponsor/7/avatar.svg"></a>
+<a href="https://opencollective.com/go-prompt/sponsor/8/website" target="_blank"><img src="https://opencollective.com/go-prompt/sponsor/8/avatar.svg"></a>
+<a href="https://opencollective.com/go-prompt/sponsor/9/website" target="_blank"><img src="https://opencollective.com/go-prompt/sponsor/9/avatar.svg"></a>
 
 ## License
 
 This software is licensed under the MIT license, see [LICENSE](./LICENSE) for more information.
+
diff --git a/vendor/github.com/c-bata/go-prompt/completion.go b/vendor/github.com/c-bata/go-prompt/completion.go
index 5f69803..6687987 100644
--- a/vendor/github.com/c-bata/go-prompt/completion.go
+++ b/vendor/github.com/c-bata/go-prompt/completion.go
@@ -36,6 +36,7 @@ type CompletionManager struct {
 
 	verticalScroll int
 	wordSeparator  string
+	showAtStart    bool
 }
 
 // GetSelectedSuggestion returns the selected item.
diff --git a/vendor/github.com/c-bata/go-prompt/emacs.go b/vendor/github.com/c-bata/go-prompt/emacs.go
index 9dc71ed..e34ade2 100644
--- a/vendor/github.com/c-bata/go-prompt/emacs.go
+++ b/vendor/github.com/c-bata/go-prompt/emacs.go
@@ -110,10 +110,9 @@ var emacsKeyBindings = []KeyBind{
 	{
 		Key: ControlL,
 		Fn: func(buf *Buffer) {
-			out := NewStandardOutputWriter()
-			out.EraseScreen()
-			out.CursorGoTo(0, 0)
-			out.Flush()
+			consoleWriter.EraseScreen()
+			consoleWriter.CursorGoTo(0, 0)
+			consoleWriter.Flush()
 		},
 	},
 }
diff --git a/vendor/github.com/c-bata/go-prompt/filter.go b/vendor/github.com/c-bata/go-prompt/filter.go
index 583674a..a5ec666 100644
--- a/vendor/github.com/c-bata/go-prompt/filter.go
+++ b/vendor/github.com/c-bata/go-prompt/filter.go
@@ -7,65 +7,64 @@ type Filter func([]Suggest, string, bool) []Suggest
 
 // FilterHasPrefix checks whether the string completions.Text begins with sub.
 func FilterHasPrefix(completions []Suggest, sub string, ignoreCase bool) []Suggest {
-	if sub == "" {
-		return completions
-	}
-	if ignoreCase {
-		sub = strings.ToUpper(sub)
-	}
-
-	ret := make([]Suggest, 0, len(completions))
-	for i := range completions {
-		c := completions[i].Text
-		if ignoreCase {
-			c = strings.ToUpper(c)
-		}
-		if strings.HasPrefix(c, sub) {
-			ret = append(ret, completions[i])
-		}
-	}
-	return ret
+	return filterSuggestions(completions, sub, ignoreCase, strings.HasPrefix)
 }
 
 // FilterHasSuffix checks whether the completion.Text ends with sub.
 func FilterHasSuffix(completions []Suggest, sub string, ignoreCase bool) []Suggest {
-	if sub == "" {
-		return completions
-	}
-	if ignoreCase {
-		sub = strings.ToUpper(sub)
-	}
+	return filterSuggestions(completions, sub, ignoreCase, strings.HasSuffix)
+}
 
-	ret := make([]Suggest, 0, len(completions))
-	for i := range completions {
-		c := completions[i].Text
-		if ignoreCase {
-			c = strings.ToUpper(c)
+// FilterContains checks whether the completion.Text contains sub.
+func FilterContains(completions []Suggest, sub string, ignoreCase bool) []Suggest {
+	return filterSuggestions(completions, sub, ignoreCase, strings.Contains)
+}
+
+// FilterFuzzy checks whether the completion.Text fuzzy matches sub.
+// Fuzzy searching for "dog" is equivalent to "*d*o*g*". This search term
+// would match, for example, "Good food is gone"
+//                               ^  ^      ^
+func FilterFuzzy(completions []Suggest, sub string, ignoreCase bool) []Suggest {
+	return filterSuggestions(completions, sub, ignoreCase, fuzzyMatch)
+}
+
+func fuzzyMatch(s, sub string) bool {
+	sChars := []rune(s)
+	subChars := []rune(sub)
+	sIdx := 0
+
+	for _, c := range subChars {
+		found := false
+		for ; sIdx < len(sChars); sIdx++ {
+			if sChars[sIdx] == c {
+				found = true
+				sIdx++
+				break
+			}
 		}
-		if strings.HasSuffix(c, sub) {
-			ret = append(ret, completions[i])
+		if !found {
+			return false
 		}
 	}
-	return ret
+	return true
 }
 
-// FilterContains checks whether the completion.Text contains sub.
-func FilterContains(completions []Suggest, sub string, ignoreCase bool) []Suggest {
+func filterSuggestions(suggestions []Suggest, sub string, ignoreCase bool, function func(string, string) bool) []Suggest {
 	if sub == "" {
-		return completions
+		return suggestions
 	}
 	if ignoreCase {
 		sub = strings.ToUpper(sub)
 	}
 
-	ret := make([]Suggest, 0, len(completions))
-	for i := range completions {
-		c := completions[i].Text
+	ret := make([]Suggest, 0, len(suggestions))
+	for i := range suggestions {
+		c := suggestions[i].Text
 		if ignoreCase {
 			c = strings.ToUpper(c)
 		}
-		if strings.Contains(c, sub) {
-			ret = append(ret, completions[i])
+		if function(c, sub) {
+			ret = append(ret, suggestions[i])
 		}
 	}
 	return ret
diff --git a/vendor/github.com/c-bata/go-prompt/input_posix.go b/vendor/github.com/c-bata/go-prompt/input_posix.go
index 46ecb51..a9a2db6 100644
--- a/vendor/github.com/c-bata/go-prompt/input_posix.go
+++ b/vendor/github.com/c-bata/go-prompt/input_posix.go
@@ -49,7 +49,7 @@ func (t *PosixParser) TearDown() error {
 // Read returns byte array.
 func (t *PosixParser) Read() ([]byte, error) {
 	buf := make([]byte, maxReadBytes)
-	n, err := syscall.Read(syscall.Stdin, buf)
+	n, err := syscall.Read(t.fd, buf)
 	if err != nil {
 		return []byte{}, err
 	}
@@ -122,7 +122,12 @@ var _ ConsoleParser = &PosixParser{}
 
 // NewStandardInputParser returns ConsoleParser object to read from stdin.
 func NewStandardInputParser() *PosixParser {
+	in, err := syscall.Open("/dev/tty", syscall.O_RDONLY, 0)
+	if err != nil {
+		panic(err)
+	}
+
 	return &PosixParser{
-		fd: syscall.Stdin,
+		fd: in,
 	}
 }
diff --git a/vendor/github.com/c-bata/go-prompt/option.go b/vendor/github.com/c-bata/go-prompt/option.go
index 9a7f386..9d843a7 100644
--- a/vendor/github.com/c-bata/go-prompt/option.go
+++ b/vendor/github.com/c-bata/go-prompt/option.go
@@ -15,6 +15,7 @@ func OptionParser(x ConsoleParser) Option {
 // OptionWriter to set a custom ConsoleWriter object. An argument should implement ConsoleWriter interface.
 func OptionWriter(x ConsoleWriter) Option {
 	return func(p *Prompt) error {
+		registerConsoleWriter(x)
 		p.renderer.out = x
 		return nil
 	}
@@ -225,13 +226,24 @@ func OptionAddASCIICodeBind(b ...ASCIICodeBind) Option {
 	}
 }
 
+// OptionShowCompletionAtStart to set completion window is open at start.
+func OptionShowCompletionAtStart() Option {
+	return func(p *Prompt) error {
+		p.completion.showAtStart = true
+		return nil
+	}
+}
+
 // New returns a Prompt with powerful auto-completion.
 func New(executor Executor, completer Completer, opts ...Option) *Prompt {
+	defaultWriter := NewStdoutWriter()
+	registerConsoleWriter(defaultWriter)
+
 	pt := &Prompt{
 		in: NewStandardInputParser(),
 		renderer: &Render{
 			prefix:                       "> ",
-			out:                          NewStandardOutputWriter(),
+			out:                          defaultWriter,
 			livePrefixCallback:           func() (string, bool) { return "", false },
 			prefixTextColor:              Blue,
 			prefixBGColor:                DefaultColor,
diff --git a/vendor/github.com/c-bata/go-prompt/output.go b/vendor/github.com/c-bata/go-prompt/output.go
index 5afb81c..42531b4 100644
--- a/vendor/github.com/c-bata/go-prompt/output.go
+++ b/vendor/github.com/c-bata/go-prompt/output.go
@@ -1,5 +1,18 @@
 package prompt
 
+import "sync"
+
+var (
+	consoleWriterMu sync.Mutex
+	consoleWriter   ConsoleWriter
+)
+
+func registerConsoleWriter(f ConsoleWriter) {
+	consoleWriterMu.Lock()
+	defer consoleWriterMu.Unlock()
+	consoleWriter = f
+}
+
 // DisplayAttribute represents display  attributes like Blinking, Bold, Italic and so on.
 type DisplayAttribute int
 
diff --git a/vendor/github.com/c-bata/go-prompt/output_posix.go b/vendor/github.com/c-bata/go-prompt/output_posix.go
index 4c2ccf6..e8ec2c1 100644
--- a/vendor/github.com/c-bata/go-prompt/output_posix.go
+++ b/vendor/github.com/c-bata/go-prompt/output_posix.go
@@ -3,9 +3,12 @@
 package prompt
 
 import (
+	"log"
 	"syscall"
 )
 
+const flushMaxRetryCount = 3
+
 // PosixWriter is a ConsoleWriter implementation for POSIX environment.
 // To control terminal emulator, this outputs VT100 escape sequences.
 type PosixWriter struct {
@@ -15,9 +18,23 @@ type PosixWriter struct {
 
 // Flush to flush buffer
 func (w *PosixWriter) Flush() error {
-	_, err := syscall.Write(w.fd, w.buffer)
-	if err != nil {
-		return err
+	l := len(w.buffer)
+	offset := 0
+	retry := 0
+	for {
+		n, err := syscall.Write(w.fd, w.buffer[offset:])
+		if err != nil {
+			log.Printf("[DEBUG] flush error: %s", err)
+			if retry < flushMaxRetryCount {
+				retry++
+				continue
+			}
+			return err
+		}
+		offset += n
+		if offset == l {
+			break
+		}
 	}
 	w.buffer = []byte{}
 	return nil
@@ -25,11 +42,25 @@ func (w *PosixWriter) Flush() error {
 
 var _ ConsoleWriter = &PosixWriter{}
 
-// NewStandardOutputWriter returns ConsoleWriter object to write to stdout.
+var (
+	// Deprecated: Please use NewStdoutWriter
+	NewStandardOutputWriter = NewStdoutWriter
+)
+
+// NewStdoutWriter returns ConsoleWriter object to write to stdout.
 // This generates VT100 escape sequences because almost terminal emulators
 // in POSIX OS built on top of a VT100 specification.
-func NewStandardOutputWriter() *PosixWriter {
+func NewStdoutWriter() ConsoleWriter {
 	return &PosixWriter{
 		fd: syscall.Stdout,
 	}
 }
+
+// NewStderrWriter returns ConsoleWriter object to write to stderr.
+// This generates VT100 escape sequences because almost terminal emulators
+// in POSIX OS built on top of a VT100 specification.
+func NewStderrWriter() ConsoleWriter {
+	return &PosixWriter{
+		fd: syscall.Stderr,
+	}
+}
diff --git a/vendor/github.com/c-bata/go-prompt/output_vt100.go b/vendor/github.com/c-bata/go-prompt/output_vt100.go
index 3b3031d..81c5e12 100644
--- a/vendor/github.com/c-bata/go-prompt/output_vt100.go
+++ b/vendor/github.com/c-bata/go-prompt/output_vt100.go
@@ -236,7 +236,9 @@ func (w *VT100Writer) SetColor(fg, bg Color, bold bool) {
 	if bold {
 		w.SetDisplayAttributes(fg, bg, DisplayBold)
 	} else {
-		w.SetDisplayAttributes(fg, bg, DisplayDefaultFont)
+		// If using `DisplayDefualt`, it will be broken in some environment.
+		// Details are https://github.com/c-bata/go-prompt/pull/85
+		w.SetDisplayAttributes(fg, bg, DisplayReset)
 	}
 	return
 }
diff --git a/vendor/github.com/c-bata/go-prompt/output_windows.go b/vendor/github.com/c-bata/go-prompt/output_windows.go
index 7418af3..e93bd95 100644
--- a/vendor/github.com/c-bata/go-prompt/output_windows.go
+++ b/vendor/github.com/c-bata/go-prompt/output_windows.go
@@ -27,10 +27,23 @@ func (w *WindowsWriter) Flush() error {
 
 var _ ConsoleWriter = &WindowsWriter{}
 
-// NewStandardOutputWriter returns ConsoleWriter object to write to stdout.
+var (
+	// Deprecated: Please use NewStdoutWriter
+	NewStandardOutputWriter = NewStdoutWriter
+)
+
+// NewStdoutWriter returns ConsoleWriter object to write to stdout.
 // This generates win32 control sequences.
-func NewStandardOutputWriter() *WindowsWriter {
+func NewStdoutWriter() ConsoleWriter {
 	return &WindowsWriter{
 		out: colorable.NewColorableStdout(),
 	}
 }
+
+// NewStderrWriter returns ConsoleWriter object to write to stderr.
+// This generates win32 control sequences.
+func NewStderrWriter() ConsoleWriter {
+	return &WindowsWriter{
+		out: colorable.NewColorableStderr(),
+	}
+}
diff --git a/vendor/github.com/c-bata/go-prompt/prompt.go b/vendor/github.com/c-bata/go-prompt/prompt.go
index 6f72944..3d6b895 100644
--- a/vendor/github.com/c-bata/go-prompt/prompt.go
+++ b/vendor/github.com/c-bata/go-prompt/prompt.go
@@ -51,6 +51,10 @@ func (p *Prompt) Run() {
 	p.setUp()
 	defer p.tearDown()
 
+	if p.completion.showAtStart {
+		p.completion.Update(*p.buf.Document())
+	}
+
 	p.renderer.Render(p.buf, p.completion)
 
 	bufCh := make(chan []byte, 128)
@@ -232,6 +236,10 @@ func (p *Prompt) Input() string {
 	p.setUp()
 	defer p.tearDown()
 
+	if p.completion.showAtStart {
+		p.completion.Update(*p.buf.Document())
+	}
+
 	p.renderer.Render(p.buf, p.completion)
 	bufCh := make(chan []byte, 128)
 	stopReadBufCh := make(chan struct{})
diff --git a/vendor/modules.txt b/vendor/modules.txt
index b2fda38..97e0038 100644
--- a/vendor/modules.txt
+++ b/vendor/modules.txt
@@ -1,6 +1,6 @@
 # github.com/briandowns/spinner v0.0.0-20181018151057-dd69c579ff20
 github.com/briandowns/spinner
-# github.com/c-bata/go-prompt v0.2.2
+# github.com/c-bata/go-prompt v0.2.3
 github.com/c-bata/go-prompt
 # github.com/fatih/color v1.7.0
 github.com/fatih/color


[cloudstack-cloudmonkey] 02/02: cli: use cyan as selected colour, don't bolden the input

Posted by ro...@apache.org.
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)