diff --git a/vendor/github.com/0xAX/notificator/.gitignore b/vendor/github.com/0xAX/notificator/.gitignore
deleted file mode 100644
index 79d89ab..0000000
--- a/vendor/github.com/0xAX/notificator/.gitignore
+++ /dev/null
@@ -1,25 +0,0 @@
-# Compiled Object files, Static and Dynamic libs (Shared Objects)
-*.o
-*.a
-*.so
-
-# Folders
-_obj
-_test
-
-# Architecture specific extensions/prefixes
-*.[568vq]
-[568vq].out
-
-*.cgo1.go
-*.cgo2.c
-_cgo_defun.c
-_cgo_gotypes.go
-_cgo_export.*
-
-_testmain.go
-
-*.exe
-*.test
-
-.idea
diff --git a/vendor/github.com/0xAX/notificator/LICENSE b/vendor/github.com/0xAX/notificator/LICENSE
deleted file mode 100644
index 015ead8..0000000
--- a/vendor/github.com/0xAX/notificator/LICENSE
+++ /dev/null
@@ -1,27 +0,0 @@
-Copyright (c) 2014, 0xAX
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
-
-* Redistributions of source code must retain the above copyright notice, this
- list of conditions and the following disclaimer.
-
-* Redistributions in binary form must reproduce the above copyright notice,
- this list of conditions and the following disclaimer in the documentation
- and/or other materials provided with the distribution.
-
-* Neither the name of the {organization} nor the names of its
- contributors may be used to endorse or promote products derived from
- this software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
-FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
-SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
-CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
-OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/vendor/github.com/0xAX/notificator/README.md b/vendor/github.com/0xAX/notificator/README.md
deleted file mode 100644
index 9e71f7a..0000000
--- a/vendor/github.com/0xAX/notificator/README.md
+++ /dev/null
@@ -1,49 +0,0 @@
-notificator
-===========================
-
-Desktop notification with Golang for:
-
- * Windows with `growlnotify`;
- * Mac OS X with `terminal-notifier` (if installed) or `osascript` (native, 10.9 Mavericks or Up.);
- * Linux with `notify-send` for Gnome and `kdialog` for Kde.
-
-Usage
-------
-
-```go
-package main
-
-import (
- "github.com/0xAX/notificator"
-)
-
-var notify *notificator.Notificator
-
-func main() {
-
- notify = notificator.New(notificator.Options{
- DefaultIcon: "icon/default.png",
- AppName: "My test App",
- })
-
- notify.Push("title", "text", "/home/user/icon.png", notificator.UR_CRITICAL)
-}
-```
-
-TODO
------
-
- * Add more options for different notificators.
-
-Сontribution
-------------
-
- * Fork;
- * Make changes;
- * Send pull request;
- * Thank you.
-
-author
-----------
-
-[@0xAX](https://twitter.com/0xAX)
diff --git a/vendor/github.com/0xAX/notificator/example/main.go b/vendor/github.com/0xAX/notificator/example/main.go
deleted file mode 100644
index 09fdb38..0000000
--- a/vendor/github.com/0xAX/notificator/example/main.go
+++ /dev/null
@@ -1,24 +0,0 @@
-package main
-
-import (
- "../../notificator"
- "log"
-)
-
-var notify *notificator.Notificator
-
-func main() {
- notify = notificator.New(notificator.Options{
- DefaultIcon: "icon/default.png",
- AppName: "My test App",
- })
-
- notify.Push("title", "text", "/home/user/icon.png", notificator.UR_NORMAL)
-
- // Check errors
- err := notify.Push("error", "ops =(", "/home/user/icon.png", notificator.UR_CRITICAL)
-
- if err != nil {
- log.Fatal(err)
- }
-}
diff --git a/vendor/github.com/0xAX/notificator/icon/golang.png b/vendor/github.com/0xAX/notificator/icon/golang.png
deleted file mode 100644
index 217cc74..0000000
Binary files a/vendor/github.com/0xAX/notificator/icon/golang.png and /dev/null differ
diff --git a/vendor/github.com/0xAX/notificator/notification.go b/vendor/github.com/0xAX/notificator/notification.go
deleted file mode 100644
index 918605a..0000000
--- a/vendor/github.com/0xAX/notificator/notification.go
+++ /dev/null
@@ -1,166 +0,0 @@
-package notificator
-
-import (
- "fmt"
- "os/exec"
- "runtime"
- "strconv"
- "strings"
-)
-
-type Options struct {
- DefaultIcon string
- AppName string
-}
-
-const (
- UR_NORMAL = "normal"
- UR_CRITICAL = "critical"
-)
-
-type notifier interface {
- push(title string, text string, iconPath string) *exec.Cmd
- pushCritical(title string, text string, iconPath string) *exec.Cmd
-}
-
-type Notificator struct {
- notifier notifier
- defaultIcon string
-}
-
-func (n Notificator) Push(title string, text string, iconPath string, urgency string) error {
- icon := n.defaultIcon
-
- if iconPath != "" {
- icon = iconPath
- }
-
- if urgency == UR_CRITICAL {
- return n.notifier.pushCritical(title, text, icon).Run()
- }
-
- return n.notifier.push(title, text, icon).Run()
-
-}
-
-type osxNotificator struct {
- AppName string
-}
-
-func (o osxNotificator) push(title string, text string, iconPath string) *exec.Cmd {
-
- // Checks if terminal-notifier exists, and is accessible.
-
- term_notif := CheckTermNotif()
- os_version_check := CheckMacOSVersion()
-
- // if terminal-notifier exists, use it.
- // else, fall back to osascript. (Mavericks and later.)
-
- if term_notif == true {
- return exec.Command("terminal-notifier", "-title", o.AppName, "-message", text, "-subtitle", title, "-appIcon", iconPath)
- } else if os_version_check == true {
- title = strings.Replace(title, `"`, `\"`, -1)
- text = strings.Replace(text, `"`, `\"`, -1)
-
- notification := fmt.Sprintf("display notification \"%s\" with title \"%s\" subtitle \"%s\"", text, o.AppName, title)
- return exec.Command("osascript", "-e", notification)
- }
-
- // finally falls back to growlnotify.
-
- return exec.Command("growlnotify", "-n", o.AppName, "--image", iconPath, "-m", title)
-}
-
-// Causes the notification to stick around until clicked.
-func (o osxNotificator) pushCritical(title string, text string, iconPath string) *exec.Cmd {
-
- // same function as above...
-
- term_notif := CheckTermNotif()
- os_version_check := CheckMacOSVersion()
-
- if term_notif == true {
- // timeout set to 30 seconds, to show the importance of the notification
- return exec.Command("terminal-notifier", "-title", o.AppName, "-message", text, "-subtitle", title, "-timeout", "30")
- } else if os_version_check == true {
- notification := fmt.Sprintf("display notification \"%s\" with title \"%s\" subtitle \"%s\"", text, o.AppName, title)
- return exec.Command("osascript", "-e", notification)
- }
-
- return exec.Command("growlnotify", "-n", o.AppName, "--image", iconPath, "-m", title)
-
-}
-
-type linuxNotificator struct{}
-
-func (l linuxNotificator) push(title string, text string, iconPath string) *exec.Cmd {
- return exec.Command("notify-send", "-i", iconPath, title, text)
-}
-
-// Causes the notification to stick around until clicked.
-func (l linuxNotificator) pushCritical(title string, text string, iconPath string) *exec.Cmd {
- return exec.Command("notify-send", "-i", iconPath, title, text, "-u", "critical")
-}
-
-type windowsNotificator struct{}
-
-func (w windowsNotificator) push(title string, text string, iconPath string) *exec.Cmd {
- return exec.Command("growlnotify", "/i:", iconPath, "/t:", title, text)
-}
-
-// Causes the notification to stick around until clicked.
-func (w windowsNotificator) pushCritical(title string, text string, iconPath string) *exec.Cmd {
- return exec.Command("notify-send", "-i", iconPath, title, text, "/s", "true", "/p", "2")
-}
-
-func New(o Options) *Notificator {
-
- var Notifier notifier
-
- switch runtime.GOOS {
-
- case "darwin":
- Notifier = osxNotificator{AppName: o.AppName}
- case "linux":
- Notifier = linuxNotificator{}
- case "windows":
- Notifier = windowsNotificator{}
-
- }
-
- return &Notificator{notifier: Notifier, defaultIcon: o.DefaultIcon}
-}
-
-// Helper function for macOS
-
-func CheckTermNotif() bool {
- // Checks if terminal-notifier exists, and is accessible.
- if err := exec.Command("which", "terminal-notifier").Run(); err != nil {
- return false
- }
- // no error, so return true. (terminal-notifier exists)
- return true
-}
-
-func CheckMacOSVersion() bool {
- // Checks if the version of macOS is 10.9 or Higher (osascript support for notifications.)
-
- cmd := exec.Command("sw_vers", "-productVersion")
- check, _ := cmd.Output()
-
- version := strings.Split(strings.TrimSpace(string(check)), ".")
-
- // semantic versioning of macOS
-
- major, _ := strconv.Atoi(version[0])
- minor, _ := strconv.Atoi(version[1])
-
- if major < 10 {
- return false
- } else if major == 10 && minor < 9 {
- return false
- } else {
- return true
- }
-}
diff --git a/vendor/github.com/fatih/color/.travis.yml b/vendor/github.com/fatih/color/.travis.yml
deleted file mode 100644
index 57b4b57..0000000
--- a/vendor/github.com/fatih/color/.travis.yml
+++ /dev/null
@@ -1,5 +0,0 @@
-language: go
-go:
- - 1.6
- - tip
-
diff --git a/vendor/github.com/fatih/color/LICENSE.md b/vendor/github.com/fatih/color/LICENSE.md
deleted file mode 100644
index 25fdaf6..0000000
--- a/vendor/github.com/fatih/color/LICENSE.md
+++ /dev/null
@@ -1,20 +0,0 @@
-The MIT License (MIT)
-
-Copyright (c) 2013 Fatih Arslan
-
-Permission is hereby granted, free of charge, to any person obtaining a copy of
-this software and associated documentation files (the "Software"), to deal in
-the Software without restriction, including without limitation the rights to
-use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
-the Software, and to permit persons to whom the Software is furnished to do so,
-subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all
-copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
-FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
-COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
-IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
diff --git a/vendor/github.com/fatih/color/README.md b/vendor/github.com/fatih/color/README.md
deleted file mode 100644
index 623baf3..0000000
--- a/vendor/github.com/fatih/color/README.md
+++ /dev/null
@@ -1,177 +0,0 @@
-# Color [![GoDoc](http://img.shields.io/badge/go-documentation-blue.svg?style=flat-square)](http://godoc.org/github.com/fatih/color) [![Build Status](http://img.shields.io/travis/fatih/color.svg?style=flat-square)](https://travis-ci.org/fatih/color)
-
-
-
-Color lets you use colorized outputs in terms of [ANSI Escape
-Codes](http://en.wikipedia.org/wiki/ANSI_escape_code#Colors) in Go (Golang). It
-has support for Windows too! The API can be used in several ways, pick one that
-suits you.
-
-
-![Color](http://i.imgur.com/c1JI0lA.png)
-
-
-## Install
-
-```bash
-go get github.com/fatih/color
-```
-
-Note that the `vendor` folder is here for stability. Remove the folder if you
-already have the dependencies in your GOPATH.
-
-## Examples
-
-### Standard colors
-
-```go
-// Print with default helper functions
-color.Cyan("Prints text in cyan.")
-
-// A newline will be appended automatically
-color.Blue("Prints %s in blue.", "text")
-
-// These are using the default foreground colors
-color.Red("We have red")
-color.Magenta("And many others ..")
-
-```
-
-### Mix and reuse colors
-
-```go
-// Create a new color object
-c := color.New(color.FgCyan).Add(color.Underline)
-c.Println("Prints cyan text with an underline.")
-
-// Or just add them to New()
-d := color.New(color.FgCyan, color.Bold)
-d.Printf("This prints bold cyan %s\n", "too!.")
-
-// Mix up foreground and background colors, create new mixes!
-red := color.New(color.FgRed)
-
-boldRed := red.Add(color.Bold)
-boldRed.Println("This will print text in bold red.")
-
-whiteBackground := red.Add(color.BgWhite)
-whiteBackground.Println("Red text with white background.")
-```
-
-### Use your own output (io.Writer)
-
-```go
-// Use your own io.Writer output
-color.New(color.FgBlue).Fprintln(myWriter, "blue color!")
-
-blue := color.New(color.FgBlue)
-blue.Fprint(writer, "This will print text in blue.")
-```
-
-### Custom print functions (PrintFunc)
-
-```go
-// Create a custom print function for convenience
-red := color.New(color.FgRed).PrintfFunc()
-red("Warning")
-red("Error: %s", err)
-
-// Mix up multiple attributes
-notice := color.New(color.Bold, color.FgGreen).PrintlnFunc()
-notice("Don't forget this...")
-```
-
-### Custom fprint functions (FprintFunc)
-
-```go
-blue := color.New(FgBlue).FprintfFunc()
-blue(myWriter, "important notice: %s", stars)
-
-// Mix up with multiple attributes
-success := color.New(color.Bold, color.FgGreen).FprintlnFunc()
-success(myWriter, "Don't forget this...")
-```
-
-### Insert into noncolor strings (SprintFunc)
-
-```go
-// Create SprintXxx functions to mix strings with other non-colorized strings:
-yellow := color.New(color.FgYellow).SprintFunc()
-red := color.New(color.FgRed).SprintFunc()
-fmt.Printf("This is a %s and this is %s.\n", yellow("warning"), red("error"))
-
-info := color.New(color.FgWhite, color.BgGreen).SprintFunc()
-fmt.Printf("This %s rocks!\n", info("package"))
-
-// Use helper functions
-fmt.Println("This", color.RedString("warning"), "should be not neglected.")
-fmt.Printf("%v %v\n", color.GreenString("Info:"), "an important message.")
-
-// Windows supported too! Just don't forget to change the output to color.Output
-fmt.Fprintf(color.Output, "Windows support: %s", color.GreenString("PASS"))
-```
-
-### Plug into existing code
-
-```go
-// Use handy standard colors
-color.Set(color.FgYellow)
-
-fmt.Println("Existing text will now be in yellow")
-fmt.Printf("This one %s\n", "too")
-
-color.Unset() // Don't forget to unset
-
-// You can mix up parameters
-color.Set(color.FgMagenta, color.Bold)
-defer color.Unset() // Use it in your function
-
-fmt.Println("All text will now be bold magenta.")
-```
-
-### Disable color
-
-There might be a case where you want to disable color output (for example to
-pipe the standard output of your app to somewhere else). `Color` has support to
-disable colors both globally and for single color definition. For example
-suppose you have a CLI app and a `--no-color` bool flag. You can easily disable
-the color output with:
-
-```go
-
-var flagNoColor = flag.Bool("no-color", false, "Disable color output")
-
-if *flagNoColor {
- color.NoColor = true // disables colorized output
-}
-```
-
-It also has support for single color definitions (local). You can
-disable/enable color output on the fly:
-
-```go
-c := color.New(color.FgCyan)
-c.Println("Prints cyan text")
-
-c.DisableColor()
-c.Println("This is printed without any color")
-
-c.EnableColor()
-c.Println("This prints again cyan...")
-```
-
-## Todo
-
-* Save/Return previous values
-* Evaluate fmt.Formatter interface
-
-
-## Credits
-
- * [Fatih Arslan](https://github.com/fatih)
- * Windows support via @mattn: [colorable](https://github.com/mattn/go-colorable)
-
-## License
-
-The MIT License (MIT) - see [`LICENSE.md`](https://github.com/fatih/color/blob/master/LICENSE.md) for more details
-
diff --git a/vendor/github.com/fatih/color/color.go b/vendor/github.com/fatih/color/color.go
deleted file mode 100644
index 7b5f314..0000000
--- a/vendor/github.com/fatih/color/color.go
+++ /dev/null
@@ -1,600 +0,0 @@
-package color
-
-import (
- "fmt"
- "io"
- "os"
- "strconv"
- "strings"
- "sync"
-
- "github.com/mattn/go-colorable"
- "github.com/mattn/go-isatty"
-)
-
-var (
- // NoColor defines if the output is colorized or not. It's dynamically set to
- // false or true based on the stdout's file descriptor referring to a terminal
- // or not. This is a global option and affects all colors. For more control
- // over each color block use the methods DisableColor() individually.
- NoColor = os.Getenv("TERM") == "dumb" ||
- (!isatty.IsTerminal(os.Stdout.Fd()) && !isatty.IsCygwinTerminal(os.Stdout.Fd()))
-
- // Output defines the standard output of the print functions. By default
- // os.Stdout is used.
- Output = colorable.NewColorableStdout()
-
- // colorsCache is used to reduce the count of created Color objects and
- // allows to reuse already created objects with required Attribute.
- colorsCache = make(map[Attribute]*Color)
- colorsCacheMu sync.Mutex // protects colorsCache
-)
-
-// Color defines a custom color object which is defined by SGR parameters.
-type Color struct {
- params []Attribute
- noColor *bool
-}
-
-// Attribute defines a single SGR Code
-type Attribute int
-
-const escape = "\x1b"
-
-// Base attributes
-const (
- Reset Attribute = iota
- Bold
- Faint
- Italic
- Underline
- BlinkSlow
- BlinkRapid
- ReverseVideo
- Concealed
- CrossedOut
-)
-
-// Foreground text colors
-const (
- FgBlack Attribute = iota + 30
- FgRed
- FgGreen
- FgYellow
- FgBlue
- FgMagenta
- FgCyan
- FgWhite
-)
-
-// Foreground Hi-Intensity text colors
-const (
- FgHiBlack Attribute = iota + 90
- FgHiRed
- FgHiGreen
- FgHiYellow
- FgHiBlue
- FgHiMagenta
- FgHiCyan
- FgHiWhite
-)
-
-// Background text colors
-const (
- BgBlack Attribute = iota + 40
- BgRed
- BgGreen
- BgYellow
- BgBlue
- BgMagenta
- BgCyan
- BgWhite
-)
-
-// Background Hi-Intensity text colors
-const (
- BgHiBlack Attribute = iota + 100
- BgHiRed
- BgHiGreen
- BgHiYellow
- BgHiBlue
- BgHiMagenta
- BgHiCyan
- BgHiWhite
-)
-
-// New returns a newly created color object.
-func New(value ...Attribute) *Color {
- c := &Color{params: make([]Attribute, 0)}
- c.Add(value...)
- return c
-}
-
-// Set sets the given parameters immediately. It will change the color of
-// output with the given SGR parameters until color.Unset() is called.
-func Set(p ...Attribute) *Color {
- c := New(p...)
- c.Set()
- return c
-}
-
-// Unset resets all escape attributes and clears the output. Usually should
-// be called after Set().
-func Unset() {
- if NoColor {
- return
- }
-
- fmt.Fprintf(Output, "%s[%dm", escape, Reset)
-}
-
-// Set sets the SGR sequence.
-func (c *Color) Set() *Color {
- if c.isNoColorSet() {
- return c
- }
-
- fmt.Fprintf(Output, c.format())
- return c
-}
-
-func (c *Color) unset() {
- if c.isNoColorSet() {
- return
- }
-
- Unset()
-}
-
-func (c *Color) setWriter(w io.Writer) *Color {
- if c.isNoColorSet() {
- return c
- }
-
- fmt.Fprintf(w, c.format())
- return c
-}
-
-func (c *Color) unsetWriter(w io.Writer) {
- if c.isNoColorSet() {
- return
- }
-
- if NoColor {
- return
- }
-
- fmt.Fprintf(w, "%s[%dm", escape, Reset)
-}
-
-// Add is used to chain SGR parameters. Use as many as parameters to combine
-// and create custom color objects. Example: Add(color.FgRed, color.Underline).
-func (c *Color) Add(value ...Attribute) *Color {
- c.params = append(c.params, value...)
- return c
-}
-
-func (c *Color) prepend(value Attribute) {
- c.params = append(c.params, 0)
- copy(c.params[1:], c.params[0:])
- c.params[0] = value
-}
-
-// Fprint formats using the default formats for its operands and writes to w.
-// Spaces are added between operands when neither is a string.
-// It returns the number of bytes written and any write error encountered.
-// On Windows, users should wrap w with colorable.NewColorable() if w is of
-// type *os.File.
-func (c *Color) Fprint(w io.Writer, a ...interface{}) (n int, err error) {
- c.setWriter(w)
- defer c.unsetWriter(w)
-
- return fmt.Fprint(w, a...)
-}
-
-// Print formats using the default formats for its operands and writes to
-// standard output. Spaces are added between operands when neither is a
-// string. It returns the number of bytes written and any write error
-// encountered. This is the standard fmt.Print() method wrapped with the given
-// color.
-func (c *Color) Print(a ...interface{}) (n int, err error) {
- c.Set()
- defer c.unset()
-
- return fmt.Fprint(Output, a...)
-}
-
-// Fprintf formats according to a format specifier and writes to w.
-// It returns the number of bytes written and any write error encountered.
-// On Windows, users should wrap w with colorable.NewColorable() if w is of
-// type *os.File.
-func (c *Color) Fprintf(w io.Writer, format string, a ...interface{}) (n int, err error) {
- c.setWriter(w)
- defer c.unsetWriter(w)
-
- return fmt.Fprintf(w, format, a...)
-}
-
-// Printf formats according to a format specifier and writes to standard output.
-// It returns the number of bytes written and any write error encountered.
-// This is the standard fmt.Printf() method wrapped with the given color.
-func (c *Color) Printf(format string, a ...interface{}) (n int, err error) {
- c.Set()
- defer c.unset()
-
- return fmt.Fprintf(Output, format, a...)
-}
-
-// Fprintln formats using the default formats for its operands and writes to w.
-// Spaces are always added between operands and a newline is appended.
-// On Windows, users should wrap w with colorable.NewColorable() if w is of
-// type *os.File.
-func (c *Color) Fprintln(w io.Writer, a ...interface{}) (n int, err error) {
- c.setWriter(w)
- defer c.unsetWriter(w)
-
- return fmt.Fprintln(w, a...)
-}
-
-// Println formats using the default formats for its operands and writes to
-// standard output. Spaces are always added between operands and a newline is
-// appended. It returns the number of bytes written and any write error
-// encountered. This is the standard fmt.Print() method wrapped with the given
-// color.
-func (c *Color) Println(a ...interface{}) (n int, err error) {
- c.Set()
- defer c.unset()
-
- return fmt.Fprintln(Output, a...)
-}
-
-// Sprint is just like Print, but returns a string instead of printing it.
-func (c *Color) Sprint(a ...interface{}) string {
- return c.wrap(fmt.Sprint(a...))
-}
-
-// Sprintln is just like Println, but returns a string instead of printing it.
-func (c *Color) Sprintln(a ...interface{}) string {
- return c.wrap(fmt.Sprintln(a...))
-}
-
-// Sprintf is just like Printf, but returns a string instead of printing it.
-func (c *Color) Sprintf(format string, a ...interface{}) string {
- return c.wrap(fmt.Sprintf(format, a...))
-}
-
-// FprintFunc returns a new function that prints the passed arguments as
-// colorized with color.Fprint().
-func (c *Color) FprintFunc() func(w io.Writer, a ...interface{}) {
- return func(w io.Writer, a ...interface{}) {
- c.Fprint(w, a...)
- }
-}
-
-// PrintFunc returns a new function that prints the passed arguments as
-// colorized with color.Print().
-func (c *Color) PrintFunc() func(a ...interface{}) {
- return func(a ...interface{}) {
- c.Print(a...)
- }
-}
-
-// FprintfFunc returns a new function that prints the passed arguments as
-// colorized with color.Fprintf().
-func (c *Color) FprintfFunc() func(w io.Writer, format string, a ...interface{}) {
- return func(w io.Writer, format string, a ...interface{}) {
- c.Fprintf(w, format, a...)
- }
-}
-
-// PrintfFunc returns a new function that prints the passed arguments as
-// colorized with color.Printf().
-func (c *Color) PrintfFunc() func(format string, a ...interface{}) {
- return func(format string, a ...interface{}) {
- c.Printf(format, a...)
- }
-}
-
-// FprintlnFunc returns a new function that prints the passed arguments as
-// colorized with color.Fprintln().
-func (c *Color) FprintlnFunc() func(w io.Writer, a ...interface{}) {
- return func(w io.Writer, a ...interface{}) {
- c.Fprintln(w, a...)
- }
-}
-
-// PrintlnFunc returns a new function that prints the passed arguments as
-// colorized with color.Println().
-func (c *Color) PrintlnFunc() func(a ...interface{}) {
- return func(a ...interface{}) {
- c.Println(a...)
- }
-}
-
-// SprintFunc returns a new function that returns colorized strings for the
-// given arguments with fmt.Sprint(). Useful to put into or mix into other
-// string. Windows users should use this in conjunction with color.Output, example:
-//
-// put := New(FgYellow).SprintFunc()
-// fmt.Fprintf(color.Output, "This is a %s", put("warning"))
-func (c *Color) SprintFunc() func(a ...interface{}) string {
- return func(a ...interface{}) string {
- return c.wrap(fmt.Sprint(a...))
- }
-}
-
-// SprintfFunc returns a new function that returns colorized strings for the
-// given arguments with fmt.Sprintf(). Useful to put into or mix into other
-// string. Windows users should use this in conjunction with color.Output.
-func (c *Color) SprintfFunc() func(format string, a ...interface{}) string {
- return func(format string, a ...interface{}) string {
- return c.wrap(fmt.Sprintf(format, a...))
- }
-}
-
-// SprintlnFunc returns a new function that returns colorized strings for the
-// given arguments with fmt.Sprintln(). Useful to put into or mix into other
-// string. Windows users should use this in conjunction with color.Output.
-func (c *Color) SprintlnFunc() func(a ...interface{}) string {
- return func(a ...interface{}) string {
- return c.wrap(fmt.Sprintln(a...))
- }
-}
-
-// sequence returns a formated SGR sequence to be plugged into a "\x1b[...m"
-// an example output might be: "1;36" -> bold cyan
-func (c *Color) sequence() string {
- format := make([]string, len(c.params))
- for i, v := range c.params {
- format[i] = strconv.Itoa(int(v))
- }
-
- return strings.Join(format, ";")
-}
-
-// wrap wraps the s string with the colors attributes. The string is ready to
-// be printed.
-func (c *Color) wrap(s string) string {
- if c.isNoColorSet() {
- return s
- }
-
- return c.format() + s + c.unformat()
-}
-
-func (c *Color) format() string {
- return fmt.Sprintf("%s[%sm", escape, c.sequence())
-}
-
-func (c *Color) unformat() string {
- return fmt.Sprintf("%s[%dm", escape, Reset)
-}
-
-// DisableColor disables the color output. Useful to not change any existing
-// code and still being able to output. Can be used for flags like
-// "--no-color". To enable back use EnableColor() method.
-func (c *Color) DisableColor() {
- c.noColor = boolPtr(true)
-}
-
-// EnableColor enables the color output. Use it in conjunction with
-// DisableColor(). Otherwise this method has no side effects.
-func (c *Color) EnableColor() {
- c.noColor = boolPtr(false)
-}
-
-func (c *Color) isNoColorSet() bool {
- // check first if we have user setted action
- if c.noColor != nil {
- return *c.noColor
- }
-
- // if not return the global option, which is disabled by default
- return NoColor
-}
-
-// Equals returns a boolean value indicating whether two colors are equal.
-func (c *Color) Equals(c2 *Color) bool {
- if len(c.params) != len(c2.params) {
- return false
- }
-
- for _, attr := range c.params {
- if !c2.attrExists(attr) {
- return false
- }
- }
-
- return true
-}
-
-func (c *Color) attrExists(a Attribute) bool {
- for _, attr := range c.params {
- if attr == a {
- return true
- }
- }
-
- return false
-}
-
-func boolPtr(v bool) *bool {
- return &v
-}
-
-func getCachedColor(p Attribute) *Color {
- colorsCacheMu.Lock()
- defer colorsCacheMu.Unlock()
-
- c, ok := colorsCache[p]
- if !ok {
- c = New(p)
- colorsCache[p] = c
- }
-
- return c
-}
-
-func colorPrint(format string, p Attribute, a ...interface{}) {
- c := getCachedColor(p)
-
- if !strings.HasSuffix(format, "\n") {
- format += "\n"
- }
-
- if len(a) == 0 {
- c.Print(format)
- } else {
- c.Printf(format, a...)
- }
-}
-
-func colorString(format string, p Attribute, a ...interface{}) string {
- c := getCachedColor(p)
-
- if len(a) == 0 {
- return c.SprintFunc()(format)
- }
-
- return c.SprintfFunc()(format, a...)
-}
-
-// Black is a convenient helper function to print with black foreground. A
-// newline is appended to format by default.
-func Black(format string, a ...interface{}) { colorPrint(format, FgBlack, a...) }
-
-// Red is a convenient helper function to print with red foreground. A
-// newline is appended to format by default.
-func Red(format string, a ...interface{}) { colorPrint(format, FgRed, a...) }
-
-// Green is a convenient helper function to print with green foreground. A
-// newline is appended to format by default.
-func Green(format string, a ...interface{}) { colorPrint(format, FgGreen, a...) }
-
-// Yellow is a convenient helper function to print with yellow foreground.
-// A newline is appended to format by default.
-func Yellow(format string, a ...interface{}) { colorPrint(format, FgYellow, a...) }
-
-// Blue is a convenient helper function to print with blue foreground. A
-// newline is appended to format by default.
-func Blue(format string, a ...interface{}) { colorPrint(format, FgBlue, a...) }
-
-// Magenta is a convenient helper function to print with magenta foreground.
-// A newline is appended to format by default.
-func Magenta(format string, a ...interface{}) { colorPrint(format, FgMagenta, a...) }
-
-// Cyan is a convenient helper function to print with cyan foreground. A
-// newline is appended to format by default.
-func Cyan(format string, a ...interface{}) { colorPrint(format, FgCyan, a...) }
-
-// White is a convenient helper function to print with white foreground. A
-// newline is appended to format by default.
-func White(format string, a ...interface{}) { colorPrint(format, FgWhite, a...) }
-
-// BlackString is a convenient helper function to return a string with black
-// foreground.
-func BlackString(format string, a ...interface{}) string { return colorString(format, FgBlack, a...) }
-
-// RedString is a convenient helper function to return a string with red
-// foreground.
-func RedString(format string, a ...interface{}) string { return colorString(format, FgRed, a...) }
-
-// GreenString is a convenient helper function to return a string with green
-// foreground.
-func GreenString(format string, a ...interface{}) string { return colorString(format, FgGreen, a...) }
-
-// YellowString is a convenient helper function to return a string with yellow
-// foreground.
-func YellowString(format string, a ...interface{}) string { return colorString(format, FgYellow, a...) }
-
-// BlueString is a convenient helper function to return a string with blue
-// foreground.
-func BlueString(format string, a ...interface{}) string { return colorString(format, FgBlue, a...) }
-
-// MagentaString is a convenient helper function to return a string with magenta
-// foreground.
-func MagentaString(format string, a ...interface{}) string {
- return colorString(format, FgMagenta, a...)
-}
-
-// CyanString is a convenient helper function to return a string with cyan
-// foreground.
-func CyanString(format string, a ...interface{}) string { return colorString(format, FgCyan, a...) }
-
-// WhiteString is a convenient helper function to return a string with white
-// foreground.
-func WhiteString(format string, a ...interface{}) string { return colorString(format, FgWhite, a...) }
-
-// HiBlack is a convenient helper function to print with hi-intensity black foreground. A
-// newline is appended to format by default.
-func HiBlack(format string, a ...interface{}) { colorPrint(format, FgHiBlack, a...) }
-
-// HiRed is a convenient helper function to print with hi-intensity red foreground. A
-// newline is appended to format by default.
-func HiRed(format string, a ...interface{}) { colorPrint(format, FgHiRed, a...) }
-
-// HiGreen is a convenient helper function to print with hi-intensity green foreground. A
-// newline is appended to format by default.
-func HiGreen(format string, a ...interface{}) { colorPrint(format, FgHiGreen, a...) }
-
-// HiYellow is a convenient helper function to print with hi-intensity yellow foreground.
-// A newline is appended to format by default.
-func HiYellow(format string, a ...interface{}) { colorPrint(format, FgHiYellow, a...) }
-
-// HiBlue is a convenient helper function to print with hi-intensity blue foreground. A
-// newline is appended to format by default.
-func HiBlue(format string, a ...interface{}) { colorPrint(format, FgHiBlue, a...) }
-
-// HiMagenta is a convenient helper function to print with hi-intensity magenta foreground.
-// A newline is appended to format by default.
-func HiMagenta(format string, a ...interface{}) { colorPrint(format, FgHiMagenta, a...) }
-
-// HiCyan is a convenient helper function to print with hi-intensity cyan foreground. A
-// newline is appended to format by default.
-func HiCyan(format string, a ...interface{}) { colorPrint(format, FgHiCyan, a...) }
-
-// HiWhite is a convenient helper function to print with hi-intensity white foreground. A
-// newline is appended to format by default.
-func HiWhite(format string, a ...interface{}) { colorPrint(format, FgHiWhite, a...) }
-
-// HiBlackString is a convenient helper function to return a string with hi-intensity black
-// foreground.
-func HiBlackString(format string, a ...interface{}) string {
- return colorString(format, FgHiBlack, a...)
-}
-
-// HiRedString is a convenient helper function to return a string with hi-intensity red
-// foreground.
-func HiRedString(format string, a ...interface{}) string { return colorString(format, FgHiRed, a...) }
-
-// HiGreenString is a convenient helper function to return a string with hi-intensity green
-// foreground.
-func HiGreenString(format string, a ...interface{}) string {
- return colorString(format, FgHiGreen, a...)
-}
-
-// HiYellowString is a convenient helper function to return a string with hi-intensity yellow
-// foreground.
-func HiYellowString(format string, a ...interface{}) string {
- return colorString(format, FgHiYellow, a...)
-}
-
-// HiBlueString is a convenient helper function to return a string with hi-intensity blue
-// foreground.
-func HiBlueString(format string, a ...interface{}) string { return colorString(format, FgHiBlue, a...) }
-
-// HiMagentaString is a convenient helper function to return a string with hi-intensity magenta
-// foreground.
-func HiMagentaString(format string, a ...interface{}) string {
- return colorString(format, FgHiMagenta, a...)
-}
-
-// HiCyanString is a convenient helper function to return a string with hi-intensity cyan
-// foreground.
-func HiCyanString(format string, a ...interface{}) string { return colorString(format, FgHiCyan, a...) }
-
-// HiWhiteString is a convenient helper function to return a string with hi-intensity white
-// foreground.
-func HiWhiteString(format string, a ...interface{}) string {
- return colorString(format, FgHiWhite, a...)
-}
diff --git a/vendor/github.com/fatih/color/color_test.go b/vendor/github.com/fatih/color/color_test.go
deleted file mode 100644
index a8ed14f..0000000
--- a/vendor/github.com/fatih/color/color_test.go
+++ /dev/null
@@ -1,342 +0,0 @@
-package color
-
-import (
- "bytes"
- "fmt"
- "os"
- "testing"
-
- "github.com/mattn/go-colorable"
-)
-
-// Testing colors is kinda different. First we test for given colors and their
-// escaped formatted results. Next we create some visual tests to be tested.
-// Each visual test includes the color name to be compared.
-func TestColor(t *testing.T) {
- rb := new(bytes.Buffer)
- Output = rb
-
- NoColor = false
-
- testColors := []struct {
- text string
- code Attribute
- }{
- {text: "black", code: FgBlack},
- {text: "red", code: FgRed},
- {text: "green", code: FgGreen},
- {text: "yellow", code: FgYellow},
- {text: "blue", code: FgBlue},
- {text: "magent", code: FgMagenta},
- {text: "cyan", code: FgCyan},
- {text: "white", code: FgWhite},
- {text: "hblack", code: FgHiBlack},
- {text: "hred", code: FgHiRed},
- {text: "hgreen", code: FgHiGreen},
- {text: "hyellow", code: FgHiYellow},
- {text: "hblue", code: FgHiBlue},
- {text: "hmagent", code: FgHiMagenta},
- {text: "hcyan", code: FgHiCyan},
- {text: "hwhite", code: FgHiWhite},
- }
-
- for _, c := range testColors {
- New(c.code).Print(c.text)
-
- line, _ := rb.ReadString('\n')
- scannedLine := fmt.Sprintf("%q", line)
- colored := fmt.Sprintf("\x1b[%dm%s\x1b[0m", c.code, c.text)
- escapedForm := fmt.Sprintf("%q", colored)
-
- fmt.Printf("%s\t: %s\n", c.text, line)
-
- if scannedLine != escapedForm {
- t.Errorf("Expecting %s, got '%s'\n", escapedForm, scannedLine)
- }
- }
-
- for _, c := range testColors {
- line := New(c.code).Sprintf("%s", c.text)
- scannedLine := fmt.Sprintf("%q", line)
- colored := fmt.Sprintf("\x1b[%dm%s\x1b[0m", c.code, c.text)
- escapedForm := fmt.Sprintf("%q", colored)
-
- fmt.Printf("%s\t: %s\n", c.text, line)
-
- if scannedLine != escapedForm {
- t.Errorf("Expecting %s, got '%s'\n", escapedForm, scannedLine)
- }
- }
-}
-
-func TestColorEquals(t *testing.T) {
- fgblack1 := New(FgBlack)
- fgblack2 := New(FgBlack)
- bgblack := New(BgBlack)
- fgbgblack := New(FgBlack, BgBlack)
- fgblackbgred := New(FgBlack, BgRed)
- fgred := New(FgRed)
- bgred := New(BgRed)
-
- if !fgblack1.Equals(fgblack2) {
- t.Error("Two black colors are not equal")
- }
-
- if fgblack1.Equals(bgblack) {
- t.Error("Fg and bg black colors are equal")
- }
-
- if fgblack1.Equals(fgbgblack) {
- t.Error("Fg black equals fg/bg black color")
- }
-
- if fgblack1.Equals(fgred) {
- t.Error("Fg black equals Fg red")
- }
-
- if fgblack1.Equals(bgred) {
- t.Error("Fg black equals Bg red")
- }
-
- if fgblack1.Equals(fgblackbgred) {
- t.Error("Fg black equals fg black bg red")
- }
-}
-
-func TestNoColor(t *testing.T) {
- rb := new(bytes.Buffer)
- Output = rb
-
- testColors := []struct {
- text string
- code Attribute
- }{
- {text: "black", code: FgBlack},
- {text: "red", code: FgRed},
- {text: "green", code: FgGreen},
- {text: "yellow", code: FgYellow},
- {text: "blue", code: FgBlue},
- {text: "magent", code: FgMagenta},
- {text: "cyan", code: FgCyan},
- {text: "white", code: FgWhite},
- {text: "hblack", code: FgHiBlack},
- {text: "hred", code: FgHiRed},
- {text: "hgreen", code: FgHiGreen},
- {text: "hyellow", code: FgHiYellow},
- {text: "hblue", code: FgHiBlue},
- {text: "hmagent", code: FgHiMagenta},
- {text: "hcyan", code: FgHiCyan},
- {text: "hwhite", code: FgHiWhite},
- }
-
- for _, c := range testColors {
- p := New(c.code)
- p.DisableColor()
- p.Print(c.text)
-
- line, _ := rb.ReadString('\n')
- if line != c.text {
- t.Errorf("Expecting %s, got '%s'\n", c.text, line)
- }
- }
-
- // global check
- NoColor = true
- defer func() {
- NoColor = false
- }()
- for _, c := range testColors {
- p := New(c.code)
- p.Print(c.text)
-
- line, _ := rb.ReadString('\n')
- if line != c.text {
- t.Errorf("Expecting %s, got '%s'\n", c.text, line)
- }
- }
-
-}
-
-func TestColorVisual(t *testing.T) {
- // First Visual Test
- Output = colorable.NewColorableStdout()
-
- New(FgRed).Printf("red\t")
- New(BgRed).Print(" ")
- New(FgRed, Bold).Println(" red")
-
- New(FgGreen).Printf("green\t")
- New(BgGreen).Print(" ")
- New(FgGreen, Bold).Println(" green")
-
- New(FgYellow).Printf("yellow\t")
- New(BgYellow).Print(" ")
- New(FgYellow, Bold).Println(" yellow")
-
- New(FgBlue).Printf("blue\t")
- New(BgBlue).Print(" ")
- New(FgBlue, Bold).Println(" blue")
-
- New(FgMagenta).Printf("magenta\t")
- New(BgMagenta).Print(" ")
- New(FgMagenta, Bold).Println(" magenta")
-
- New(FgCyan).Printf("cyan\t")
- New(BgCyan).Print(" ")
- New(FgCyan, Bold).Println(" cyan")
-
- New(FgWhite).Printf("white\t")
- New(BgWhite).Print(" ")
- New(FgWhite, Bold).Println(" white")
- fmt.Println("")
-
- // Second Visual test
- Black("black")
- Red("red")
- Green("green")
- Yellow("yellow")
- Blue("blue")
- Magenta("magenta")
- Cyan("cyan")
- White("white")
- HiBlack("hblack")
- HiRed("hred")
- HiGreen("hgreen")
- HiYellow("hyellow")
- HiBlue("hblue")
- HiMagenta("hmagenta")
- HiCyan("hcyan")
- HiWhite("hwhite")
-
- // Third visual test
- fmt.Println()
- Set(FgBlue)
- fmt.Println("is this blue?")
- Unset()
-
- Set(FgMagenta)
- fmt.Println("and this magenta?")
- Unset()
-
- // Fourth Visual test
- fmt.Println()
- blue := New(FgBlue).PrintlnFunc()
- blue("blue text with custom print func")
-
- red := New(FgRed).PrintfFunc()
- red("red text with a printf func: %d\n", 123)
-
- put := New(FgYellow).SprintFunc()
- warn := New(FgRed).SprintFunc()
-
- fmt.Fprintf(Output, "this is a %s and this is %s.\n", put("warning"), warn("error"))
-
- info := New(FgWhite, BgGreen).SprintFunc()
- fmt.Fprintf(Output, "this %s rocks!\n", info("package"))
-
- notice := New(FgBlue).FprintFunc()
- notice(os.Stderr, "just a blue notice to stderr")
-
- // Fifth Visual Test
- fmt.Println()
-
- fmt.Fprintln(Output, BlackString("black"))
- fmt.Fprintln(Output, RedString("red"))
- fmt.Fprintln(Output, GreenString("green"))
- fmt.Fprintln(Output, YellowString("yellow"))
- fmt.Fprintln(Output, BlueString("blue"))
- fmt.Fprintln(Output, MagentaString("magenta"))
- fmt.Fprintln(Output, CyanString("cyan"))
- fmt.Fprintln(Output, WhiteString("white"))
- fmt.Fprintln(Output, HiBlackString("hblack"))
- fmt.Fprintln(Output, HiRedString("hred"))
- fmt.Fprintln(Output, HiGreenString("hgreen"))
- fmt.Fprintln(Output, HiYellowString("hyellow"))
- fmt.Fprintln(Output, HiBlueString("hblue"))
- fmt.Fprintln(Output, HiMagentaString("hmagenta"))
- fmt.Fprintln(Output, HiCyanString("hcyan"))
- fmt.Fprintln(Output, HiWhiteString("hwhite"))
-}
-
-func TestNoFormat(t *testing.T) {
- fmt.Printf("%s %%s = ", BlackString("Black"))
- Black("%s")
-
- fmt.Printf("%s %%s = ", RedString("Red"))
- Red("%s")
-
- fmt.Printf("%s %%s = ", GreenString("Green"))
- Green("%s")
-
- fmt.Printf("%s %%s = ", YellowString("Yellow"))
- Yellow("%s")
-
- fmt.Printf("%s %%s = ", BlueString("Blue"))
- Blue("%s")
-
- fmt.Printf("%s %%s = ", MagentaString("Magenta"))
- Magenta("%s")
-
- fmt.Printf("%s %%s = ", CyanString("Cyan"))
- Cyan("%s")
-
- fmt.Printf("%s %%s = ", WhiteString("White"))
- White("%s")
-
- fmt.Printf("%s %%s = ", HiBlackString("HiBlack"))
- HiBlack("%s")
-
- fmt.Printf("%s %%s = ", HiRedString("HiRed"))
- HiRed("%s")
-
- fmt.Printf("%s %%s = ", HiGreenString("HiGreen"))
- HiGreen("%s")
-
- fmt.Printf("%s %%s = ", HiYellowString("HiYellow"))
- HiYellow("%s")
-
- fmt.Printf("%s %%s = ", HiBlueString("HiBlue"))
- HiBlue("%s")
-
- fmt.Printf("%s %%s = ", HiMagentaString("HiMagenta"))
- HiMagenta("%s")
-
- fmt.Printf("%s %%s = ", HiCyanString("HiCyan"))
- HiCyan("%s")
-
- fmt.Printf("%s %%s = ", HiWhiteString("HiWhite"))
- HiWhite("%s")
-}
-
-func TestNoFormatString(t *testing.T) {
- tests := []struct {
- f func(string, ...interface{}) string
- format string
- args []interface{}
- want string
- }{
- {BlackString, "%s", nil, "\x1b[30m%s\x1b[0m"},
- {RedString, "%s", nil, "\x1b[31m%s\x1b[0m"},
- {GreenString, "%s", nil, "\x1b[32m%s\x1b[0m"},
- {YellowString, "%s", nil, "\x1b[33m%s\x1b[0m"},
- {BlueString, "%s", nil, "\x1b[34m%s\x1b[0m"},
- {MagentaString, "%s", nil, "\x1b[35m%s\x1b[0m"},
- {CyanString, "%s", nil, "\x1b[36m%s\x1b[0m"},
- {WhiteString, "%s", nil, "\x1b[37m%s\x1b[0m"},
- {HiBlackString, "%s", nil, "\x1b[90m%s\x1b[0m"},
- {HiRedString, "%s", nil, "\x1b[91m%s\x1b[0m"},
- {HiGreenString, "%s", nil, "\x1b[92m%s\x1b[0m"},
- {HiYellowString, "%s", nil, "\x1b[93m%s\x1b[0m"},
- {HiBlueString, "%s", nil, "\x1b[94m%s\x1b[0m"},
- {HiMagentaString, "%s", nil, "\x1b[95m%s\x1b[0m"},
- {HiCyanString, "%s", nil, "\x1b[96m%s\x1b[0m"},
- {HiWhiteString, "%s", nil, "\x1b[97m%s\x1b[0m"},
- }
-
- for i, test := range tests {
- s := fmt.Sprintf("%s", test.f(test.format, test.args...))
- if s != test.want {
- t.Errorf("[%d] want: %q, got: %q", i, test.want, s)
- }
- }
-}
diff --git a/vendor/github.com/fatih/color/doc.go b/vendor/github.com/fatih/color/doc.go
deleted file mode 100644
index cf1e965..0000000
--- a/vendor/github.com/fatih/color/doc.go
+++ /dev/null
@@ -1,133 +0,0 @@
-/*
-Package color is an ANSI color package to output colorized or SGR defined
-output to the standard output. The API can be used in several way, pick one
-that suits you.
-
-Use simple and default helper functions with predefined foreground colors:
-
- color.Cyan("Prints text in cyan.")
-
- // a newline will be appended automatically
- color.Blue("Prints %s in blue.", "text")
-
- // More default foreground colors..
- color.Red("We have red")
- color.Yellow("Yellow color too!")
- color.Magenta("And many others ..")
-
- // Hi-intensity colors
- color.HiGreen("Bright green color.")
- color.HiBlack("Bright black means gray..")
- color.HiWhite("Shiny white color!")
-
-However there are times where custom color mixes are required. Below are some
-examples to create custom color objects and use the print functions of each
-separate color object.
-
- // Create a new color object
- c := color.New(color.FgCyan).Add(color.Underline)
- c.Println("Prints cyan text with an underline.")
-
- // Or just add them to New()
- d := color.New(color.FgCyan, color.Bold)
- d.Printf("This prints bold cyan %s\n", "too!.")
-
-
- // Mix up foreground and background colors, create new mixes!
- red := color.New(color.FgRed)
-
- boldRed := red.Add(color.Bold)
- boldRed.Println("This will print text in bold red.")
-
- whiteBackground := red.Add(color.BgWhite)
- whiteBackground.Println("Red text with White background.")
-
- // Use your own io.Writer output
- color.New(color.FgBlue).Fprintln(myWriter, "blue color!")
-
- blue := color.New(color.FgBlue)
- blue.Fprint(myWriter, "This will print text in blue.")
-
-You can create PrintXxx functions to simplify even more:
-
- // Create a custom print function for convenient
- red := color.New(color.FgRed).PrintfFunc()
- red("warning")
- red("error: %s", err)
-
- // Mix up multiple attributes
- notice := color.New(color.Bold, color.FgGreen).PrintlnFunc()
- notice("don't forget this...")
-
-You can also FprintXxx functions to pass your own io.Writer:
-
- blue := color.New(FgBlue).FprintfFunc()
- blue(myWriter, "important notice: %s", stars)
-
- // Mix up with multiple attributes
- success := color.New(color.Bold, color.FgGreen).FprintlnFunc()
- success(myWriter, don't forget this...")
-
-
-Or create SprintXxx functions to mix strings with other non-colorized strings:
-
- yellow := New(FgYellow).SprintFunc()
- red := New(FgRed).SprintFunc()
-
- fmt.Printf("this is a %s and this is %s.\n", yellow("warning"), red("error"))
-
- info := New(FgWhite, BgGreen).SprintFunc()
- fmt.Printf("this %s rocks!\n", info("package"))
-
-Windows support is enabled by default. All Print functions work as intended.
-However only for color.SprintXXX functions, user should use fmt.FprintXXX and
-set the output to color.Output:
-
- fmt.Fprintf(color.Output, "Windows support: %s", color.GreenString("PASS"))
-
- info := New(FgWhite, BgGreen).SprintFunc()
- fmt.Fprintf(color.Output, "this %s rocks!\n", info("package"))
-
-Using with existing code is possible. Just use the Set() method to set the
-standard output to the given parameters. That way a rewrite of an existing
-code is not required.
-
- // Use handy standard colors.
- color.Set(color.FgYellow)
-
- fmt.Println("Existing text will be now in Yellow")
- fmt.Printf("This one %s\n", "too")
-
- color.Unset() // don't forget to unset
-
- // You can mix up parameters
- color.Set(color.FgMagenta, color.Bold)
- defer color.Unset() // use it in your function
-
- fmt.Println("All text will be now bold magenta.")
-
-There might be a case where you want to disable color output (for example to
-pipe the standard output of your app to somewhere else). `Color` has support to
-disable colors both globally and for single color definition. For example
-suppose you have a CLI app and a `--no-color` bool flag. You can easily disable
-the color output with:
-
- var flagNoColor = flag.Bool("no-color", false, "Disable color output")
-
- if *flagNoColor {
- color.NoColor = true // disables colorized output
- }
-
-It also has support for single color definitions (local). You can
-disable/enable color output on the fly:
-
- c := color.New(color.FgCyan)
- c.Println("Prints cyan text")
-
- c.DisableColor()
- c.Println("This is printed without any color")
-
- c.EnableColor()
- c.Println("This prints again cyan...")
-*/
-package color
diff --git a/vendor/github.com/gizak/termui/.gitignore b/vendor/github.com/gizak/termui/.gitignore
deleted file mode 100644
index 8b156b0..0000000
--- a/vendor/github.com/gizak/termui/.gitignore
+++ /dev/null
@@ -1,26 +0,0 @@
-# Compiled Object files, Static and Dynamic libs (Shared Objects)
-*.o
-*.a
-*.so
-
-# Folders
-_obj
-_test
-
-# Architecture specific extensions/prefixes
-*.[568vq]
-[568vq].out
-
-*.cgo1.go
-*.cgo2.c
-_cgo_defun.c
-_cgo_gotypes.go
-_cgo_export.*
-
-_testmain.go
-
-*.exe
-*.test
-*.prof
-.DS_Store
-/vendor
diff --git a/vendor/github.com/gizak/termui/.travis.yml b/vendor/github.com/gizak/termui/.travis.yml
deleted file mode 100644
index 206e887..0000000
--- a/vendor/github.com/gizak/termui/.travis.yml
+++ /dev/null
@@ -1,6 +0,0 @@
-language: go
-
-go:
- - tip
-
-script: go test -v ./
\ No newline at end of file
diff --git a/vendor/github.com/gizak/termui/LICENSE b/vendor/github.com/gizak/termui/LICENSE
deleted file mode 100644
index 311ccc7..0000000
--- a/vendor/github.com/gizak/termui/LICENSE
+++ /dev/null
@@ -1,22 +0,0 @@
-The MIT License (MIT)
-
-Copyright (c) 2015 Zack Guo
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all
-copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-SOFTWARE.
-
diff --git a/vendor/github.com/gizak/termui/README.md b/vendor/github.com/gizak/termui/README.md
deleted file mode 100644
index d5f3d9a..0000000
--- a/vendor/github.com/gizak/termui/README.md
+++ /dev/null
@@ -1,151 +0,0 @@
-# termui [![Build Status](https://travis-ci.org/gizak/termui.svg?branch=master)](https://travis-ci.org/gizak/termui) [![Doc Status](https://godoc.org/github.com/gizak/termui?status.png)](https://godoc.org/github.com/gizak/termui)
-
-
-
-`termui` is a cross-platform, easy-to-compile, and fully-customizable terminal dashboard. It is inspired by [blessed-contrib](https://github.com/yaronn/blessed-contrib), but purely in Go.
-
-Now version v2 has arrived! It brings new event system, new theme system, new `Buffer` interface and specific colour text rendering. (some docs are missing, but it will be completed soon!)
-
-## Installation
-
-`master` mirrors v2 branch, to install:
-
- go get -u github.com/gizak/termui
-
-It is recommanded to use locked deps by using [glide](https://glide.sh): move to `termui` src directory then run `glide up`.
-
-For the compatible reason, you can choose to install the legacy version of `termui`:
-
- go get gopkg.in/gizak/termui.v1
-
-## Usage
-
-### Layout
-
-To use `termui`, the very first thing you may want to know is how to manage layout. `termui` offers two ways of doing this, known as absolute layout and grid layout.
-
-__Absolute layout__
-
-Each widget has an underlying block structure which basically is a box model. It has border, label and padding properties. A border of a widget can be chosen to hide or display (with its border label), you can pick a different front/back colour for the border as well. To display such a widget at a specific location in terminal window, you need to assign `.X`, `.Y`, `.Height`, `.Width` values for each widget before sending it to `.Render`. Let's demonstrate these by a code snippet:
-
-`````go
- import ui "github.com/gizak/termui" // <- ui shortcut, optional
-
- func main() {
- err := ui.Init()
- if err != nil {
- panic(err)
- }
- defer ui.Close()
-
- p := ui.NewPar(":PRESS q TO QUIT DEMO")
- p.Height = 3
- p.Width = 50
- p.TextFgColor = ui.ColorWhite
- p.BorderLabel = "Text Box"
- p.BorderFg = ui.ColorCyan
-
- g := ui.NewGauge()
- g.Percent = 50
- g.Width = 50
- g.Height = 3
- g.Y = 11
- g.BorderLabel = "Gauge"
- g.BarColor = ui.ColorRed
- g.BorderFg = ui.ColorWhite
- g.BorderLabelFg = ui.ColorCyan
-
- ui.Render(p, g) // feel free to call Render, it's async and non-block
-
- // event handler...
- }
-`````
-
-Note that components can be overlapped (I'd rather call this a feature...), `Render(rs ...Renderer)` renders its args from left to right (i.e. each component's weight is arising from left to right).
-
-__Grid layout:__
-
-
-
-Grid layout uses [12 columns grid system](http://www.w3schools.com/bootstrap/bootstrap_grid_system.asp) with expressive syntax. To use `Grid`, all we need to do is build a widget tree consisting of `Row`s and `Col`s (Actually a `Col` is also a `Row` but with a widget endpoint attached).
-
-```go
- import ui "github.com/gizak/termui"
- // init and create widgets...
-
- // build
- ui.Body.AddRows(
- ui.NewRow(
- ui.NewCol(6, 0, widget0),
- ui.NewCol(6, 0, widget1)),
- ui.NewRow(
- ui.NewCol(3, 0, widget2),
- ui.NewCol(3, 0, widget30, widget31, widget32),
- ui.NewCol(6, 0, widget4)))
-
- // calculate layout
- ui.Body.Align()
-
- ui.Render(ui.Body)
-```
-
-### Events
-
-`termui` ships with a http-like event mux handling system. All events are channeled up from different sources (typing, click, windows resize, custom event) and then encoded as universal `Event` object. `Event.Path` indicates the event type and `Event.Data` stores the event data struct. Add a handler to a certain event is easy as below:
-
-```go
- // handle key q pressing
- ui.Handle("/sys/kbd/q", func(ui.Event) {
- // press q to quit
- ui.StopLoop()
- })
-
- ui.Handle("/sys/kbd/C-x", func(ui.Event) {
- // handle Ctrl + x combination
- })
-
- ui.Handle("/sys/kbd", func(ui.Event) {
- // handle all other key pressing
- })
-
- // handle a 1s timer
- ui.Handle("/timer/1s", func(e ui.Event) {
- t := e.Data.(ui.EvtTimer)
- // t is a EvtTimer
- if t.Count%2 ==0 {
- // do something
- }
- })
-
- ui.Loop() // block until StopLoop is called
-```
-
-### Widgets
-
-Click image to see the corresponding demo codes.
-
-[](https://github.com/gizak/termui/blob/master/_example/par.go)
-[](https://github.com/gizak/termui/blob/master/_example/list.go)
-[](https://github.com/gizak/termui/blob/master/_example/gauge.go)
-[](https://github.com/gizak/termui/blob/master/_example/linechart.go)
-[](https://github.com/gizak/termui/blob/master/_example/barchart.go)
-[](https://github.com/gizak/termui/blob/master/_example/mbarchart.go)
-[](https://github.com/gizak/termui/blob/master/_example/sparklines.go)
-[](https://github.com/gizak/termui/blob/master/_example/table.go)
-
-## GoDoc
-
-[godoc](https://godoc.org/github.com/gizak/termui)
-
-## TODO
-
-- [x] Grid layout
-- [x] Event system
-- [x] Canvas widget
-- [x] Refine APIs
-- [ ] Focusable widgets
-
-## Changelog
-
-## License
-This library is under the [MIT License](http://opensource.org/licenses/MIT)
diff --git a/vendor/github.com/gizak/termui/_docs/about.md b/vendor/github.com/gizak/termui/_docs/about.md
deleted file mode 100644
index e69de29..0000000
diff --git a/vendor/github.com/gizak/termui/_docs/components.md b/vendor/github.com/gizak/termui/_docs/components.md
deleted file mode 100644
index 4e0239f..0000000
--- a/vendor/github.com/gizak/termui/_docs/components.md
+++ /dev/null
@@ -1,32 +0,0 @@
-Overview
----
-
-Bufferer
----
-
-Block
----
-
-BarChart
----
-
-Canvas
----
-
-Gauge
----
-
-LineChart
----
-
-MBarChart
----
-
-Par
----
-
-Sparkline
----
-
-Sparklines
----
diff --git a/vendor/github.com/gizak/termui/_docs/events.md b/vendor/github.com/gizak/termui/_docs/events.md
deleted file mode 100644
index 45aa04c..0000000
--- a/vendor/github.com/gizak/termui/_docs/events.md
+++ /dev/null
@@ -1,14 +0,0 @@
-Event System
----
-
-Keyboard Events
----
-
-Mouse Events
----
-
-Window Events
----
-
-Custom Events
----
diff --git a/vendor/github.com/gizak/termui/_docs/img/dashboard.gif b/vendor/github.com/gizak/termui/_docs/img/dashboard.gif
deleted file mode 100644
index 4bab470..0000000
Binary files a/vendor/github.com/gizak/termui/_docs/img/dashboard.gif and /dev/null differ
diff --git a/vendor/github.com/gizak/termui/_docs/img/demo1.png b/vendor/github.com/gizak/termui/_docs/img/demo1.png
deleted file mode 100644
index cc35f49..0000000
Binary files a/vendor/github.com/gizak/termui/_docs/img/demo1.png and /dev/null differ
diff --git a/vendor/github.com/gizak/termui/_docs/index.md b/vendor/github.com/gizak/termui/_docs/index.md
deleted file mode 100644
index 2769067..0000000
--- a/vendor/github.com/gizak/termui/_docs/index.md
+++ /dev/null
@@ -1,15 +0,0 @@
-[termui]() is a cross-platform, easy-to-compile, and fully-customizable terminal dashboard. It aims to provide a terminal front end for your applications with less struggle:
-
-> ![dashboard](img/dashboard.gif)
->
-> _cast under osx 10.10; Terminal.app; Menlo Regular 12pt._
-
-This guide describes the essential parts used to build a interface, which includes:
-
-- Installation & Usage
-- Layout System
-- Event System
-- Theming
-- Components
-
-[Quickstart](quickstart.md) is the way to go for starters and [Recipes](recipes.md) contains some practical resolutions you might need.
diff --git a/vendor/github.com/gizak/termui/_docs/layouts.md b/vendor/github.com/gizak/termui/_docs/layouts.md
deleted file mode 100644
index b260736..0000000
--- a/vendor/github.com/gizak/termui/_docs/layouts.md
+++ /dev/null
@@ -1,26 +0,0 @@
-Overview
----
-
-termui offers two layout system: [Absolute]() and [Grid](). The two concept actually spawned from Web:
-
-- The __Absolute layout__ is a plain coordination system, like [CSS position property](https://developer.mozilla.org/en/docs/Web/CSS/position) `position: absolute`. You will need manually assign `.X`, `.Y`, `.Width` and `.Height` to a component.
-- The __Grid system__ actually is a simplified version of [the 12 columns CSS grid system](http://www.w3schools.com/bootstrap/bootstrap_grid_system.asp) on terminal. You do not need to bother setting positions and width properties, these values will be synced up according to their containers.
-
-!!! note
- `Align` property can help you set your component position based on terminal window. Find more at [Magic Variables](#magic-variables)
-
-__Cons and pros:__
-
-- Use of Absolute layout gives you maximum control over how to arrange your components, while you have
-to put a little more effort to set things up. Fortunately there are some "magic variables" may help you out.
-- Grid layout can save you some time, it adjusts components location and size based on it's container. But note that you do need to set `.Height` property to each components because termui can not decide it for you.
-
-
-Absolute Layout
----
-
-Grid Layout
----
-
-Magic Variables
----
diff --git a/vendor/github.com/gizak/termui/_docs/quickstart.md b/vendor/github.com/gizak/termui/_docs/quickstart.md
deleted file mode 100644
index 207019f..0000000
--- a/vendor/github.com/gizak/termui/_docs/quickstart.md
+++ /dev/null
@@ -1,80 +0,0 @@
-Installation
----
-
-Since [termui](https://github.com/gizak/termui) is a Go lib, we will need a working Go environment to begin with. If you have not set it up, there is a great intro you can follow up: [How to write Go code](https://golang.org/doc/code.html).
-
-Once you have the environment set up, you can proceed to install termui by the following command:
-
-`go get github.com/gizak/termui`
-
-The current version of termui is v2. If you are working with the old version of termui or the new version does not seem right to you, you can always go back to v1 version by:
-
-`go get gopkg.in/gizak/termui.v1`
-
-!!! note
- v2 has many features implemented which you can not find in v1, such as new event system and asynchronous rendering. To find more about versions difference in section [Versions](versions.md).
-
-
-Usage
----
-
-Let's throw an simple example to get our feet wet:
-
-```go
-package main
-
-import ui "github.com/gizak/termui" // use ui as an alias
-
-func main() {
- err := ui.Init()
- if err != nil {
- panic(err)
- }
- defer ui.Close()
-
- p := ui.NewPar(":PRESS q TO QUIT DEMO")
- p.Height = 3
- p.Width = 50
- p.TextFgColor = ui.ColorWhite
- p.BorderLabel = "Text Box"
- p.BorderFg = ui.ColorCyan
-
- ui.Render(p) // feel free to call Render, it's async and non-block
-
- ui.Handle("/sys/kbd/q",func(e ui.Event){
- ui.StopLoop()
- })
-
- ui.Loop()
-}
-```
-There are only around 20 lines for the main function. Break this down into 4 parts:
-
-1. __Init termui__:
- `ui.Init()` initializes the termui. From this point, termui will take over your terminal display.
- `ui.Close()` closes resources and cleans up your terminal content. Make sure it is called before exit or you will end up with a messed up looking terminal.
-
-2. __Build your component__:
- `ui.NewPar(:PRESS q TO QUIT DEMO)` returns a structure representing a paragraph component. You can assign position, size, text colour, border and many other properties to a component.
-
-3. __Draw your component on display__:
- `ui.Render(p)` renders p onto terminal display.
-
-4. __Handle events__:
- `ui.Handle("/sys/kbd/q", func(e Event))` registers an event handler for event: key q is pressed.
- `ui.StopLoop()` exits the event listening loop invoked by `ui.Loop()`.
- `ui.Loop()` makes the program stops at here and start listening & handling events. Call
- `ui.StopLoop()` to leave the circle.
-
-The example code gives us:
-
-> ![example screenshot](img/demo1.png)
-
-Now you can press q to quit the program.
-
-After knowing of some basics, next we can discover more about:
-
-1. how to set component location in [Layouts](layouts.md)
-2. how to capture and handle events in [Events](events.md)
-3. the different [components](components.md)
-4. check out some real world examples in [recipes](recipes.md)
diff --git a/vendor/github.com/gizak/termui/_docs/recipes.md b/vendor/github.com/gizak/termui/_docs/recipes.md
deleted file mode 100644
index 3a16965..0000000
--- a/vendor/github.com/gizak/termui/_docs/recipes.md
+++ /dev/null
@@ -1 +0,0 @@
-_Sorry, it is still Work in Progress..._
diff --git a/vendor/github.com/gizak/termui/_docs/themes.md b/vendor/github.com/gizak/termui/_docs/themes.md
deleted file mode 100644
index e69de29..0000000
diff --git a/vendor/github.com/gizak/termui/_docs/versions.md b/vendor/github.com/gizak/termui/_docs/versions.md
deleted file mode 100644
index e69de29..0000000
diff --git a/vendor/github.com/gizak/termui/_example/barchart.go b/vendor/github.com/gizak/termui/_example/barchart.go
deleted file mode 100644
index aa20274..0000000
--- a/vendor/github.com/gizak/termui/_example/barchart.go
+++ /dev/null
@@ -1,36 +0,0 @@
-// Copyright 2017 Zack Guo . All rights reserved.
-// Use of this source code is governed by a MIT license that can
-// be found in the LICENSE file.
-
-// +build ignore
-
-package main
-
-import "github.com/gizak/termui"
-
-func main() {
- if err := termui.Init(); err != nil {
- panic(err)
- }
- defer termui.Close()
-
- bc := termui.NewBarChart()
- data := []int{3, 2, 5, 3, 9, 5, 3, 2, 5, 8, 3, 2, 4, 5, 3, 2, 5, 7, 5, 3, 2, 6, 7, 4, 6, 3, 6, 7, 8, 3, 6, 4, 5, 3, 2, 4, 6, 4, 8, 5, 9, 4, 3, 6, 5, 3, 6}
- bclabels := []string{"S0", "S1", "S2", "S3", "S4", "S5"}
- bc.BorderLabel = "Bar Chart"
- bc.Data = data
- bc.Width = 26
- bc.Height = 10
- bc.DataLabels = bclabels
- bc.TextColor = termui.ColorGreen
- bc.BarColor = termui.ColorRed
- bc.NumColor = termui.ColorYellow
-
- termui.Render(bc)
-
- termui.Handle("/sys/kbd/q", func(termui.Event) {
- termui.StopLoop()
- })
- termui.Loop()
-
-}
diff --git a/vendor/github.com/gizak/termui/_example/barchart.png b/vendor/github.com/gizak/termui/_example/barchart.png
deleted file mode 100644
index 4c5f1ca..0000000
Binary files a/vendor/github.com/gizak/termui/_example/barchart.png and /dev/null differ
diff --git a/vendor/github.com/gizak/termui/_example/dashboard.gif b/vendor/github.com/gizak/termui/_example/dashboard.gif
deleted file mode 100644
index 4bab470..0000000
Binary files a/vendor/github.com/gizak/termui/_example/dashboard.gif and /dev/null differ
diff --git a/vendor/github.com/gizak/termui/_example/dashboard.go b/vendor/github.com/gizak/termui/_example/dashboard.go
deleted file mode 100644
index b59c325..0000000
--- a/vendor/github.com/gizak/termui/_example/dashboard.go
+++ /dev/null
@@ -1,142 +0,0 @@
-// Copyright 2017 Zack Guo . All rights reserved.
-// Use of this source code is governed by a MIT license that can
-// be found in the LICENSE file.
-
-// +build ignore
-
-package main
-
-import ui "github.com/gizak/termui"
-import "math"
-
-func main() {
- if err := ui.Init(); err != nil {
- panic(err)
- }
- defer ui.Close()
-
- p := ui.NewPar(":PRESS q TO QUIT DEMO")
- p.Height = 3
- p.Width = 50
- p.TextFgColor = ui.ColorWhite
- p.BorderLabel = "Text Box"
- p.BorderFg = ui.ColorCyan
- p.Handle("/timer/1s", func(e ui.Event) {
- cnt := e.Data.(ui.EvtTimer)
- if cnt.Count%2 == 0 {
- p.TextFgColor = ui.ColorRed
- } else {
- p.TextFgColor = ui.ColorWhite
- }
- })
-
- strs := []string{"[0] gizak/termui", "[1] editbox.go", "[2] iterrupt.go", "[3] keyboard.go", "[4] output.go", "[5] random_out.go", "[6] dashboard.go", "[7] nsf/termbox-go"}
- list := ui.NewList()
- list.Items = strs
- list.ItemFgColor = ui.ColorYellow
- list.BorderLabel = "List"
- list.Height = 7
- list.Width = 25
- list.Y = 4
-
- g := ui.NewGauge()
- g.Percent = 50
- g.Width = 50
- g.Height = 3
- g.Y = 11
- g.BorderLabel = "Gauge"
- g.BarColor = ui.ColorRed
- g.BorderFg = ui.ColorWhite
- g.BorderLabelFg = ui.ColorCyan
-
- spark := ui.Sparkline{}
- spark.Height = 1
- spark.Title = "srv 0:"
- spdata := []int{4, 2, 1, 6, 3, 9, 1, 4, 2, 15, 14, 9, 8, 6, 10, 13, 15, 12, 10, 5, 3, 6, 1, 7, 10, 10, 14, 13, 6, 4, 2, 1, 6, 3, 9, 1, 4, 2, 15, 14, 9, 8, 6, 10, 13, 15, 12, 10, 5, 3, 6, 1, 7, 10, 10, 14, 13, 6, 4, 2, 1, 6, 3, 9, 1, 4, 2, 15, 14, 9, 8, 6, 10, 13, 15, 12, 10, 5, 3, 6, 1, 7, 10, 10, 14, 13, 6, 4, 2, 1, 6, 3, 9, 1, 4, 2, 15, 14, 9, 8, 6, 10, 13, 15, 12, 10, 5, 3, 6, 1, 7, 10, 10, 14, 13, 6}
- spark.Data = spdata
- spark.LineColor = ui.ColorCyan
- spark.TitleColor = ui.ColorWhite
-
- spark1 := ui.Sparkline{}
- spark1.Height = 1
- spark1.Title = "srv 1:"
- spark1.Data = spdata
- spark1.TitleColor = ui.ColorWhite
- spark1.LineColor = ui.ColorRed
-
- sp := ui.NewSparklines(spark, spark1)
- sp.Width = 25
- sp.Height = 7
- sp.BorderLabel = "Sparkline"
- sp.Y = 4
- sp.X = 25
-
- sinps := (func() []float64 {
- n := 220
- ps := make([]float64, n)
- for i := range ps {
- ps[i] = 1 + math.Sin(float64(i)/5)
- }
- return ps
- })()
-
- lc := ui.NewLineChart()
- lc.BorderLabel = "dot-mode Line Chart"
- lc.Data = sinps
- lc.Width = 50
- lc.Height = 11
- lc.X = 0
- lc.Y = 14
- lc.AxesColor = ui.ColorWhite
- lc.LineColor = ui.ColorRed | ui.AttrBold
- lc.Mode = "dot"
-
- bc := ui.NewBarChart()
- bcdata := []int{3, 2, 5, 3, 9, 5, 3, 2, 5, 8, 3, 2, 4, 5, 3, 2, 5, 7, 5, 3, 2, 6, 7, 4, 6, 3, 6, 7, 8, 3, 6, 4, 5, 3, 2, 4, 6, 4, 8, 5, 9, 4, 3, 6, 5, 3, 6}
- bclabels := []string{"S0", "S1", "S2", "S3", "S4", "S5"}
- bc.BorderLabel = "Bar Chart"
- bc.Width = 26
- bc.Height = 10
- bc.X = 51
- bc.Y = 0
- bc.DataLabels = bclabels
- bc.BarColor = ui.ColorGreen
- bc.NumColor = ui.ColorBlack
-
- lc1 := ui.NewLineChart()
- lc1.BorderLabel = "braille-mode Line Chart"
- lc1.Data = sinps
- lc1.Width = 26
- lc1.Height = 11
- lc1.X = 51
- lc1.Y = 14
- lc1.AxesColor = ui.ColorWhite
- lc1.LineColor = ui.ColorYellow | ui.AttrBold
-
- p1 := ui.NewPar("Hey!\nI am a borderless block!")
- p1.Border = false
- p1.Width = 26
- p1.Height = 2
- p1.TextFgColor = ui.ColorMagenta
- p1.X = 52
- p1.Y = 11
-
- draw := func(t int) {
- g.Percent = t % 101
- list.Items = strs[t%9:]
- sp.Lines[0].Data = spdata[:30+t%50]
- sp.Lines[1].Data = spdata[:35+t%50]
- lc.Data = sinps[t/2%220:]
- lc1.Data = sinps[2*t%220:]
- bc.Data = bcdata[t/2%10:]
- ui.Render(p, list, g, sp, lc, bc, lc1, p1)
- }
- ui.Handle("/sys/kbd/q", func(ui.Event) {
- ui.StopLoop()
- })
- ui.Handle("/timer/1s", func(e ui.Event) {
- t := e.Data.(ui.EvtTimer)
- draw(int(t.Count))
- })
- ui.Loop()
-}
diff --git a/vendor/github.com/gizak/termui/_example/gauge.go b/vendor/github.com/gizak/termui/_example/gauge.go
deleted file mode 100644
index d05b77e..0000000
--- a/vendor/github.com/gizak/termui/_example/gauge.go
+++ /dev/null
@@ -1,84 +0,0 @@
-// Copyright 2017 Zack Guo . All rights reserved.
-// Use of this source code is governed by a MIT license that can
-// be found in the LICENSE file.
-
-// +build ignore
-
-package main
-
-import "github.com/gizak/termui"
-
-func main() {
- err := termui.Init()
- if err != nil {
- panic(err)
- }
- defer termui.Close()
-
- //termui.UseTheme("helloworld")
-
- g0 := termui.NewGauge()
- g0.Percent = 40
- g0.Width = 50
- g0.Height = 3
- g0.BorderLabel = "Slim Gauge"
- g0.BarColor = termui.ColorRed
- g0.BorderFg = termui.ColorWhite
- g0.BorderLabelFg = termui.ColorCyan
-
- gg := termui.NewBlock()
- gg.Width = 50
- gg.Height = 5
- gg.Y = 12
- gg.BorderLabel = "TEST"
- gg.Align()
-
- g2 := termui.NewGauge()
- g2.Percent = 60
- g2.Width = 50
- g2.Height = 3
- g2.PercentColor = termui.ColorBlue
- g2.Y = 3
- g2.BorderLabel = "Slim Gauge"
- g2.BarColor = termui.ColorYellow
- g2.BorderFg = termui.ColorWhite
-
- g1 := termui.NewGauge()
- g1.Percent = 30
- g1.Width = 50
- g1.Height = 5
- g1.Y = 6
- g1.BorderLabel = "Big Gauge"
- g1.PercentColor = termui.ColorYellow
- g1.BarColor = termui.ColorGreen
- g1.BorderFg = termui.ColorWhite
- g1.BorderLabelFg = termui.ColorMagenta
-
- g3 := termui.NewGauge()
- g3.Percent = 50
- g3.Width = 50
- g3.Height = 3
- g3.Y = 11
- g3.BorderLabel = "Gauge with custom label"
- g3.Label = "{{percent}}% (100MBs free)"
- g3.LabelAlign = termui.AlignRight
-
- g4 := termui.NewGauge()
- g4.Percent = 50
- g4.Width = 50
- g4.Height = 3
- g4.Y = 14
- g4.BorderLabel = "Gauge"
- g4.Label = "Gauge with custom highlighted label"
- g4.PercentColor = termui.ColorYellow
- g4.BarColor = termui.ColorGreen
- g4.PercentColorHighlighted = termui.ColorBlack
-
- termui.Render(g0, g1, g2, g3, g4)
-
- termui.Handle("/sys/kbd/q", func(termui.Event) {
- termui.StopLoop()
- })
-
- termui.Loop()
-}
diff --git a/vendor/github.com/gizak/termui/_example/gauge.png b/vendor/github.com/gizak/termui/_example/gauge.png
deleted file mode 100644
index 4009243..0000000
Binary files a/vendor/github.com/gizak/termui/_example/gauge.png and /dev/null differ
diff --git a/vendor/github.com/gizak/termui/_example/grid.gif b/vendor/github.com/gizak/termui/_example/grid.gif
deleted file mode 100644
index 7490043..0000000
Binary files a/vendor/github.com/gizak/termui/_example/grid.gif and /dev/null differ
diff --git a/vendor/github.com/gizak/termui/_example/grid.go b/vendor/github.com/gizak/termui/_example/grid.go
deleted file mode 100644
index 4128909..0000000
--- a/vendor/github.com/gizak/termui/_example/grid.go
+++ /dev/null
@@ -1,122 +0,0 @@
-// Copyright 2017 Zack Guo . All rights reserved.
-// Use of this source code is governed by a MIT license that can
-// be found in the LICENSE file.
-
-// +build ignore
-
-package main
-
-import ui "github.com/gizak/termui"
-
-import "math"
-
-func main() {
- if err := ui.Init(); err != nil {
- panic(err)
- }
- defer ui.Close()
-
- sinps := (func() []float64 {
- n := 400
- ps := make([]float64, n)
- for i := range ps {
- ps[i] = 1 + math.Sin(float64(i)/5)
- }
- return ps
- })()
- sinpsint := (func() []int {
- ps := make([]int, len(sinps))
- for i, v := range sinps {
- ps[i] = int(100*v + 10)
- }
- return ps
- })()
-
- spark := ui.Sparkline{}
- spark.Height = 8
- spdata := sinpsint
- spark.Data = spdata[:100]
- spark.LineColor = ui.ColorCyan
- spark.TitleColor = ui.ColorWhite
-
- sp := ui.NewSparklines(spark)
- sp.Height = 11
- sp.BorderLabel = "Sparkline"
-
- lc := ui.NewLineChart()
- lc.BorderLabel = "braille-mode Line Chart"
- lc.Data = sinps
- lc.Height = 11
- lc.AxesColor = ui.ColorWhite
- lc.LineColor = ui.ColorYellow | ui.AttrBold
-
- gs := make([]*ui.Gauge, 3)
- for i := range gs {
- gs[i] = ui.NewGauge()
- //gs[i].LabelAlign = ui.AlignCenter
- gs[i].Height = 2
- gs[i].Border = false
- gs[i].Percent = i * 10
- gs[i].PaddingBottom = 1
- gs[i].BarColor = ui.ColorRed
- }
-
- ls := ui.NewList()
- ls.Border = false
- ls.Items = []string{
- "[1] Downloading File 1",
- "", // == \newline
- "[2] Downloading File 2",
- "",
- "[3] Uploading File 3",
- }
- ls.Height = 5
-
- par := ui.NewPar("<> This row has 3 columns\n<- Widgets can be stacked up like left side\n<- Stacked widgets are treated as a single widget")
- par.Height = 5
- par.BorderLabel = "Demonstration"
-
- // build layout
- ui.Body.AddRows(
- ui.NewRow(
- ui.NewCol(6, 0, sp),
- ui.NewCol(6, 0, lc)),
- ui.NewRow(
- ui.NewCol(3, 0, ls),
- ui.NewCol(3, 0, gs[0], gs[1], gs[2]),
- ui.NewCol(6, 0, par)))
-
- // calculate layout
- ui.Body.Align()
-
- ui.Render(ui.Body)
-
- ui.Handle("/sys/kbd/q", func(ui.Event) {
- ui.StopLoop()
- })
- ui.Handle("/timer/1s", func(e ui.Event) {
- t := e.Data.(ui.EvtTimer)
- i := t.Count
- if i > 103 {
- ui.StopLoop()
- return
- }
-
- for _, g := range gs {
- g.Percent = (g.Percent + 3) % 100
- }
-
- sp.Lines[0].Data = spdata[:100+i]
- lc.Data = sinps[2*i:]
- ui.Render(ui.Body)
- })
-
- ui.Handle("/sys/wnd/resize", func(e ui.Event) {
- ui.Body.Width = ui.TermWidth()
- ui.Body.Align()
- ui.Clear()
- ui.Render(ui.Body)
- })
-
- ui.Loop()
-}
diff --git a/vendor/github.com/gizak/termui/_example/linechart.go b/vendor/github.com/gizak/termui/_example/linechart.go
deleted file mode 100644
index 7411403..0000000
--- a/vendor/github.com/gizak/termui/_example/linechart.go
+++ /dev/null
@@ -1,71 +0,0 @@
-// Copyright 2017 Zack Guo . All rights reserved.
-// Use of this source code is governed by a MIT license that can
-// be found in the LICENSE file.
-
-// +build ignore
-
-package main
-
-import (
- "math"
-
- "github.com/gizak/termui"
-)
-
-func main() {
- err := termui.Init()
- if err != nil {
- panic(err)
- }
- defer termui.Close()
-
- //termui.UseTheme("helloworld")
-
- sinps := (func() []float64 {
- n := 220
- ps := make([]float64, n)
- for i := range ps {
- ps[i] = 1 + math.Sin(float64(i)/5)
- }
- return ps
- })()
-
- lc0 := termui.NewLineChart()
- lc0.BorderLabel = "braille-mode Line Chart"
- lc0.Data = sinps
- lc0.Width = 50
- lc0.Height = 12
- lc0.X = 0
- lc0.Y = 0
- lc0.AxesColor = termui.ColorWhite
- lc0.LineColor = termui.ColorGreen | termui.AttrBold
-
- lc1 := termui.NewLineChart()
- lc1.BorderLabel = "dot-mode Line Chart"
- lc1.Mode = "dot"
- lc1.Data = sinps
- lc1.Width = 26
- lc1.Height = 12
- lc1.X = 51
- lc1.DotStyle = '+'
- lc1.AxesColor = termui.ColorWhite
- lc1.LineColor = termui.ColorYellow | termui.AttrBold
-
- lc2 := termui.NewLineChart()
- lc2.BorderLabel = "dot-mode Line Chart"
- lc2.Mode = "dot"
- lc2.Data = sinps[4:]
- lc2.Width = 77
- lc2.Height = 16
- lc2.X = 0
- lc2.Y = 12
- lc2.AxesColor = termui.ColorWhite
- lc2.LineColor = termui.ColorCyan | termui.AttrBold
-
- termui.Render(lc0, lc1, lc2)
- termui.Handle("/sys/kbd/q", func(termui.Event) {
- termui.StopLoop()
- })
- termui.Loop()
-
-}
diff --git a/vendor/github.com/gizak/termui/_example/linechart.png b/vendor/github.com/gizak/termui/_example/linechart.png
deleted file mode 100644
index 24f3c97..0000000
Binary files a/vendor/github.com/gizak/termui/_example/linechart.png and /dev/null differ
diff --git a/vendor/github.com/gizak/termui/_example/list.go b/vendor/github.com/gizak/termui/_example/list.go
deleted file mode 100644
index 375029d..0000000
--- a/vendor/github.com/gizak/termui/_example/list.go
+++ /dev/null
@@ -1,44 +0,0 @@
-// Copyright 2017 Zack Guo . All rights reserved.
-// Use of this source code is governed by a MIT license that can
-// be found in the LICENSE file.
-
-// +build ignore
-
-package main
-
-import "github.com/gizak/termui"
-
-func main() {
- err := termui.Init()
- if err != nil {
- panic(err)
- }
- defer termui.Close()
-
- //termui.UseTheme("helloworld")
-
- strs := []string{
- "[0] github.com/gizak/termui",
- "[1] [你好,世界](fg-blue)",
- "[2] [こんにちは世界](fg-red)",
- "[3] [color output](fg-white,bg-green)",
- "[4] output.go",
- "[5] random_out.go",
- "[6] dashboard.go",
- "[7] nsf/termbox-go"}
-
- ls := termui.NewList()
- ls.Items = strs
- ls.ItemFgColor = termui.ColorYellow
- ls.BorderLabel = "List"
- ls.Height = 7
- ls.Width = 25
- ls.Y = 0
-
- termui.Render(ls)
- termui.Handle("/sys/kbd/q", func(termui.Event) {
- termui.StopLoop()
- })
- termui.Loop()
-
-}
diff --git a/vendor/github.com/gizak/termui/_example/list.png b/vendor/github.com/gizak/termui/_example/list.png
deleted file mode 100644
index 7c5e27c..0000000
Binary files a/vendor/github.com/gizak/termui/_example/list.png and /dev/null differ
diff --git a/vendor/github.com/gizak/termui/_example/mbarchart.go b/vendor/github.com/gizak/termui/_example/mbarchart.go
deleted file mode 100644
index 074cccf..0000000
--- a/vendor/github.com/gizak/termui/_example/mbarchart.go
+++ /dev/null
@@ -1,54 +0,0 @@
-// Copyright 2017 Zack Guo . All rights reserved.
-// Use of this source code is governed by a MIT license that can
-// be found in the LICENSE file.
-
-// +build ignore
-
-package main
-
-import "github.com/gizak/termui"
-
-func main() {
- err := termui.Init()
- if err != nil {
- panic(err)
- }
- defer termui.Close()
-
- //termui.UseTheme("helloworld")
-
- bc := termui.NewMBarChart()
- math := []int{90, 85, 90, 80}
- english := []int{70, 85, 75, 60}
- science := []int{75, 60, 80, 85}
- compsci := []int{100, 100, 100, 100}
- bc.Data[0] = math
- bc.Data[1] = english
- bc.Data[2] = science
- bc.Data[3] = compsci
- studentsName := []string{"Ken", "Rob", "Dennis", "Linus"}
- bc.BorderLabel = "Student's Marks X-Axis=Name Y-Axis=Marks[Math,English,Science,ComputerScience] in %"
- bc.Width = 100
- bc.Height = 30
- bc.Y = 0
- bc.BarWidth = 10
- bc.DataLabels = studentsName
- bc.ShowScale = true //Show y_axis scale value (min and max)
- bc.SetMax(400)
-
- bc.TextColor = termui.ColorGreen //this is color for label (x-axis)
- bc.BarColor[3] = termui.ColorGreen //BarColor for computerscience
- bc.BarColor[1] = termui.ColorYellow //Bar Color for english
- bc.NumColor[3] = termui.ColorRed // Num color for computerscience
- bc.NumColor[1] = termui.ColorRed // num color for english
-
- //Other colors are automatically populated, btw All the students seems do well in computerscience. :p
-
- termui.Render(bc)
-
- termui.Handle("/sys/kbd/q", func(termui.Event) {
- termui.StopLoop()
- })
- termui.Loop()
-
-}
diff --git a/vendor/github.com/gizak/termui/_example/mbarchart.png b/vendor/github.com/gizak/termui/_example/mbarchart.png
deleted file mode 100644
index e51337e..0000000
Binary files a/vendor/github.com/gizak/termui/_example/mbarchart.png and /dev/null differ
diff --git a/vendor/github.com/gizak/termui/_example/par.go b/vendor/github.com/gizak/termui/_example/par.go
deleted file mode 100644
index d340fe4..0000000
--- a/vendor/github.com/gizak/termui/_example/par.go
+++ /dev/null
@@ -1,52 +0,0 @@
-// Copyright 2017 Zack Guo . All rights reserved.
-// Use of this source code is governed by a MIT license that can
-// be found in the LICENSE file.
-
-// +build ignore
-
-package main
-
-import "github.com/gizak/termui"
-
-func main() {
- err := termui.Init()
- if err != nil {
- panic(err)
- }
- defer termui.Close()
-
- //termui.UseTheme("helloworld")
-
- par0 := termui.NewPar("Borderless Text")
- par0.Height = 1
- par0.Width = 20
- par0.Y = 1
- par0.Border = false
-
- par1 := termui.NewPar("你好,世界。")
- par1.Height = 3
- par1.Width = 17
- par1.X = 20
- par1.BorderLabel = "标签"
-
- par2 := termui.NewPar("Simple colored text\nwith label. It [can be](fg-red) multilined with \\n or [break automatically](fg-red,fg-bold)")
- par2.Height = 5
- par2.Width = 37
- par2.Y = 4
- par2.BorderLabel = "Multiline"
- par2.BorderFg = termui.ColorYellow
-
- par3 := termui.NewPar("Long text with label and it is auto trimmed.")
- par3.Height = 3
- par3.Width = 37
- par3.Y = 9
- par3.BorderLabel = "Auto Trim"
-
- termui.Render(par0, par1, par2, par3)
-
- termui.Handle("/sys/kbd/q", func(termui.Event) {
- termui.StopLoop()
- })
- termui.Loop()
-
-}
diff --git a/vendor/github.com/gizak/termui/_example/par.png b/vendor/github.com/gizak/termui/_example/par.png
deleted file mode 100644
index b71fa7c..0000000
Binary files a/vendor/github.com/gizak/termui/_example/par.png and /dev/null differ
diff --git a/vendor/github.com/gizak/termui/_example/sparklines.go b/vendor/github.com/gizak/termui/_example/sparklines.go
deleted file mode 100644
index ba4ef71..0000000
--- a/vendor/github.com/gizak/termui/_example/sparklines.go
+++ /dev/null
@@ -1,69 +0,0 @@
-// Copyright 2017 Zack Guo . All rights reserved.
-// Use of this source code is governed by a MIT license that can
-// be found in the LICENSE file.
-
-// +build ignore
-
-package main
-
-import "github.com/gizak/termui"
-
-func main() {
- err := termui.Init()
- if err != nil {
- panic(err)
- }
- defer termui.Close()
-
- //termui.UseTheme("helloworld")
-
- data := []int{4, 2, 1, 6, 3, 9, 1, 4, 2, 15, 14, 9, 8, 6, 10, 13, 15, 12, 10, 5, 3, 6, 1, 7, 10, 10, 14, 13, 6}
- spl0 := termui.NewSparkline()
- spl0.Data = data[3:]
- spl0.Title = "Sparkline 0"
- spl0.LineColor = termui.ColorGreen
-
- // single
- spls0 := termui.NewSparklines(spl0)
- spls0.Height = 2
- spls0.Width = 20
- spls0.Border = false
-
- spl1 := termui.NewSparkline()
- spl1.Data = data
- spl1.Title = "Sparkline 1"
- spl1.LineColor = termui.ColorRed
-
- spl2 := termui.NewSparkline()
- spl2.Data = data[5:]
- spl2.Title = "Sparkline 2"
- spl2.LineColor = termui.ColorMagenta
-
- // group
- spls1 := termui.NewSparklines(spl0, spl1, spl2)
- spls1.Height = 8
- spls1.Width = 20
- spls1.Y = 3
- spls1.BorderLabel = "Group Sparklines"
-
- spl3 := termui.NewSparkline()
- spl3.Data = data
- spl3.Title = "Enlarged Sparkline"
- spl3.Height = 8
- spl3.LineColor = termui.ColorYellow
-
- spls2 := termui.NewSparklines(spl3)
- spls2.Height = 11
- spls2.Width = 30
- spls2.BorderFg = termui.ColorCyan
- spls2.X = 21
- spls2.BorderLabel = "Tweeked Sparkline"
-
- termui.Render(spls0, spls1, spls2)
-
- termui.Handle("/sys/kbd/q", func(termui.Event) {
- termui.StopLoop()
- })
- termui.Loop()
-
-}
diff --git a/vendor/github.com/gizak/termui/_example/sparklines.png b/vendor/github.com/gizak/termui/_example/sparklines.png
deleted file mode 100644
index dd5641b..0000000
Binary files a/vendor/github.com/gizak/termui/_example/sparklines.png and /dev/null differ
diff --git a/vendor/github.com/gizak/termui/_example/table.go b/vendor/github.com/gizak/termui/_example/table.go
deleted file mode 100644
index fb4991b..0000000
--- a/vendor/github.com/gizak/termui/_example/table.go
+++ /dev/null
@@ -1,56 +0,0 @@
-// Copyright 2017 Zack Guo . All rights reserved.
-// Use of this source code is governed by a MIT license that can
-// be found in the LICENSE file.
-
-package main
-
-import "github.com/gizak/termui"
-
-func main() {
- err := termui.Init()
- if err != nil {
- panic(err)
- }
- defer termui.Close()
- rows1 := [][]string{
- []string{"header1", "header2", "header3"},
- []string{"你好吗", "Go-lang is so cool", "Im working on Ruby"},
- []string{"2016", "10", "11"},
- }
-
- table1 := termui.NewTable()
- table1.Rows = rows1
- table1.FgColor = termui.ColorWhite
- table1.BgColor = termui.ColorDefault
- table1.Y = 0
- table1.X = 0
- table1.Width = 62
- table1.Height = 7
-
- termui.Render(table1)
-
- rows2 := [][]string{
- []string{"header1", "header2", "header3"},
- []string{"Foundations", "Go-lang is so cool", "Im working on Ruby"},
- []string{"2016", "11", "11"},
- }
-
- table2 := termui.NewTable()
- table2.Rows = rows2
- table2.FgColor = termui.ColorWhite
- table2.BgColor = termui.ColorDefault
- table2.TextAlign = termui.AlignCenter
- table2.Separator = false
- table2.Analysis()
- table2.SetSize()
- table2.BgColors[2] = termui.ColorRed
- table2.Y = 10
- table2.X = 0
- table2.Border = true
-
- termui.Render(table2)
- termui.Handle("/sys/kbd/q", func(termui.Event) {
- termui.StopLoop()
- })
- termui.Loop()
-}
diff --git a/vendor/github.com/gizak/termui/_example/table.png b/vendor/github.com/gizak/termui/_example/table.png
deleted file mode 100644
index 5781b1d..0000000
Binary files a/vendor/github.com/gizak/termui/_example/table.png and /dev/null differ
diff --git a/vendor/github.com/gizak/termui/_example/tabs.go b/vendor/github.com/gizak/termui/_example/tabs.go
deleted file mode 100644
index 25be239..0000000
--- a/vendor/github.com/gizak/termui/_example/tabs.go
+++ /dev/null
@@ -1,83 +0,0 @@
-// Copyright 2017 Zack Guo . All rights reserved.
-// Use of this source code is governed by a MIT license that can
-// be found in the LICENSE file.
-
-// +build ignore
-
-package main
-
-import (
- "github.com/gizak/termui"
- "github.com/gizak/termui/extra"
-)
-
-func main() {
- err := termui.Init()
- if err != nil {
- panic(err)
- }
- defer termui.Close()
-
- //termui.UseTheme("helloworld")
-
- header := termui.NewPar("Press q to quit, Press j or k to switch tabs")
- header.Height = 1
- header.Width = 50
- header.Border = false
- header.TextBgColor = termui.ColorBlue
-
- tab1 := extra.NewTab("pierwszy")
- par2 := termui.NewPar("Press q to quit\nPress j or k to switch tabs\n")
- par2.Height = 5
- par2.Width = 37
- par2.Y = 0
- par2.BorderLabel = "Keys"
- par2.BorderFg = termui.ColorYellow
- tab1.AddBlocks(par2)
-
- tab2 := extra.NewTab("drugi")
- bc := termui.NewBarChart()
- data := []int{3, 2, 5, 3, 9, 5, 3, 2, 5, 8, 3, 2, 4, 5, 3, 2, 5, 7, 5, 3, 2, 6, 7, 4, 6, 3, 6, 7, 8, 3, 6, 4, 5, 3, 2, 4, 6, 4, 8, 5, 9, 4, 3, 6, 5, 3, 6}
- bclabels := []string{"S0", "S1", "S2", "S3", "S4", "S5"}
- bc.BorderLabel = "Bar Chart"
- bc.Data = data
- bc.Width = 26
- bc.Height = 10
- bc.DataLabels = bclabels
- bc.TextColor = termui.ColorGreen
- bc.BarColor = termui.ColorRed
- bc.NumColor = termui.ColorYellow
- tab2.AddBlocks(bc)
-
- tab3 := extra.NewTab("trzeci")
- tab4 := extra.NewTab("żółw")
- tab5 := extra.NewTab("four")
- tab6 := extra.NewTab("five")
-
- tabpane := extra.NewTabpane()
- tabpane.Y = 1
- tabpane.Width = 30
- tabpane.Border = true
-
- tabpane.SetTabs(*tab1, *tab2, *tab3, *tab4, *tab5, *tab6)
-
- termui.Render(header, tabpane)
-
- termui.Handle("/sys/kbd/q", func(termui.Event) {
- termui.StopLoop()
- })
-
- termui.Handle("/sys/kbd/j", func(termui.Event) {
- tabpane.SetActiveLeft()
- termui.Clear()
- termui.Render(header, tabpane)
- })
-
- termui.Handle("/sys/kbd/k", func(termui.Event) {
- tabpane.SetActiveRight()
- termui.Clear()
- termui.Render(header, tabpane)
- })
-
- termui.Loop()
-}
diff --git a/vendor/github.com/gizak/termui/_example/theme.go b/vendor/github.com/gizak/termui/_example/theme.go
deleted file mode 100644
index f06b3d0..0000000
--- a/vendor/github.com/gizak/termui/_example/theme.go
+++ /dev/null
@@ -1,143 +0,0 @@
-// Copyright 2017 Zack Guo . All rights reserved.
-// Use of this source code is governed by a MIT license that can
-// be found in the LICENSE file.
-
-// +build ignore
-
-package main
-
-import ui "github.com/gizak/termui"
-import "math"
-
-import "time"
-
-func main() {
- err := ui.Init()
- if err != nil {
- panic(err)
- }
- defer ui.Close()
-
- ui.UseTheme("helloworld")
-
- p := ui.NewPar(":PRESS q TO QUIT DEMO")
- p.Height = 3
- p.Width = 50
- p.BorderLabel = "Text Box"
-
- strs := []string{"[0] gizak/termui", "[1] editbox.go", "[2] iterrupt.go", "[3] keyboard.go", "[4] output.go", "[5] random_out.go", "[6] dashboard.go", "[7] nsf/termbox-go"}
- list := ui.NewList()
- list.Items = strs
- list.BorderLabel = "List"
- list.Height = 7
- list.Width = 25
- list.Y = 4
-
- g := ui.NewGauge()
- g.Percent = 50
- g.Width = 50
- g.Height = 3
- g.Y = 11
- g.BorderLabel = "Gauge"
-
- spark := ui.NewSparkline()
- spark.Title = "srv 0:"
- spdata := []int{4, 2, 1, 6, 3, 9, 1, 4, 2, 15, 14, 9, 8, 6, 10, 13, 15, 12, 10, 5, 3, 6, 1, 7, 10, 10, 14, 13, 6}
- spark.Data = spdata
-
- spark1 := ui.NewSparkline()
- spark1.Title = "srv 1:"
- spark1.Data = spdata
-
- sp := ui.NewSparklines(spark, spark1)
- sp.Width = 25
- sp.Height = 7
- sp.BorderLabel = "Sparkline"
- sp.Y = 4
- sp.X = 25
-
- lc := ui.NewLineChart()
- sinps := (func() []float64 {
- n := 100
- ps := make([]float64, n)
- for i := range ps {
- ps[i] = 1 + math.Sin(float64(i)/4)
- }
- return ps
- })()
-
- lc.BorderLabel = "Line Chart"
- lc.Data = sinps
- lc.Width = 50
- lc.Height = 11
- lc.X = 0
- lc.Y = 14
- lc.Mode = "dot"
-
- bc := ui.NewBarChart()
- bcdata := []int{3, 2, 5, 3, 9, 5, 3, 2, 5, 8, 3, 2, 4, 5, 3, 2, 5, 7, 5, 3, 2, 6, 7, 4, 6, 3, 6, 7, 8, 3, 6, 4, 5, 3, 2, 4, 6, 4, 8, 5, 9, 4, 3, 6, 5, 3, 6}
- bclabels := []string{"S0", "S1", "S2", "S3", "S4", "S5"}
- bc.BorderLabel = "Bar Chart"
- bc.Width = 26
- bc.Height = 10
- bc.X = 51
- bc.Y = 0
- bc.DataLabels = bclabels
-
- lc1 := ui.NewLineChart()
- lc1.BorderLabel = "Line Chart"
- rndwalk := (func() []float64 {
- n := 150
- d := make([]float64, n)
- for i := 1; i < n; i++ {
- if i < 20 {
- d[i] = d[i-1] + 0.01
- }
- if i > 20 {
- d[i] = d[i-1] - 0.05
- }
- }
- return d
- })()
- lc1.Data = rndwalk
- lc1.Width = 26
- lc1.Height = 11
- lc1.X = 51
- lc1.Y = 14
-
- p1 := ui.NewPar("Hey!\nI am a borderless block!")
- p1.HasBorder = false
- p1.Width = 26
- p1.Height = 2
- p1.X = 52
- p1.Y = 11
-
- draw := func(t int) {
- g.Percent = t % 101
- list.Items = strs[t%9:]
- sp.Lines[0].Data = spdata[t%10:]
- sp.Lines[1].Data = spdata[t/2%10:]
- lc.Data = sinps[t/2:]
- lc1.Data = rndwalk[t:]
- bc.Data = bcdata[t/2%10:]
- ui.Render(p, list, g, sp, lc, bc, lc1, p1)
- }
-
- evt := ui.EventCh()
- i := 0
- for {
- select {
- case e := <-evt:
- if e.Type == ui.EventKey && e.Ch == 'q' {
- return
- }
- default:
- draw(i)
- i++
- if i == 102 {
- return
- }
- time.Sleep(time.Second / 2)
- }
- }
-}
diff --git a/vendor/github.com/gizak/termui/_example/themedefault.png b/vendor/github.com/gizak/termui/_example/themedefault.png
deleted file mode 100644
index 23b574f..0000000
Binary files a/vendor/github.com/gizak/termui/_example/themedefault.png and /dev/null differ
diff --git a/vendor/github.com/gizak/termui/_example/themehelloworld.png b/vendor/github.com/gizak/termui/_example/themehelloworld.png
deleted file mode 100644
index eaf4d93..0000000
Binary files a/vendor/github.com/gizak/termui/_example/themehelloworld.png and /dev/null differ
diff --git a/vendor/github.com/gizak/termui/_example/ttop.go b/vendor/github.com/gizak/termui/_example/ttop.go
deleted file mode 100644
index f5c32fe..0000000
--- a/vendor/github.com/gizak/termui/_example/ttop.go
+++ /dev/null
@@ -1,369 +0,0 @@
-// Copyright 2017 Zack Guo . All rights reserved.
-// Use of this source code is governed by a MIT license that can
-// be found in the LICENSE file.
-
-// +build ignore
-
-package main
-
-import (
- "bufio"
- "errors"
- "fmt"
- "io"
- "os"
- "regexp"
- "runtime"
- "sort"
- "strconv"
- "strings"
-
- "github.com/gizak/termui"
- "github.com/gizak/termui/extra"
-)
-
-const statFilePath = "/proc/stat"
-const meminfoFilePath = "/proc/meminfo"
-
-type CpuStat struct {
- user float32
- nice float32
- system float32
- idle float32
-}
-
-type CpusStats struct {
- stat map[string]CpuStat
- proc map[string]CpuStat
-}
-
-func NewCpusStats(s map[string]CpuStat) *CpusStats {
- return &CpusStats{stat: s, proc: make(map[string]CpuStat)}
-}
-
-func (cs *CpusStats) String() (ret string) {
- for key, _ := range cs.proc {
- ret += fmt.Sprintf("%s: %.2f %.2f %.2f %.2f\n", key, cs.proc[key].user, cs.proc[key].nice, cs.proc[key].system, cs.proc[key].idle)
- }
- return
-}
-
-func subCpuStat(m CpuStat, s CpuStat) CpuStat {
- return CpuStat{user: m.user - s.user,
- nice: m.nice - s.nice,
- system: m.system - s.system,
- idle: m.idle - s.idle}
-}
-
-func procCpuStat(c CpuStat) CpuStat {
- sum := c.user + c.nice + c.system + c.idle
- return CpuStat{user: c.user / sum * 100,
- nice: c.nice / sum * 100,
- system: c.system / sum * 100,
- idle: c.idle / sum * 100}
-}
-
-func (cs *CpusStats) tick(ns map[string]CpuStat) {
- for key, _ := range cs.stat {
- proc := subCpuStat(ns[key], cs.stat[key])
- cs.proc[key] = procCpuStat(proc)
- cs.stat[key] = ns[key]
- }
-}
-
-type errIntParser struct {
- err error
-}
-
-func (eip *errIntParser) parse(s string) (ret int64) {
- if eip.err != nil {
- return 0
- }
- ret, eip.err = strconv.ParseInt(s, 10, 0)
- return
-}
-
-type LineProcessor interface {
- process(string) error
- finalize() interface{}
-}
-
-type CpuLineProcessor struct {
- m map[string]CpuStat
-}
-
-func (clp *CpuLineProcessor) process(line string) (err error) {
- r := regexp.MustCompile("^cpu([0-9]*)")
-
- if r.MatchString(line) {
- tab := strings.Fields(line)
- if len(tab) < 5 {
- err = errors.New("cpu info line has not enough fields")
- return
- }
- parser := errIntParser{}
- cs := CpuStat{user: float32(parser.parse(tab[1])),
- nice: float32(parser.parse(tab[2])),
- system: float32(parser.parse(tab[3])),
- idle: float32(parser.parse(tab[4]))}
- clp.m[tab[0]] = cs
- err = parser.err
- if err != nil {
- return
- }
- }
- return
-}
-
-func (clp *CpuLineProcessor) finalize() interface{} {
- return clp.m
-}
-
-type MemStat struct {
- total int64
- free int64
-}
-
-func (ms MemStat) String() (ret string) {
- ret = fmt.Sprintf("TotalMem: %d, FreeMem: %d\n", ms.total, ms.free)
- return
-}
-
-func (ms *MemStat) process(line string) (err error) {
- rtotal := regexp.MustCompile("^MemTotal:")
- rfree := regexp.MustCompile("^MemFree:")
- var aux int64
- if rtotal.MatchString(line) || rfree.MatchString(line) {
- tab := strings.Fields(line)
- if len(tab) < 3 {
- err = errors.New("mem info line has not enough fields")
- return
- }
- aux, err = strconv.ParseInt(tab[1], 10, 0)
- }
- if err != nil {
- return
- }
-
- if rtotal.MatchString(line) {
- ms.total = aux
- }
- if rfree.MatchString(line) {
- ms.free = aux
- }
- return
-}
-
-func (ms *MemStat) finalize() interface{} {
- return *ms
-}
-
-func processFileLines(filePath string, lp LineProcessor) (ret interface{}, err error) {
- var statFile *os.File
- statFile, err = os.Open(filePath)
- if err != nil {
- fmt.Printf("open: %v\n", err)
- }
- defer statFile.Close()
-
- statFileReader := bufio.NewReader(statFile)
-
- for {
- var line string
- line, err = statFileReader.ReadString('\n')
- if err == io.EOF {
- err = nil
- break
- }
- if err != nil {
- fmt.Printf("open: %v\n", err)
- break
- }
- line = strings.TrimSpace(line)
-
- err = lp.process(line)
- }
-
- ret = lp.finalize()
- return
-}
-
-func getCpusStatsMap() (m map[string]CpuStat, err error) {
- var aux interface{}
- aux, err = processFileLines(statFilePath, &CpuLineProcessor{m: make(map[string]CpuStat)})
- return aux.(map[string]CpuStat), err
-}
-
-func getMemStats() (ms MemStat, err error) {
- var aux interface{}
- aux, err = processFileLines(meminfoFilePath, &MemStat{})
- return aux.(MemStat), err
-}
-
-type CpuTabElems struct {
- GMap map[string]*termui.Gauge
- LChart *termui.LineChart
-}
-
-func NewCpuTabElems(width int) *CpuTabElems {
- lc := termui.NewLineChart()
- lc.Width = width
- lc.Height = 12
- lc.X = 0
- lc.Mode = "dot"
- lc.BorderLabel = "CPU"
- return &CpuTabElems{GMap: make(map[string]*termui.Gauge),
- LChart: lc}
-}
-
-func (cte *CpuTabElems) AddGauge(key string, Y int, width int) *termui.Gauge {
- cte.GMap[key] = termui.NewGauge()
- cte.GMap[key].Width = width
- cte.GMap[key].Height = 3
- cte.GMap[key].Y = Y
- cte.GMap[key].BorderLabel = key
- cte.GMap[key].Percent = 0 //int(val.user + val.nice + val.system)
- return cte.GMap[key]
-}
-
-func (cte *CpuTabElems) Update(cs CpusStats) {
- for key, val := range cs.proc {
- p := int(val.user + val.nice + val.system)
- cte.GMap[key].Percent = p
- if key == "cpu" {
- cte.LChart.Data = append(cte.LChart.Data, 0)
- copy(cte.LChart.Data[1:], cte.LChart.Data[0:])
- cte.LChart.Data[0] = float64(p)
- }
- }
-}
-
-type MemTabElems struct {
- Gauge *termui.Gauge
- SLines *termui.Sparklines
-}
-
-func NewMemTabElems(width int) *MemTabElems {
- g := termui.NewGauge()
- g.Width = width
- g.Height = 3
- g.Y = 0
-
- sline := termui.NewSparkline()
- sline.Title = "MEM"
- sline.Height = 8
-
- sls := termui.NewSparklines(sline)
- sls.Width = width
- sls.Height = 12
- sls.Y = 3
- return &MemTabElems{Gauge: g, SLines: sls}
-}
-
-func (mte *MemTabElems) Update(ms MemStat) {
- used := int((ms.total - ms.free) * 100 / ms.total)
- mte.Gauge.Percent = used
- mte.SLines.Lines[0].Data = append(mte.SLines.Lines[0].Data, 0)
- copy(mte.SLines.Lines[0].Data[1:], mte.SLines.Lines[0].Data[0:])
- mte.SLines.Lines[0].Data[0] = used
- if len(mte.SLines.Lines[0].Data) > mte.SLines.Width-2 {
- mte.SLines.Lines[0].Data = mte.SLines.Lines[0].Data[0 : mte.SLines.Width-2]
- }
-}
-
-func main() {
- if runtime.GOOS != "linux" {
- panic("Currently works only on Linux")
- }
- err := termui.Init()
- if err != nil {
- panic(err)
- }
- defer termui.Close()
-
- termWidth := 70
-
- //termui.UseTheme("helloworld")
-
- header := termui.NewPar("Press q to quit, Press j or k to switch tabs")
- header.Height = 1
- header.Width = 50
- header.Border = false
- header.TextBgColor = termui.ColorBlue
-
- tabCpu := extra.NewTab("CPU")
- tabMem := extra.NewTab("MEM")
-
- tabpane := extra.NewTabpane()
- tabpane.Y = 1
- tabpane.Width = 30
- tabpane.Border = false
-
- cs, errcs := getCpusStatsMap()
- cpusStats := NewCpusStats(cs)
-
- if errcs != nil {
- panic("error")
- }
-
- cpuTabElems := NewCpuTabElems(termWidth)
-
- Y := 0
- cpuKeys := make([]string, 0, len(cs))
- for key := range cs {
- cpuKeys = append(cpuKeys, key)
- }
- sort.Strings(cpuKeys)
- for _, key := range cpuKeys {
- g := cpuTabElems.AddGauge(key, Y, termWidth)
- Y += 3
- tabCpu.AddBlocks(g)
- }
- cpuTabElems.LChart.Y = Y
- tabCpu.AddBlocks(cpuTabElems.LChart)
-
- memTabElems := NewMemTabElems(termWidth)
- ms, errm := getMemStats()
- if errm != nil {
- panic(errm)
- }
- memTabElems.Update(ms)
- tabMem.AddBlocks(memTabElems.Gauge)
- tabMem.AddBlocks(memTabElems.SLines)
-
- tabpane.SetTabs(*tabCpu, *tabMem)
-
- termui.Render(header, tabpane)
-
- termui.Handle("/sys/kbd/q", func(termui.Event) {
- termui.StopLoop()
- })
-
- termui.Handle("/sys/kbd/j", func(termui.Event) {
- tabpane.SetActiveLeft()
- termui.Render(header, tabpane)
- })
-
- termui.Handle("/sys/kbd/k", func(termui.Event) {
- tabpane.SetActiveRight()
- termui.Render(header, tabpane)
- })
-
- termui.Handle("/timer/1s", func(e termui.Event) {
- cs, errcs := getCpusStatsMap()
- if errcs != nil {
- panic(errcs)
- }
- cpusStats.tick(cs)
- cpuTabElems.Update(*cpusStats)
-
- ms, errm := getMemStats()
- if errm != nil {
- panic(errm)
- }
- memTabElems.Update(ms)
- termui.Render(header, tabpane)
- })
-
- termui.Loop()
-}
diff --git a/vendor/github.com/gizak/termui/_example/wrappar.go b/vendor/github.com/gizak/termui/_example/wrappar.go
deleted file mode 100644
index 07e842d..0000000
--- a/vendor/github.com/gizak/termui/_example/wrappar.go
+++ /dev/null
@@ -1,35 +0,0 @@
-// Copyright 2017 Zack Guo . All rights reserved.
-// Use of this source code is governed by a MIT license that can
-// be found in the LICENSE file.
-
-package main
-
-import ui "github.com/gizak/termui"
-
-func main() {
-
- err := ui.Init()
- if err != nil {
- panic(err)
- }
- defer ui.Close()
-
- p := ui.NewPar("Press q to QUIT THE DEMO. [There](fg-blue) are other things [that](fg-red) are going to fit in here I think. What do you think? Now is the time for all good [men to](bg-blue) come to the aid of their country. [This is going to be one really really really long line](fg-green) that is going to go together and stuffs and things. Let's see how this thing renders out.\n Here is a new paragraph and stuffs and things. There should be a tab indent at the beginning of the paragraph. Let's see if that worked as well.")
- p.WrapLength = 48 // this should be at least p.Width - 2
- p.Height = 20
- p.Width = 50
- p.Y = 2
- p.X = 20
- p.TextFgColor = ui.ColorWhite
- p.BorderLabel = "Text Box with Wrapping"
- p.BorderFg = ui.ColorCyan
- //p.Border = false
-
- ui.Render(p)
-
- ui.Handle("/sys/kbd/q", func(ui.Event) {
- ui.StopLoop()
- })
-
- ui.Loop()
-}
diff --git a/vendor/github.com/gizak/termui/barchart.go b/vendor/github.com/gizak/termui/barchart.go
deleted file mode 100644
index 6560c8b..0000000
--- a/vendor/github.com/gizak/termui/barchart.go
+++ /dev/null
@@ -1,149 +0,0 @@
-// Copyright 2017 Zack Guo . All rights reserved.
-// Use of this source code is governed by a MIT license that can
-// be found in the LICENSE file.
-
-package termui
-
-import "fmt"
-
-// BarChart creates multiple bars in a widget:
-/*
- bc := termui.NewBarChart()
- data := []int{3, 2, 5, 3, 9, 5}
- bclabels := []string{"S0", "S1", "S2", "S3", "S4", "S5"}
- bc.BorderLabel = "Bar Chart"
- bc.Data = data
- bc.Width = 26
- bc.Height = 10
- bc.DataLabels = bclabels
- bc.TextColor = termui.ColorGreen
- bc.BarColor = termui.ColorRed
- bc.NumColor = termui.ColorYellow
-*/
-type BarChart struct {
- Block
- BarColor Attribute
- TextColor Attribute
- NumColor Attribute
- Data []int
- DataLabels []string
- BarWidth int
- BarGap int
- CellChar rune
- labels [][]rune
- dataNum [][]rune
- numBar int
- scale float64
- max int
-}
-
-// NewBarChart returns a new *BarChart with current theme.
-func NewBarChart() *BarChart {
- bc := &BarChart{Block: *NewBlock()}
- bc.BarColor = ThemeAttr("barchart.bar.bg")
- bc.NumColor = ThemeAttr("barchart.num.fg")
- bc.TextColor = ThemeAttr("barchart.text.fg")
- bc.BarGap = 1
- bc.BarWidth = 3
- bc.CellChar = ' '
- return bc
-}
-
-func (bc *BarChart) layout() {
- bc.numBar = bc.innerArea.Dx() / (bc.BarGap + bc.BarWidth)
- bc.labels = make([][]rune, bc.numBar)
- bc.dataNum = make([][]rune, len(bc.Data))
-
- for i := 0; i < bc.numBar && i < len(bc.DataLabels) && i < len(bc.Data); i++ {
- bc.labels[i] = trimStr2Runes(bc.DataLabels[i], bc.BarWidth)
- n := bc.Data[i]
- s := fmt.Sprint(n)
- bc.dataNum[i] = trimStr2Runes(s, bc.BarWidth)
- }
-
- //bc.max = bc.Data[0] // what if Data is nil? Sometimes when bar graph is nill it produces panic with panic: runtime error: index out of range
- // Asign a negative value to get maxvalue auto-populates
- if bc.max == 0 {
- bc.max = -1
- }
- for i := 0; i < len(bc.Data); i++ {
- if bc.max < bc.Data[i] {
- bc.max = bc.Data[i]
- }
- }
- bc.scale = float64(bc.max) / float64(bc.innerArea.Dy()-1)
-}
-
-func (bc *BarChart) SetMax(max int) {
-
- if max > 0 {
- bc.max = max
- }
-}
-
-// Buffer implements Bufferer interface.
-func (bc *BarChart) Buffer() Buffer {
- buf := bc.Block.Buffer()
- bc.layout()
-
- for i := 0; i < bc.numBar && i < len(bc.Data) && i < len(bc.DataLabels); i++ {
- h := int(float64(bc.Data[i]) / bc.scale)
- oftX := i * (bc.BarWidth + bc.BarGap)
-
- barBg := bc.Bg
- barFg := bc.BarColor
-
- if bc.CellChar == ' ' {
- barBg = bc.BarColor
- barFg = ColorDefault
- if bc.BarColor == ColorDefault { // the same as above
- barBg |= AttrReverse
- }
- }
-
- // plot bar
- for j := 0; j < bc.BarWidth; j++ {
- for k := 0; k < h; k++ {
- c := Cell{
- Ch: bc.CellChar,
- Bg: barBg,
- Fg: barFg,
- }
-
- x := bc.innerArea.Min.X + i*(bc.BarWidth+bc.BarGap) + j
- y := bc.innerArea.Min.Y + bc.innerArea.Dy() - 2 - k
- buf.Set(x, y, c)
- }
- }
- // plot text
- for j, k := 0, 0; j < len(bc.labels[i]); j++ {
- w := charWidth(bc.labels[i][j])
- c := Cell{
- Ch: bc.labels[i][j],
- Bg: bc.Bg,
- Fg: bc.TextColor,
- }
- y := bc.innerArea.Min.Y + bc.innerArea.Dy() - 1
- x := bc.innerArea.Min.X + oftX + k
- buf.Set(x, y, c)
- k += w
- }
- // plot num
- for j := 0; j < len(bc.dataNum[i]); j++ {
- c := Cell{
- Ch: bc.dataNum[i][j],
- Fg: bc.NumColor,
- Bg: barBg,
- }
-
- if h == 0 {
- c.Bg = bc.Bg
- }
- x := bc.innerArea.Min.X + oftX + (bc.BarWidth-len(bc.dataNum[i]))/2 + j
- y := bc.innerArea.Min.Y + bc.innerArea.Dy() - 2
- buf.Set(x, y, c)
- }
- }
-
- return buf
-}
diff --git a/vendor/github.com/gizak/termui/block.go b/vendor/github.com/gizak/termui/block.go
deleted file mode 100644
index 3e8571b..0000000
--- a/vendor/github.com/gizak/termui/block.go
+++ /dev/null
@@ -1,240 +0,0 @@
-// Copyright 2017 Zack Guo . All rights reserved.
-// Use of this source code is governed by a MIT license that can
-// be found in the LICENSE file.
-
-package termui
-
-import "image"
-
-// Hline is a horizontal line.
-type Hline struct {
- X int
- Y int
- Len int
- Fg Attribute
- Bg Attribute
-}
-
-// Vline is a vertical line.
-type Vline struct {
- X int
- Y int
- Len int
- Fg Attribute
- Bg Attribute
-}
-
-// Buffer draws a horizontal line.
-func (l Hline) Buffer() Buffer {
- if l.Len <= 0 {
- return NewBuffer()
- }
- return NewFilledBuffer(l.X, l.Y, l.X+l.Len, l.Y+1, HORIZONTAL_LINE, l.Fg, l.Bg)
-}
-
-// Buffer draws a vertical line.
-func (l Vline) Buffer() Buffer {
- if l.Len <= 0 {
- return NewBuffer()
- }
- return NewFilledBuffer(l.X, l.Y, l.X+1, l.Y+l.Len, VERTICAL_LINE, l.Fg, l.Bg)
-}
-
-// Buffer draws a box border.
-func (b Block) drawBorder(buf Buffer) {
- if !b.Border {
- return
- }
-
- min := b.area.Min
- max := b.area.Max
-
- x0 := min.X
- y0 := min.Y
- x1 := max.X - 1
- y1 := max.Y - 1
-
- // draw lines
- if b.BorderTop {
- buf.Merge(Hline{x0, y0, x1 - x0, b.BorderFg, b.BorderBg}.Buffer())
- }
- if b.BorderBottom {
- buf.Merge(Hline{x0, y1, x1 - x0, b.BorderFg, b.BorderBg}.Buffer())
- }
- if b.BorderLeft {
- buf.Merge(Vline{x0, y0, y1 - y0, b.BorderFg, b.BorderBg}.Buffer())
- }
- if b.BorderRight {
- buf.Merge(Vline{x1, y0, y1 - y0, b.BorderFg, b.BorderBg}.Buffer())
- }
-
- // draw corners
- if b.BorderTop && b.BorderLeft && b.area.Dx() > 0 && b.area.Dy() > 0 {
- buf.Set(x0, y0, Cell{TOP_LEFT, b.BorderFg, b.BorderBg})
- }
- if b.BorderTop && b.BorderRight && b.area.Dx() > 1 && b.area.Dy() > 0 {
- buf.Set(x1, y0, Cell{TOP_RIGHT, b.BorderFg, b.BorderBg})
- }
- if b.BorderBottom && b.BorderLeft && b.area.Dx() > 0 && b.area.Dy() > 1 {
- buf.Set(x0, y1, Cell{BOTTOM_LEFT, b.BorderFg, b.BorderBg})
- }
- if b.BorderBottom && b.BorderRight && b.area.Dx() > 1 && b.area.Dy() > 1 {
- buf.Set(x1, y1, Cell{BOTTOM_RIGHT, b.BorderFg, b.BorderBg})
- }
-}
-
-func (b Block) drawBorderLabel(buf Buffer) {
- maxTxtW := b.area.Dx() - 2
- tx := DTrimTxCls(DefaultTxBuilder.Build(b.BorderLabel, b.BorderLabelFg, b.BorderLabelBg), maxTxtW)
-
- for i, w := 0, 0; i < len(tx); i++ {
- buf.Set(b.area.Min.X+1+w, b.area.Min.Y, tx[i])
- w += tx[i].Width()
- }
-}
-
-// Block is a base struct for all other upper level widgets,
-// consider it as css: display:block.
-// Normally you do not need to create it manually.
-type Block struct {
- area image.Rectangle
- innerArea image.Rectangle
- X int
- Y int
- Border bool
- BorderFg Attribute
- BorderBg Attribute
- BorderLeft bool
- BorderRight bool
- BorderTop bool
- BorderBottom bool
- BorderLabel string
- BorderLabelFg Attribute
- BorderLabelBg Attribute
- Display bool
- Bg Attribute
- Width int
- Height int
- PaddingTop int
- PaddingBottom int
- PaddingLeft int
- PaddingRight int
- id string
- Float Align
-}
-
-// NewBlock returns a *Block which inherits styles from current theme.
-func NewBlock() *Block {
- b := Block{}
- b.Display = true
- b.Border = true
- b.BorderLeft = true
- b.BorderRight = true
- b.BorderTop = true
- b.BorderBottom = true
- b.BorderBg = ThemeAttr("border.bg")
- b.BorderFg = ThemeAttr("border.fg")
- b.BorderLabelBg = ThemeAttr("label.bg")
- b.BorderLabelFg = ThemeAttr("label.fg")
- b.Bg = ThemeAttr("block.bg")
- b.Width = 2
- b.Height = 2
- b.id = GenId()
- b.Float = AlignNone
- return &b
-}
-
-func (b Block) Id() string {
- return b.id
-}
-
-// Align computes box model
-func (b *Block) Align() {
- // outer
- b.area.Min.X = 0
- b.area.Min.Y = 0
- b.area.Max.X = b.Width
- b.area.Max.Y = b.Height
-
- // float
- b.area = AlignArea(TermRect(), b.area, b.Float)
- b.area = MoveArea(b.area, b.X, b.Y)
-
- // inner
- b.innerArea.Min.X = b.area.Min.X + b.PaddingLeft
- b.innerArea.Min.Y = b.area.Min.Y + b.PaddingTop
- b.innerArea.Max.X = b.area.Max.X - b.PaddingRight
- b.innerArea.Max.Y = b.area.Max.Y - b.PaddingBottom
-
- if b.Border {
- if b.BorderLeft {
- b.innerArea.Min.X++
- }
- if b.BorderRight {
- b.innerArea.Max.X--
- }
- if b.BorderTop {
- b.innerArea.Min.Y++
- }
- if b.BorderBottom {
- b.innerArea.Max.Y--
- }
- }
-}
-
-// InnerBounds returns the internal bounds of the block after aligning and
-// calculating the padding and border, if any.
-func (b *Block) InnerBounds() image.Rectangle {
- b.Align()
- return b.innerArea
-}
-
-// Buffer implements Bufferer interface.
-// Draw background and border (if any).
-func (b *Block) Buffer() Buffer {
- b.Align()
-
- buf := NewBuffer()
- buf.SetArea(b.area)
- buf.Fill(' ', ColorDefault, b.Bg)
-
- b.drawBorder(buf)
- b.drawBorderLabel(buf)
-
- return buf
-}
-
-// GetHeight implements GridBufferer.
-// It returns current height of the block.
-func (b Block) GetHeight() int {
- return b.Height
-}
-
-// SetX implements GridBufferer interface, which sets block's x position.
-func (b *Block) SetX(x int) {
- b.X = x
-}
-
-// SetY implements GridBufferer interface, it sets y position for block.
-func (b *Block) SetY(y int) {
- b.Y = y
-}
-
-// SetWidth implements GridBuffer interface, it sets block's width.
-func (b *Block) SetWidth(w int) {
- b.Width = w
-}
-
-func (b Block) InnerWidth() int {
- return b.innerArea.Dx()
-}
-
-func (b Block) InnerHeight() int {
- return b.innerArea.Dy()
-}
-
-func (b Block) InnerX() int {
- return b.innerArea.Min.X
-}
-
-func (b Block) InnerY() int { return b.innerArea.Min.Y }
diff --git a/vendor/github.com/gizak/termui/block_common.go b/vendor/github.com/gizak/termui/block_common.go
deleted file mode 100644
index 6438bf2..0000000
--- a/vendor/github.com/gizak/termui/block_common.go
+++ /dev/null
@@ -1,20 +0,0 @@
-// Copyright 2017 Zack Guo . All rights reserved.
-// Use of this source code is governed by a MIT license that can
-// be found in the LICENSE file.
-
-// +build !windows
-
-package termui
-
-const TOP_RIGHT = '┐'
-const VERTICAL_LINE = '│'
-const HORIZONTAL_LINE = '─'
-const TOP_LEFT = '┌'
-const BOTTOM_RIGHT = '┘'
-const BOTTOM_LEFT = '└'
-const VERTICAL_LEFT = '┤'
-const VERTICAL_RIGHT = '├'
-const HORIZONTAL_DOWN = '┬'
-const HORIZONTAL_UP = '┴'
-const QUOTA_LEFT = '«'
-const QUOTA_RIGHT = '»'
diff --git a/vendor/github.com/gizak/termui/block_test.go b/vendor/github.com/gizak/termui/block_test.go
deleted file mode 100644
index 8194179..0000000
--- a/vendor/github.com/gizak/termui/block_test.go
+++ /dev/null
@@ -1,72 +0,0 @@
-// Copyright 2017 Zack Guo . All rights reserved.
-// Use of this source code is governed by a MIT license that can
-// be found in the LICENSE file.
-
-package termui
-
-import (
- "testing"
-)
-
-func TestBlockFloat(t *testing.T) {
- Init()
- defer Close()
-
- b := NewBlock()
- b.X = 10
- b.Y = 20
-
- b.Float = AlignCenter
- b.Align()
-}
-
-func TestBlockInnerBounds(t *testing.T) {
- Init()
- defer Close()
-
- b := NewBlock()
- b.X = 10
- b.Y = 11
- b.Width = 12
- b.Height = 13
-
- assert := func(name string, x, y, w, h int) {
- t.Log(name)
- area := b.InnerBounds()
- cx := area.Min.X
- cy := area.Min.Y
- cw := area.Dx()
- ch := area.Dy()
-
- if cx != x {
- t.Errorf("expected x to be %d but got %d", x, cx)
- }
- if cy != y {
- t.Errorf("expected y to be %d but got %d\n%+v", y, cy, area)
- }
- if cw != w {
- t.Errorf("expected width to be %d but got %d", w, cw)
- }
- if ch != h {
- t.Errorf("expected height to be %d but got %d", h, ch)
- }
- }
-
- b.Border = false
- assert("no border, no padding", 10, 11, 12, 13)
-
- b.Border = true
- assert("border, no padding", 11, 12, 10, 11)
-
- b.PaddingBottom = 2
- assert("border, 2b padding", 11, 12, 10, 9)
-
- b.PaddingTop = 3
- assert("border, 2b 3t padding", 11, 15, 10, 6)
-
- b.PaddingLeft = 4
- assert("border, 2b 3t 4l padding", 15, 15, 6, 6)
-
- b.PaddingRight = 5
- assert("border, 2b 3t 4l 5r padding", 15, 15, 1, 6)
-}
diff --git a/vendor/github.com/gizak/termui/block_windows.go b/vendor/github.com/gizak/termui/block_windows.go
deleted file mode 100644
index a4fba77..0000000
--- a/vendor/github.com/gizak/termui/block_windows.go
+++ /dev/null
@@ -1,14 +0,0 @@
-// Copyright 2017 Zack Guo . All rights reserved.
-// Use of this source code is governed by a MIT license that can
-// be found in the LICENSE file.
-
-// +build windows
-
-package termui
-
-const TOP_RIGHT = '+'
-const VERTICAL_LINE = '|'
-const HORIZONTAL_LINE = '-'
-const TOP_LEFT = '+'
-const BOTTOM_RIGHT = '+'
-const BOTTOM_LEFT = '+'
diff --git a/vendor/github.com/gizak/termui/buffer.go b/vendor/github.com/gizak/termui/buffer.go
deleted file mode 100644
index 9e3a973..0000000
--- a/vendor/github.com/gizak/termui/buffer.go
+++ /dev/null
@@ -1,106 +0,0 @@
-// Copyright 2017 Zack Guo . All rights reserved.
-// Use of this source code is governed by a MIT license that can
-// be found in the LICENSE file.
-
-package termui
-
-import "image"
-
-// Cell is a rune with assigned Fg and Bg
-type Cell struct {
- Ch rune
- Fg Attribute
- Bg Attribute
-}
-
-// Buffer is a renderable rectangle cell data container.
-type Buffer struct {
- Area image.Rectangle // selected drawing area
- CellMap map[image.Point]Cell
-}
-
-// At returns the cell at (x,y).
-func (b Buffer) At(x, y int) Cell {
- return b.CellMap[image.Pt(x, y)]
-}
-
-// Set assigns a char to (x,y)
-func (b Buffer) Set(x, y int, c Cell) {
- b.CellMap[image.Pt(x, y)] = c
-}
-
-// Bounds returns the domain for which At can return non-zero color.
-func (b Buffer) Bounds() image.Rectangle {
- x0, y0, x1, y1 := 0, 0, 0, 0
- for p := range b.CellMap {
- if p.X > x1 {
- x1 = p.X
- }
- if p.X < x0 {
- x0 = p.X
- }
- if p.Y > y1 {
- y1 = p.Y
- }
- if p.Y < y0 {
- y0 = p.Y
- }
- }
- return image.Rect(x0, y0, x1+1, y1+1)
-}
-
-// SetArea assigns a new rect area to Buffer b.
-func (b *Buffer) SetArea(r image.Rectangle) {
- b.Area.Max = r.Max
- b.Area.Min = r.Min
-}
-
-// Sync sets drawing area to the buffer's bound
-func (b *Buffer) Sync() {
- b.SetArea(b.Bounds())
-}
-
-// NewCell returns a new cell
-func NewCell(ch rune, fg, bg Attribute) Cell {
- return Cell{ch, fg, bg}
-}
-
-// Merge merges bs Buffers onto b
-func (b *Buffer) Merge(bs ...Buffer) {
- for _, buf := range bs {
- for p, v := range buf.CellMap {
- b.Set(p.X, p.Y, v)
- }
- b.SetArea(b.Area.Union(buf.Area))
- }
-}
-
-// NewBuffer returns a new Buffer
-func NewBuffer() Buffer {
- return Buffer{
- CellMap: make(map[image.Point]Cell),
- Area: image.Rectangle{}}
-}
-
-// Fill fills the Buffer b with ch,fg and bg.
-func (b Buffer) Fill(ch rune, fg, bg Attribute) {
- for x := b.Area.Min.X; x < b.Area.Max.X; x++ {
- for y := b.Area.Min.Y; y < b.Area.Max.Y; y++ {
- b.Set(x, y, Cell{ch, fg, bg})
- }
- }
-}
-
-// NewFilledBuffer returns a new Buffer filled with ch, fb and bg.
-func NewFilledBuffer(x0, y0, x1, y1 int, ch rune, fg, bg Attribute) Buffer {
- buf := NewBuffer()
- buf.Area.Min = image.Pt(x0, y0)
- buf.Area.Max = image.Pt(x1, y1)
-
- for x := buf.Area.Min.X; x < buf.Area.Max.X; x++ {
- for y := buf.Area.Min.Y; y < buf.Area.Max.Y; y++ {
- buf.Set(x, y, Cell{ch, fg, bg})
- }
- }
- return buf
-}
diff --git a/vendor/github.com/gizak/termui/buffer_test.go b/vendor/github.com/gizak/termui/buffer_test.go
deleted file mode 100644
index aae9d08..0000000
--- a/vendor/github.com/gizak/termui/buffer_test.go
+++ /dev/null
@@ -1,23 +0,0 @@
-// Copyright 2017 Zack Guo . All rights reserved.
-// Use of this source code is governed by a MIT license that can
-// be found in the LICENSE file.
-
-package termui
-
-import (
- "image"
- "testing"
-)
-
-func TestBufferUnion(t *testing.T) {
- b0 := NewBuffer()
- b1 := NewBuffer()
-
- b1.Area.Max.X = 100
- b1.Area.Max.Y = 100
- b0.Area.Max.X = 50
- b0.Merge(b1)
- if b0.Area.Max.X != 100 {
- t.Errorf("Buffer.Merge unions Area failed: should:%v, actual %v,%v", image.Rect(0, 0, 50, 0).Union(image.Rect(0, 0, 100, 100)), b1.Area, b0.Area)
- }
-}
diff --git a/vendor/github.com/gizak/termui/canvas.go b/vendor/github.com/gizak/termui/canvas.go
deleted file mode 100644
index 6d2513e..0000000
--- a/vendor/github.com/gizak/termui/canvas.go
+++ /dev/null
@@ -1,72 +0,0 @@
-// Copyright 2017 Zack Guo . All rights reserved.
-// Use of this source code is governed by a MIT license that can
-// be found in the LICENSE file.
-
-package termui
-
-/*
-dots:
- ,___,
- |1 4|
- |2 5|
- |3 6|
- |7 8|
- `````
-*/
-
-var brailleBase = '\u2800'
-
-var brailleOftMap = [4][2]rune{
- {'\u0001', '\u0008'},
- {'\u0002', '\u0010'},
- {'\u0004', '\u0020'},
- {'\u0040', '\u0080'}}
-
-// Canvas contains drawing map: i,j -> rune
-type Canvas map[[2]int]rune
-
-// NewCanvas returns an empty Canvas
-func NewCanvas() Canvas {
- return make(map[[2]int]rune)
-}
-
-func chOft(x, y int) rune {
- return brailleOftMap[y%4][x%2]
-}
-
-func (c Canvas) rawCh(x, y int) rune {
- if ch, ok := c[[2]int{x, y}]; ok {
- return ch
- }
- return '\u0000' //brailleOffset
-}
-
-// return coordinate in terminal
-func chPos(x, y int) (int, int) {
- return y / 4, x / 2
-}
-
-// Set sets a point (x,y) in the virtual coordinate
-func (c Canvas) Set(x, y int) {
- i, j := chPos(x, y)
- ch := c.rawCh(i, j)
- ch |= chOft(x, y)
- c[[2]int{i, j}] = ch
-}
-
-// Unset removes point (x,y)
-func (c Canvas) Unset(x, y int) {
- i, j := chPos(x, y)
- ch := c.rawCh(i, j)
- ch &= ^chOft(x, y)
- c[[2]int{i, j}] = ch
-}
-
-// Buffer returns un-styled points
-func (c Canvas) Buffer() Buffer {
- buf := NewBuffer()
- for k, v := range c {
- buf.Set(k[0], k[1], Cell{Ch: v + brailleBase})
- }
- return buf
-}
diff --git a/vendor/github.com/gizak/termui/canvas_test.go b/vendor/github.com/gizak/termui/canvas_test.go
deleted file mode 100644
index f73ce48..0000000
--- a/vendor/github.com/gizak/termui/canvas_test.go
+++ /dev/null
@@ -1,57 +0,0 @@
-// Copyright 2017 Zack Guo . All rights reserved.
-// Use of this source code is governed by a MIT license that can
-// be found in the LICENSE file.
-
-// +build ignore
-
-package termui
-
-import (
- "testing"
-
- "github.com/davecgh/go-spew/spew"
-)
-
-func TestCanvasSet(t *testing.T) {
- c := NewCanvas()
- c.Set(0, 0)
- c.Set(0, 1)
- c.Set(0, 2)
- c.Set(0, 3)
- c.Set(1, 3)
- c.Set(2, 3)
- c.Set(3, 3)
- c.Set(4, 3)
- c.Set(5, 3)
- spew.Dump(c)
-}
-
-func TestCanvasUnset(t *testing.T) {
- c := NewCanvas()
- c.Set(0, 0)
- c.Set(0, 1)
- c.Set(0, 2)
- c.Unset(0, 2)
- spew.Dump(c)
- c.Unset(0, 3)
- spew.Dump(c)
-}
-
-func TestCanvasBuffer(t *testing.T) {
- c := NewCanvas()
- c.Set(0, 0)
- c.Set(0, 1)
- c.Set(0, 2)
- c.Set(0, 3)
- c.Set(1, 3)
- c.Set(2, 3)
- c.Set(3, 3)
- c.Set(4, 3)
- c.Set(5, 3)
- c.Set(6, 3)
- c.Set(7, 2)
- c.Set(8, 1)
- c.Set(9, 0)
- bufs := c.Buffer()
- spew.Dump(bufs)
-}
diff --git a/vendor/github.com/gizak/termui/config.py b/vendor/github.com/gizak/termui/config.py
deleted file mode 100644
index 30fadcf..0000000
--- a/vendor/github.com/gizak/termui/config.py
+++ /dev/null
@@ -1,54 +0,0 @@
-#!/usr/bin/env python3
-
-import re
-import os
-import io
-
-copyright = """// Copyright 2017 Zack Guo . All rights reserved.
-// Use of this source code is governed by a MIT license that can
-// be found in the LICENSE file.
-
-"""
-
-exclude_dirs = [".git", "_docs"]
-exclude_files = []
-include_dirs = [".", "debug", "extra", "test", "_example"]
-
-
-def is_target(fpath):
- if os.path.splitext(fpath)[-1] == ".go":
- return True
- return False
-
-
-def update_copyright(fpath):
- print("processing " + fpath)
- f = io.open(fpath, 'r', encoding='utf-8')
- fstr = f.read()
- f.close()
-
- # remove old
- m = re.search('^// Copyright .+?\r?\n\r?\n', fstr, re.MULTILINE|re.DOTALL)
- if m:
- fstr = fstr[m.end():]
-
- # add new
- fstr = copyright + fstr
- f = io.open(fpath, 'w',encoding='utf-8')
- f.write(fstr)
- f.close()
-
-
-def main():
- for d in include_dirs:
- files = [
- os.path.join(d, f) for f in os.listdir(d)
- if os.path.isfile(os.path.join(d, f))
- ]
- for f in files:
- if is_target(f):
- update_copyright(f)
-
-
-if __name__ == '__main__':
- main()
diff --git a/vendor/github.com/gizak/termui/debug/debuger.go b/vendor/github.com/gizak/termui/debug/debuger.go
deleted file mode 100644
index e239ef5..0000000
--- a/vendor/github.com/gizak/termui/debug/debuger.go
+++ /dev/null
@@ -1,117 +0,0 @@
-// Copyright 2017 Zack Guo . All rights reserved.
-// Use of this source code is governed by a MIT license that can
-// be found in the LICENSE file.
-
-package debug
-
-import (
- "fmt"
- "net/http"
-
- "golang.org/x/net/websocket"
-)
-
-type Server struct {
- Port string
- Addr string
- Path string
- Msg chan string
- chs []chan string
-}
-
-type Client struct {
- Port string
- Addr string
- Path string
- ws *websocket.Conn
-}
-
-var defaultPort = ":8080"
-
-func NewServer() *Server {
- return &Server{
- Port: defaultPort,
- Addr: "localhost",
- Path: "/echo",
- Msg: make(chan string),
- chs: make([]chan string, 0),
- }
-}
-
-func NewClient() Client {
- return Client{
- Port: defaultPort,
- Addr: "localhost",
- Path: "/echo",
- }
-}
-
-func (c Client) ConnectAndListen() error {
- ws, err := websocket.Dial("ws://"+c.Addr+c.Port+c.Path, "", "http://"+c.Addr)
- if err != nil {
- return err
- }
- defer ws.Close()
-
- var m string
- for {
- err := websocket.Message.Receive(ws, &m)
- if err != nil {
- fmt.Print(err)
- return err
- }
- fmt.Print(m)
- }
-}
-
-func (s *Server) ListenAndServe() error {
- http.Handle(s.Path, websocket.Handler(func(ws *websocket.Conn) {
- defer ws.Close()
-
- mc := make(chan string)
- s.chs = append(s.chs, mc)
-
- for m := range mc {
- websocket.Message.Send(ws, m)
- }
- }))
-
- go func() {
- for msg := range s.Msg {
- for _, c := range s.chs {
- go func(a chan string) {
- a <- msg
- }(c)
- }
- }
- }()
-
- return http.ListenAndServe(s.Port, nil)
-}
-
-func (s *Server) Log(msg string) {
- go func() { s.Msg <- msg }()
-}
-
-func (s *Server) Logf(format string, a ...interface{}) {
- s.Log(fmt.Sprintf(format, a...))
-}
-
-var DefaultServer = NewServer()
-var DefaultClient = NewClient()
-
-func ListenAndServe() error {
- return DefaultServer.ListenAndServe()
-}
-
-func ConnectAndListen() error {
- return DefaultClient.ConnectAndListen()
-}
-
-func Log(msg string) {
- DefaultServer.Log(msg)
-}
-
-func Logf(format string, a ...interface{}) {
- DefaultServer.Logf(format, a...)
-}
diff --git a/vendor/github.com/gizak/termui/doc.go b/vendor/github.com/gizak/termui/doc.go
deleted file mode 100644
index 13924eb..0000000
--- a/vendor/github.com/gizak/termui/doc.go
+++ /dev/null
@@ -1,29 +0,0 @@
-// Copyright 2017 Zack Guo . All rights reserved.
-// Use of this source code is governed by a MIT license that can
-// be found in the LICENSE file.
-
-/*
-Package termui is a library designed for creating command line UI. For more info, goto http://github.com/gizak/termui
-
-A simplest example:
- package main
-
- import ui "github.com/gizak/termui"
-
- func main() {
- if err:=ui.Init(); err != nil {
- panic(err)
- }
- defer ui.Close()
-
- g := ui.NewGauge()
- g.Percent = 50
- g.Width = 50
- g.BorderLabel = "Gauge"
-
- ui.Render(g)
-
- ui.Loop()
- }
-*/
-package termui
diff --git a/vendor/github.com/gizak/termui/events.go b/vendor/github.com/gizak/termui/events.go
deleted file mode 100644
index eb7319b..0000000
--- a/vendor/github.com/gizak/termui/events.go
+++ /dev/null
@@ -1,323 +0,0 @@
-// Copyright 2017 Zack Guo . All rights reserved.
-// Use of this source code is governed by a MIT license that can
-// be found in the LICENSE file.
-
-package termui
-
-import (
- "path"
- "strconv"
- "sync"
- "time"
-
- "github.com/nsf/termbox-go"
-)
-
-type Event struct {
- Type string
- Path string
- From string
- To string
- Data interface{}
- Time int64
-}
-
-var sysEvtChs []chan Event
-
-type EvtKbd struct {
- KeyStr string
-}
-
-func evtKbd(e termbox.Event) EvtKbd {
- ek := EvtKbd{}
-
- k := string(e.Ch)
- pre := ""
- mod := ""
-
- if e.Mod == termbox.ModAlt {
- mod = "M-"
- }
- if e.Ch == 0 {
- if e.Key > 0xFFFF-12 {
- k = ""
- } else if e.Key > 0xFFFF-25 {
- ks := []string{"", "", "", "", "", "", "", "", "", ""}
- k = ks[0xFFFF-int(e.Key)-12]
- }
-
- if e.Key <= 0x7F {
- pre = "C-"
- k = string('a' - 1 + int(e.Key))
- kmap := map[termbox.Key][2]string{
- termbox.KeyCtrlSpace: {"C-", ""},
- termbox.KeyBackspace: {"", ""},
- termbox.KeyTab: {"", ""},
- termbox.KeyEnter: {"", ""},
- termbox.KeyEsc: {"", ""},
- termbox.KeyCtrlBackslash: {"C-", "\\"},
- termbox.KeyCtrlSlash: {"C-", "/"},
- termbox.KeySpace: {"", ""},
- termbox.KeyCtrl8: {"C-", "8"},
- }
- if sk, ok := kmap[e.Key]; ok {
- pre = sk[0]
- k = sk[1]
- }
- }
- }
-
- ek.KeyStr = pre + mod + k
- return ek
-}
-
-func crtTermboxEvt(e termbox.Event) Event {
- systypemap := map[termbox.EventType]string{
- termbox.EventKey: "keyboard",
- termbox.EventResize: "window",
- termbox.EventMouse: "mouse",
- termbox.EventError: "error",
- termbox.EventInterrupt: "interrupt",
- }
- ne := Event{From: "/sys", Time: time.Now().Unix()}
- typ := e.Type
- ne.Type = systypemap[typ]
-
- switch typ {
- case termbox.EventKey:
- kbd := evtKbd(e)
- ne.Path = "/sys/kbd/" + kbd.KeyStr
- ne.Data = kbd
- case termbox.EventResize:
- wnd := EvtWnd{}
- wnd.Width = e.Width
- wnd.Height = e.Height
- ne.Path = "/sys/wnd/resize"
- ne.Data = wnd
- case termbox.EventError:
- err := EvtErr(e.Err)
- ne.Path = "/sys/err"
- ne.Data = err
- case termbox.EventMouse:
- m := EvtMouse{}
- m.X = e.MouseX
- m.Y = e.MouseY
- ne.Path = "/sys/mouse"
- ne.Data = m
- }
- return ne
-}
-
-type EvtWnd struct {
- Width int
- Height int
-}
-
-type EvtMouse struct {
- X int
- Y int
- Press string
-}
-
-type EvtErr error
-
-func hookTermboxEvt() {
- for {
- e := termbox.PollEvent()
-
- for _, c := range sysEvtChs {
- go func(ch chan Event) {
- ch <- crtTermboxEvt(e)
- }(c)
- }
- }
-}
-
-func NewSysEvtCh() chan Event {
- ec := make(chan Event)
- sysEvtChs = append(sysEvtChs, ec)
- return ec
-}
-
-var DefaultEvtStream = NewEvtStream()
-
-type EvtStream struct {
- sync.RWMutex
- srcMap map[string]chan Event
- stream chan Event
- wg sync.WaitGroup
- sigStopLoop chan Event
- Handlers map[string]func(Event)
- hook func(Event)
-}
-
-func NewEvtStream() *EvtStream {
- return &EvtStream{
- srcMap: make(map[string]chan Event),
- stream: make(chan Event),
- Handlers: make(map[string]func(Event)),
- sigStopLoop: make(chan Event),
- }
-}
-
-func (es *EvtStream) Init() {
- es.Merge("internal", es.sigStopLoop)
- go func() {
- es.wg.Wait()
- close(es.stream)
- }()
-}
-
-func cleanPath(p string) string {
- if p == "" {
- return "/"
- }
- if p[0] != '/' {
- p = "/" + p
- }
- return path.Clean(p)
-}
-
-func isPathMatch(pattern, path string) bool {
- if len(pattern) == 0 {
- return false
- }
- n := len(pattern)
- return len(path) >= n && path[0:n] == pattern
-}
-
-func (es *EvtStream) Merge(name string, ec chan Event) {
- es.Lock()
- defer es.Unlock()
-
- es.wg.Add(1)
- es.srcMap[name] = ec
-
- go func(a chan Event) {
- for n := range a {
- n.From = name
- es.stream <- n
- }
- es.wg.Done()
- }(ec)
-}
-
-func (es *EvtStream) Handle(path string, handler func(Event)) {
- es.Handlers[cleanPath(path)] = handler
-}
-
-func findMatch(mux map[string]func(Event), path string) string {
- n := -1
- pattern := ""
- for m := range mux {
- if !isPathMatch(m, path) {
- continue
- }
- if len(m) > n {
- pattern = m
- n = len(m)
- }
- }
- return pattern
-
-}
-// Remove all existing defined Handlers from the map
-func (es *EvtStream) ResetHandlers() {
- for Path, _ := range es.Handlers {
- delete(es.Handlers, Path)
- }
- return
-}
-
-func (es *EvtStream) match(path string) string {
- return findMatch(es.Handlers, path)
-}
-
-func (es *EvtStream) Hook(f func(Event)) {
- es.hook = f
-}
-
-func (es *EvtStream) Loop() {
- for e := range es.stream {
- switch e.Path {
- case "/sig/stoploop":
- return
- }
- go func(a Event) {
- es.RLock()
- defer es.RUnlock()
- if pattern := es.match(a.Path); pattern != "" {
- es.Handlers[pattern](a)
- }
- }(e)
- if es.hook != nil {
- es.hook(e)
- }
- }
-}
-
-func (es *EvtStream) StopLoop() {
- go func() {
- e := Event{
- Path: "/sig/stoploop",
- }
- es.sigStopLoop <- e
- }()
-}
-
-func Merge(name string, ec chan Event) {
- DefaultEvtStream.Merge(name, ec)
-}
-
-func Handle(path string, handler func(Event)) {
- DefaultEvtStream.Handle(path, handler)
-}
-
-func Loop() {
- DefaultEvtStream.Loop()
-}
-
-func StopLoop() {
- DefaultEvtStream.StopLoop()
-}
-
-type EvtTimer struct {
- Duration time.Duration
- Count uint64
-}
-
-func NewTimerCh(du time.Duration) chan Event {
- t := make(chan Event)
-
- go func(a chan Event) {
- n := uint64(0)
- for {
- n++
- time.Sleep(du)
- e := Event{}
- e.Type = "timer"
- e.Path = "/timer/" + du.String()
- e.Time = time.Now().Unix()
- e.Data = EvtTimer{
- Duration: du,
- Count: n,
- }
- t <- e
-
- }
- }(t)
- return t
-}
-
-var DefualtHandler = func(e Event) {
-}
-
-var usrEvtCh = make(chan Event)
-
-func SendCustomEvt(path string, data interface{}) {
- e := Event{}
- e.Path = path
- e.Data = data
- e.Time = time.Now().Unix()
- usrEvtCh <- e
-}
diff --git a/vendor/github.com/gizak/termui/events_test.go b/vendor/github.com/gizak/termui/events_test.go
deleted file mode 100644
index 4e369e5..0000000
--- a/vendor/github.com/gizak/termui/events_test.go
+++ /dev/null
@@ -1,37 +0,0 @@
-// Copyright 2017 Zack Guo . All rights reserved.
-// Use of this source code is governed by a MIT license that can
-// be found in the LICENSE file.
-
-package termui
-
-import "testing"
-
-var ps = []string{
- "",
- "/",
- "/a",
- "/b",
- "/a/c",
- "/a/b",
- "/a/b/c",
- "/a/b/c/d",
- "/a/b/c/d/"}
-
-func TestMatchScore(t *testing.T) {
- chk := func(a, b string, s bool) {
- if c := isPathMatch(a, b); c != s {
- t.Errorf("\na:%s\nb:%s\nshould:%t\nactual:%t", a, b, s, c)
- }
- }
-
- chk(ps[1], ps[1], true)
- chk(ps[1], ps[2], true)
- chk(ps[2], ps[1], false)
- chk(ps[4], ps[1], false)
- chk(ps[6], ps[2], false)
- chk(ps[4], ps[5], false)
-}
-
-func TestCrtEvt(t *testing.T) {
-
-}
diff --git a/vendor/github.com/gizak/termui/extra/tabpane.go b/vendor/github.com/gizak/termui/extra/tabpane.go
deleted file mode 100644
index 879bb3b..0000000
--- a/vendor/github.com/gizak/termui/extra/tabpane.go
+++ /dev/null
@@ -1,265 +0,0 @@
-// Copyright 2017 Zack Guo . All rights reserved.
-// Use of this source code is governed by a MIT license that can
-// be found in the LICENSE file.
-
-package extra
-
-import (
- "unicode/utf8"
-
- . "github.com/gizak/termui"
-)
-
-type Tab struct {
- Label string
- RuneLen int
- Blocks []Bufferer
-}
-
-func NewTab(label string) *Tab {
- return &Tab{
- Label: label,
- RuneLen: utf8.RuneCount([]byte(label))}
-}
-
-func (tab *Tab) AddBlocks(rs ...Bufferer) {
- for _, r := range rs {
- tab.Blocks = append(tab.Blocks, r)
- }
-}
-
-func (tab *Tab) Buffer() Buffer {
- buf := NewBuffer()
- for blockNum := 0; blockNum < len(tab.Blocks); blockNum++ {
- b := tab.Blocks[blockNum]
- buf.Merge(b.Buffer())
- }
- return buf
-}
-
-type Tabpane struct {
- Block
- Tabs []Tab
- activeTabIndex int
- ActiveTabBg Attribute
- posTabText []int
- offTabText int
-}
-
-func NewTabpane() *Tabpane {
- tp := Tabpane{
- Block: *NewBlock(),
- activeTabIndex: 0,
- offTabText: 0,
- ActiveTabBg: ThemeAttr("bg.tab.active")}
- return &tp
-}
-
-func (tp *Tabpane) SetTabs(tabs ...Tab) {
- tp.Tabs = make([]Tab, len(tabs))
- tp.posTabText = make([]int, len(tabs)+1)
- off := 0
- for i := 0; i < len(tp.Tabs); i++ {
- tp.Tabs[i] = tabs[i]
- tp.posTabText[i] = off
- off += tp.Tabs[i].RuneLen + 1 //+1 for space between tabs
- }
- tp.posTabText[len(tabs)] = off - 1 //total length of Tab's text
-}
-
-func (tp *Tabpane) SetActiveLeft() {
- if tp.activeTabIndex == 0 {
- return
- }
- tp.activeTabIndex -= 1
- if tp.posTabText[tp.activeTabIndex] < tp.offTabText {
- tp.offTabText = tp.posTabText[tp.activeTabIndex]
- }
-}
-
-func (tp *Tabpane) SetActiveRight() {
- if tp.activeTabIndex == len(tp.Tabs)-1 {
- return
- }
- tp.activeTabIndex += 1
- endOffset := tp.posTabText[tp.activeTabIndex] + tp.Tabs[tp.activeTabIndex].RuneLen
- if endOffset+tp.offTabText > tp.InnerWidth() {
- tp.offTabText = endOffset - tp.InnerWidth()
- }
-}
-
-// Checks if left and right tabs are fully visible
-// if only left tabs are not visible return -1
-// if only right tabs are not visible return 1
-// if both return 0
-// use only if fitsWidth() returns false
-func (tp *Tabpane) checkAlignment() int {
- ret := 0
- if tp.offTabText > 0 {
- ret = -1
- }
- if tp.offTabText+tp.InnerWidth() < tp.posTabText[len(tp.Tabs)] {
- ret += 1
- }
- return ret
-}
-
-// Checks if all tabs fits innerWidth of Tabpane
-func (tp *Tabpane) fitsWidth() bool {
- return tp.InnerWidth() >= tp.posTabText[len(tp.Tabs)]
-}
-
-func (tp *Tabpane) align() {
- if !tp.fitsWidth() && !tp.Border {
- tp.PaddingLeft += 1
- tp.PaddingRight += 1
- tp.Block.Align()
- }
-}
-
-// bridge the old Point stuct
-type point struct {
- X int
- Y int
- Ch rune
- Fg Attribute
- Bg Attribute
-}
-
-func buf2pt(b Buffer) []point {
- ps := make([]point, 0, len(b.CellMap))
- for k, c := range b.CellMap {
- ps = append(ps, point{X: k.X, Y: k.Y, Ch: c.Ch, Fg: c.Fg, Bg: c.Bg})
- }
-
- return ps
-}
-
-// Adds the point only if it is visible in Tabpane.
-// Point can be invisible if concatenation of Tab's texts is widther then
-// innerWidth of Tabpane
-func (tp *Tabpane) addPoint(ptab []point, charOffset *int, oftX *int, points ...point) []point {
- if *charOffset < tp.offTabText || tp.offTabText+tp.InnerWidth() < *charOffset {
- *charOffset++
- return ptab
- }
- for _, p := range points {
- p.X = *oftX
- ptab = append(ptab, p)
- }
- *oftX++
- *charOffset++
- return ptab
-}
-
-// Draws the point and redraws upper and lower border points (if it has one)
-func (tp *Tabpane) drawPointWithBorder(p point, ch rune, chbord rune, chdown rune, chup rune) []point {
- var addp []point
- p.Ch = ch
- if tp.Border {
- p.Ch = chdown
- p.Y = tp.InnerY() - 1
- addp = append(addp, p)
- p.Ch = chup
- p.Y = tp.InnerY() + 1
- addp = append(addp, p)
- p.Ch = chbord
- }
- p.Y = tp.InnerY()
- return append(addp, p)
-}
-
-func (tp *Tabpane) Buffer() Buffer {
- if tp.Border {
- tp.Height = 3
- } else {
- tp.Height = 1
- }
- if tp.Width > tp.posTabText[len(tp.Tabs)]+2 {
- tp.Width = tp.posTabText[len(tp.Tabs)] + 2
- }
- buf := tp.Block.Buffer()
- ps := []point{}
-
- tp.align()
- if tp.InnerHeight() <= 0 || tp.InnerWidth() <= 0 {
- return NewBuffer()
- }
- oftX := tp.InnerX()
- charOffset := 0
- pt := point{Bg: tp.BorderBg, Fg: tp.BorderFg}
- for i, tab := range tp.Tabs {
-
- if i != 0 {
- pt.X = oftX
- pt.Y = tp.InnerY()
- addp := tp.drawPointWithBorder(pt, ' ', VERTICAL_LINE, HORIZONTAL_DOWN, HORIZONTAL_UP)
- ps = tp.addPoint(ps, &charOffset, &oftX, addp...)
- }
-
- if i == tp.activeTabIndex {
- pt.Bg = tp.ActiveTabBg
- }
- rs := []rune(tab.Label)
- for k := 0; k < len(rs); k++ {
-
- addp := make([]point, 0, 2)
- if i == tp.activeTabIndex && tp.Border {
- pt.Ch = ' '
- pt.Y = tp.InnerY() + 1
- pt.Bg = tp.BorderBg
- addp = append(addp, pt)
- pt.Bg = tp.ActiveTabBg
- }
-
- pt.Y = tp.InnerY()
- pt.Ch = rs[k]
-
- addp = append(addp, pt)
- ps = tp.addPoint(ps, &charOffset, &oftX, addp...)
- }
- pt.Bg = tp.BorderBg
-
- if !tp.fitsWidth() {
- all := tp.checkAlignment()
- pt.X = tp.InnerX() - 1
-
- pt.Ch = '*'
- if tp.Border {
- pt.Ch = VERTICAL_LINE
- }
- ps = append(ps, pt)
-
- if all <= 0 {
- addp := tp.drawPointWithBorder(pt, '<', '«', HORIZONTAL_LINE, HORIZONTAL_LINE)
- ps = append(ps, addp...)
- }
-
- pt.X = tp.InnerX() + tp.InnerWidth()
- pt.Ch = '*'
- if tp.Border {
- pt.Ch = VERTICAL_LINE
- }
- ps = append(ps, pt)
- if all >= 0 {
- addp := tp.drawPointWithBorder(pt, '>', '»', HORIZONTAL_LINE, HORIZONTAL_LINE)
- ps = append(ps, addp...)
- }
- }
-
- //draw tab content below the Tabpane
- if i == tp.activeTabIndex {
- blockPoints := buf2pt(tab.Buffer())
- for i := 0; i < len(blockPoints); i++ {
- blockPoints[i].Y += tp.Height + tp.Y
- }
- ps = append(ps, blockPoints...)
- }
- }
-
- for _, v := range ps {
- buf.Set(v.X, v.Y, NewCell(v.Ch, v.Fg, v.Bg))
- }
- buf.Sync()
- return buf
-}
diff --git a/vendor/github.com/gizak/termui/gauge.go b/vendor/github.com/gizak/termui/gauge.go
deleted file mode 100644
index 9f6ce3a..0000000
--- a/vendor/github.com/gizak/termui/gauge.go
+++ /dev/null
@@ -1,109 +0,0 @@
-// Copyright 2017 Zack Guo . All rights reserved.
-// Use of this source code is governed by a MIT license that can
-// be found in the LICENSE file.
-
-package termui
-
-import (
- "strconv"
- "strings"
-)
-
-// Gauge is a progress bar like widget.
-// A simple example:
-/*
- g := termui.NewGauge()
- g.Percent = 40
- g.Width = 50
- g.Height = 3
- g.BorderLabel = "Slim Gauge"
- g.BarColor = termui.ColorRed
- g.PercentColor = termui.ColorBlue
-*/
-
-const ColorUndef Attribute = Attribute(^uint16(0))
-
-type Gauge struct {
- Block
- Percent int
- BarColor Attribute
- PercentColor Attribute
- PercentColorHighlighted Attribute
- Label string
- LabelAlign Align
-}
-
-// NewGauge return a new gauge with current theme.
-func NewGauge() *Gauge {
- g := &Gauge{
- Block: *NewBlock(),
- PercentColor: ThemeAttr("gauge.percent.fg"),
- BarColor: ThemeAttr("gauge.bar.bg"),
- Label: "{{percent}}%",
- LabelAlign: AlignCenter,
- PercentColorHighlighted: ColorUndef,
- }
-
- g.Width = 12
- g.Height = 5
- return g
-}
-
-// Buffer implements Bufferer interface.
-func (g *Gauge) Buffer() Buffer {
- buf := g.Block.Buffer()
-
- // plot bar
- w := g.Percent * g.innerArea.Dx() / 100
- for i := 0; i < g.innerArea.Dy(); i++ {
- for j := 0; j < w; j++ {
- c := Cell{}
- c.Ch = ' '
- c.Bg = g.BarColor
- if c.Bg == ColorDefault {
- c.Bg |= AttrReverse
- }
- buf.Set(g.innerArea.Min.X+j, g.innerArea.Min.Y+i, c)
- }
- }
-
- // plot percentage
- s := strings.Replace(g.Label, "{{percent}}", strconv.Itoa(g.Percent), -1)
- pry := g.innerArea.Min.Y + g.innerArea.Dy()/2
- rs := str2runes(s)
- var pos int
- switch g.LabelAlign {
- case AlignLeft:
- pos = 0
-
- case AlignCenter:
- pos = (g.innerArea.Dx() - strWidth(s)) / 2
-
- case AlignRight:
- pos = g.innerArea.Dx() - strWidth(s) - 1
- }
- pos += g.innerArea.Min.X
-
- for i, v := range rs {
- c := Cell{
- Ch: v,
- Fg: g.PercentColor,
- }
-
- if w+g.innerArea.Min.X > pos+i {
- c.Bg = g.BarColor
- if c.Bg == ColorDefault {
- c.Bg |= AttrReverse
- }
-
- if g.PercentColorHighlighted != ColorUndef {
- c.Fg = g.PercentColorHighlighted
- }
- } else {
- c.Bg = g.Block.Bg
- }
-
- buf.Set(1+pos+i, pry, c)
- }
- return buf
-}
diff --git a/vendor/github.com/gizak/termui/glide.lock b/vendor/github.com/gizak/termui/glide.lock
deleted file mode 100644
index be5952d..0000000
--- a/vendor/github.com/gizak/termui/glide.lock
+++ /dev/null
@@ -1,30 +0,0 @@
-hash: 7a754ba100256404a978b2fc8738aee337beb822458e4b6060399fb89ebd215c
-updated: 2016-11-03T17:39:24.323773674-04:00
-imports:
-- name: github.com/maruel/panicparse
- version: ad661195ed0e88491e0f14be6613304e3b1141d6
- subpackages:
- - stack
-- name: github.com/mattn/go-runewidth
- version: 737072b4e32b7a5018b4a7125da8d12de90e8045
-- name: github.com/mitchellh/go-wordwrap
- version: ad45545899c7b13c020ea92b2072220eefad42b8
-- name: github.com/nsf/termbox-go
- version: b6acae516ace002cb8105a89024544a1480655a5
-- name: golang.org/x/net
- version: 569280fa63be4e201b975e5411e30a92178f0118
- subpackages:
- - websocket
-testImports:
-- name: github.com/davecgh/go-spew
- version: 346938d642f2ec3594ed81d874461961cd0faa76
- subpackages:
- - spew
-- name: github.com/pmezard/go-difflib
- version: d8ed2627bdf02c080bf22230dbb337003b7aba2d
- subpackages:
- - difflib
-- name: github.com/stretchr/testify
- version: 976c720a22c8eb4eb6a0b4348ad85ad12491a506
- subpackages:
- - assert
diff --git a/vendor/github.com/gizak/termui/glide.yaml b/vendor/github.com/gizak/termui/glide.yaml
deleted file mode 100644
index a681231..0000000
--- a/vendor/github.com/gizak/termui/glide.yaml
+++ /dev/null
@@ -1,9 +0,0 @@
-package: github.com/gizak/termui
-import:
-- package: github.com/mattn/go-runewidth
-- package: github.com/mitchellh/go-wordwrap
-- package: github.com/nsf/termbox-go
-- package: golang.org/x/net
- subpackages:
- - websocket
-- package: github.com/maruel/panicparse
diff --git a/vendor/github.com/gizak/termui/grid.go b/vendor/github.com/gizak/termui/grid.go
deleted file mode 100644
index a950232..0000000
--- a/vendor/github.com/gizak/termui/grid.go
+++ /dev/null
@@ -1,279 +0,0 @@
-// Copyright 2017 Zack Guo . All rights reserved.
-// Use of this source code is governed by a MIT license that can
-// be found in the LICENSE file.
-
-package termui
-
-// GridBufferer introduces a Bufferer that can be manipulated by Grid.
-type GridBufferer interface {
- Bufferer
- GetHeight() int
- SetWidth(int)
- SetX(int)
- SetY(int)
-}
-
-// Row builds a layout tree
-type Row struct {
- Cols []*Row //children
- Widget GridBufferer // root
- X int
- Y int
- Width int
- Height int
- Span int
- Offset int
-}
-
-// calculate and set the underlying layout tree's x, y, height and width.
-func (r *Row) calcLayout() {
- r.assignWidth(r.Width)
- r.Height = r.solveHeight()
- r.assignX(r.X)
- r.assignY(r.Y)
-}
-
-// tell if the node is leaf in the tree.
-func (r *Row) isLeaf() bool {
- return r.Cols == nil || len(r.Cols) == 0
-}
-
-func (r *Row) isRenderableLeaf() bool {
- return r.isLeaf() && r.Widget != nil
-}
-
-// assign widgets' (and their parent rows') width recursively.
-func (r *Row) assignWidth(w int) {
- r.SetWidth(w)
-
- accW := 0 // acc span and offset
- calcW := make([]int, len(r.Cols)) // calculated width
- calcOftX := make([]int, len(r.Cols)) // computated start position of x
-
- for i, c := range r.Cols {
- accW += c.Span + c.Offset
- cw := int(float64(c.Span*r.Width) / 12.0)
-
- if i >= 1 {
- calcOftX[i] = calcOftX[i-1] +
- calcW[i-1] +
- int(float64(r.Cols[i-1].Offset*r.Width)/12.0)
- }
-
- // use up the space if it is the last col
- if i == len(r.Cols)-1 && accW == 12 {
- cw = r.Width - calcOftX[i]
- }
- calcW[i] = cw
- r.Cols[i].assignWidth(cw)
- }
-}
-
-// bottom up calc and set rows' (and their widgets') height,
-// return r's total height.
-func (r *Row) solveHeight() int {
- if r.isRenderableLeaf() {
- r.Height = r.Widget.GetHeight()
- return r.Widget.GetHeight()
- }
-
- maxh := 0
- if !r.isLeaf() {
- for _, c := range r.Cols {
- nh := c.solveHeight()
- // when embed rows in Cols, row widgets stack up
- if r.Widget != nil {
- nh += r.Widget.GetHeight()
- }
- if nh > maxh {
- maxh = nh
- }
- }
- }
-
- r.Height = maxh
- return maxh
-}
-
-// recursively assign x position for r tree.
-func (r *Row) assignX(x int) {
- r.SetX(x)
-
- if !r.isLeaf() {
- acc := 0
- for i, c := range r.Cols {
- if c.Offset != 0 {
- acc += int(float64(c.Offset*r.Width) / 12.0)
- }
- r.Cols[i].assignX(x + acc)
- acc += c.Width
- }
- }
-}
-
-// recursively assign y position to r.
-func (r *Row) assignY(y int) {
- r.SetY(y)
-
- if r.isLeaf() {
- return
- }
-
- for i := range r.Cols {
- acc := 0
- if r.Widget != nil {
- acc = r.Widget.GetHeight()
- }
- r.Cols[i].assignY(y + acc)
- }
-
-}
-
-// GetHeight implements GridBufferer interface.
-func (r Row) GetHeight() int {
- return r.Height
-}
-
-// SetX implements GridBufferer interface.
-func (r *Row) SetX(x int) {
- r.X = x
- if r.Widget != nil {
- r.Widget.SetX(x)
- }
-}
-
-// SetY implements GridBufferer interface.
-func (r *Row) SetY(y int) {
- r.Y = y
- if r.Widget != nil {
- r.Widget.SetY(y)
- }
-}
-
-// SetWidth implements GridBufferer interface.
-func (r *Row) SetWidth(w int) {
- r.Width = w
- if r.Widget != nil {
- r.Widget.SetWidth(w)
- }
-}
-
-// Buffer implements Bufferer interface,
-// recursively merge all widgets buffer
-func (r *Row) Buffer() Buffer {
- merged := NewBuffer()
-
- if r.isRenderableLeaf() {
- return r.Widget.Buffer()
- }
-
- // for those are not leaves but have a renderable widget
- if r.Widget != nil {
- merged.Merge(r.Widget.Buffer())
- }
-
- // collect buffer from children
- if !r.isLeaf() {
- for _, c := range r.Cols {
- merged.Merge(c.Buffer())
- }
- }
-
- return merged
-}
-
-// Grid implements 12 columns system.
-// A simple example:
-/*
- import ui "github.com/gizak/termui"
- // init and create widgets...
-
- // build
- ui.Body.AddRows(
- ui.NewRow(
- ui.NewCol(6, 0, widget0),
- ui.NewCol(6, 0, widget1)),
- ui.NewRow(
- ui.NewCol(3, 0, widget2),
- ui.NewCol(3, 0, widget30, widget31, widget32),
- ui.NewCol(6, 0, widget4)))
-
- // calculate layout
- ui.Body.Align()
-
- ui.Render(ui.Body)
-*/
-type Grid struct {
- Rows []*Row
- Width int
- X int
- Y int
- BgColor Attribute
-}
-
-// NewGrid returns *Grid with given rows.
-func NewGrid(rows ...*Row) *Grid {
- return &Grid{Rows: rows}
-}
-
-// AddRows appends given rows to Grid.
-func (g *Grid) AddRows(rs ...*Row) {
- g.Rows = append(g.Rows, rs...)
-}
-
-// NewRow creates a new row out of given columns.
-func NewRow(cols ...*Row) *Row {
- rs := &Row{Span: 12, Cols: cols}
- return rs
-}
-
-// NewCol accepts: widgets are LayoutBufferer or widgets is A NewRow.
-// Note that if multiple widgets are provided, they will stack up in the col.
-func NewCol(span, offset int, widgets ...GridBufferer) *Row {
- r := &Row{Span: span, Offset: offset}
-
- if widgets != nil && len(widgets) == 1 {
- wgt := widgets[0]
- nw, isRow := wgt.(*Row)
- if isRow {
- r.Cols = nw.Cols
- } else {
- r.Widget = wgt
- }
- return r
- }
-
- r.Cols = []*Row{}
- ir := r
- for _, w := range widgets {
- nr := &Row{Span: 12, Widget: w}
- ir.Cols = []*Row{nr}
- ir = nr
- }
-
- return r
-}
-
-// Align calculate each rows' layout.
-func (g *Grid) Align() {
- h := 0
- for _, r := range g.Rows {
- r.SetWidth(g.Width)
- r.SetX(g.X)
- r.SetY(g.Y + h)
- r.calcLayout()
- h += r.GetHeight()
- }
-}
-
-// Buffer implments Bufferer interface.
-func (g Grid) Buffer() Buffer {
- buf := NewBuffer()
-
- for _, r := range g.Rows {
- buf.Merge(r.Buffer())
- }
- return buf
-}
-
-var Body *Grid
diff --git a/vendor/github.com/gizak/termui/grid_test.go b/vendor/github.com/gizak/termui/grid_test.go
deleted file mode 100644
index 7b7b0b7..0000000
--- a/vendor/github.com/gizak/termui/grid_test.go
+++ /dev/null
@@ -1,80 +0,0 @@
-// Copyright 2017 Zack Guo . All rights reserved.
-// Use of this source code is governed by a MIT license that can
-// be found in the LICENSE file.
-
-package termui
-
-import (
- "testing"
-
- "github.com/davecgh/go-spew/spew"
-)
-
-var r *Row
-
-func TestRowWidth(t *testing.T) {
- p0 := NewBlock()
- p0.Height = 1
- p1 := NewBlock()
- p1.Height = 1
- p2 := NewBlock()
- p2.Height = 1
- p3 := NewBlock()
- p3.Height = 1
-
- /* test against tree:
-
- r
- / \
- 0:w 1
- / \
- 10:w 11
- /
- 110:w
- /
- 1100:w
- */
-
- r = NewRow(
- NewCol(6, 0, p0),
- NewCol(6, 0,
- NewRow(
- NewCol(6, 0, p1),
- NewCol(6, 0, p2, p3))))
-
- r.assignWidth(100)
- if r.Width != 100 ||
- (r.Cols[0].Width) != 50 ||
- (r.Cols[1].Width) != 50 ||
- (r.Cols[1].Cols[0].Width) != 25 ||
- (r.Cols[1].Cols[1].Width) != 25 ||
- (r.Cols[1].Cols[1].Cols[0].Width) != 25 ||
- (r.Cols[1].Cols[1].Cols[0].Cols[0].Width) != 25 {
- t.Error("assignWidth fails")
- }
-}
-
-func TestRowHeight(t *testing.T) {
- spew.Dump()
-
- if (r.solveHeight()) != 2 ||
- (r.Cols[1].Cols[1].Height) != 2 ||
- (r.Cols[1].Cols[1].Cols[0].Height) != 2 ||
- (r.Cols[1].Cols[0].Height) != 1 {
- t.Error("solveHeight fails")
- }
-}
-
-func TestAssignXY(t *testing.T) {
- r.assignX(0)
- r.assignY(0)
- if (r.Cols[0].X) != 0 ||
- (r.Cols[1].Cols[0].X) != 50 ||
- (r.Cols[1].Cols[1].X) != 75 ||
- (r.Cols[1].Cols[1].Cols[0].X) != 75 ||
- (r.Cols[1].Cols[0].Y) != 0 ||
- (r.Cols[1].Cols[1].Cols[0].Y) != 0 ||
- (r.Cols[1].Cols[1].Cols[0].Cols[0].Y) != 1 {
- t.Error("assignXY fails")
- }
-}
diff --git a/vendor/github.com/gizak/termui/helper.go b/vendor/github.com/gizak/termui/helper.go
deleted file mode 100644
index 18a6770..0000000
--- a/vendor/github.com/gizak/termui/helper.go
+++ /dev/null
@@ -1,222 +0,0 @@
-// Copyright 2017 Zack Guo . All rights reserved.
-// Use of this source code is governed by a MIT license that can
-// be found in the LICENSE file.
-
-package termui
-
-import (
- "regexp"
- "strings"
-
- tm "github.com/nsf/termbox-go"
-)
-import rw "github.com/mattn/go-runewidth"
-
-/* ---------------Port from termbox-go --------------------- */
-
-// Attribute is printable cell's color and style.
-type Attribute uint16
-
-// 8 basic clolrs
-const (
- ColorDefault Attribute = iota
- ColorBlack
- ColorRed
- ColorGreen
- ColorYellow
- ColorBlue
- ColorMagenta
- ColorCyan
- ColorWhite
-)
-
-//Have a constant that defines number of colors
-const NumberofColors = 8
-
-// Text style
-const (
- AttrBold Attribute = 1 << (iota + 9)
- AttrUnderline
- AttrReverse
-)
-
-var (
- dot = "…"
- dotw = rw.StringWidth(dot)
-)
-
-/* ----------------------- End ----------------------------- */
-
-func toTmAttr(x Attribute) tm.Attribute {
- return tm.Attribute(x)
-}
-
-func str2runes(s string) []rune {
- return []rune(s)
-}
-
-// Here for backwards-compatibility.
-func trimStr2Runes(s string, w int) []rune {
- return TrimStr2Runes(s, w)
-}
-
-// TrimStr2Runes trims string to w[-1 rune], appends …, and returns the runes
-// of that string if string is grather then n. If string is small then w,
-// return the runes.
-func TrimStr2Runes(s string, w int) []rune {
- if w <= 0 {
- return []rune{}
- }
-
- sw := rw.StringWidth(s)
- if sw > w {
- return []rune(rw.Truncate(s, w, dot))
- }
- return str2runes(s)
-}
-
-// TrimStrIfAppropriate trim string to "s[:-1] + …"
-// if string > width otherwise return string
-func TrimStrIfAppropriate(s string, w int) string {
- if w <= 0 {
- return ""
- }
-
- sw := rw.StringWidth(s)
- if sw > w {
- return rw.Truncate(s, w, dot)
- }
-
- return s
-}
-
-func strWidth(s string) int {
- return rw.StringWidth(s)
-}
-
-func charWidth(ch rune) int {
- return rw.RuneWidth(ch)
-}
-
-var whiteSpaceRegex = regexp.MustCompile(`\s`)
-
-// StringToAttribute converts text to a termui attribute. You may specifiy more
-// then one attribute like that: "BLACK, BOLD, ...". All whitespaces
-// are ignored.
-func StringToAttribute(text string) Attribute {
- text = whiteSpaceRegex.ReplaceAllString(strings.ToLower(text), "")
- attributes := strings.Split(text, ",")
- result := Attribute(0)
-
- for _, theAttribute := range attributes {
- var match Attribute
- switch theAttribute {
- case "reset", "default":
- match = ColorDefault
-
- case "black":
- match = ColorBlack
-
- case "red":
- match = ColorRed
-
- case "green":
- match = ColorGreen
-
- case "yellow":
- match = ColorYellow
-
- case "blue":
- match = ColorBlue
-
- case "magenta":
- match = ColorMagenta
-
- case "cyan":
- match = ColorCyan
-
- case "white":
- match = ColorWhite
-
- case "bold":
- match = AttrBold
-
- case "underline":
- match = AttrUnderline
-
- case "reverse":
- match = AttrReverse
- }
-
- result |= match
- }
-
- return result
-}
-
-// TextCells returns a coloured text cells []Cell
-func TextCells(s string, fg, bg Attribute) []Cell {
- cs := make([]Cell, 0, len(s))
-
- // sequence := MarkdownTextRendererFactory{}.TextRenderer(s).Render(fg, bg)
- // runes := []rune(sequence.NormalizedText)
- runes := str2runes(s)
-
- for n := range runes {
- // point, _ := sequence.PointAt(n, 0, 0)
- // cs = append(cs, Cell{point.Ch, point.Fg, point.Bg})
- cs = append(cs, Cell{runes[n], fg, bg})
- }
- return cs
-}
-
-// Width returns the actual screen space the cell takes (usually 1 or 2).
-func (c Cell) Width() int {
- return charWidth(c.Ch)
-}
-
-// Copy return a copy of c
-func (c Cell) Copy() Cell {
- return c
-}
-
-// TrimTxCells trims the overflowed text cells sequence.
-func TrimTxCells(cs []Cell, w int) []Cell {
- if len(cs) <= w {
- return cs
- }
- return cs[:w]
-}
-
-// DTrimTxCls trims the overflowed text cells sequence and append dots at the end.
-func DTrimTxCls(cs []Cell, w int) []Cell {
- l := len(cs)
- if l <= 0 {
- return []Cell{}
- }
-
- rt := make([]Cell, 0, w)
- csw := 0
- for i := 0; i < l && csw <= w; i++ {
- c := cs[i]
- cw := c.Width()
-
- if cw+csw < w {
- rt = append(rt, c)
- csw += cw
- } else {
- rt = append(rt, Cell{'…', c.Fg, c.Bg})
- break
- }
- }
-
- return rt
-}
-
-func CellsToStr(cs []Cell) string {
- str := ""
- for _, c := range cs {
- str += string(c.Ch)
- }
- return str
-}
diff --git a/vendor/github.com/gizak/termui/helper_test.go b/vendor/github.com/gizak/termui/helper_test.go
deleted file mode 100644
index 0b4b13e..0000000
--- a/vendor/github.com/gizak/termui/helper_test.go
+++ /dev/null
@@ -1,70 +0,0 @@
-// Copyright 2017 Zack Guo . All rights reserved.
-// Use of this source code is governed by a MIT license that can
-// be found in the LICENSE file.
-
-package termui
-
-import (
- "testing"
-
- "github.com/stretchr/testify/assert"
-)
-
-func TestStr2Rune(t *testing.T) {
- s := "你好,世界."
- rs := str2runes(s)
- if len(rs) != 6 {
- t.Error(t)
- }
-}
-
-func TestWidth(t *testing.T) {
- s0 := "つのだ☆HIRO"
- s1 := "11111111111"
- // above not align for setting East Asian Ambiguous to wide!!
-
- if strWidth(s0) != strWidth(s1) {
- t.Error("str len failed")
- }
-
- len1 := []rune{'a', '2', '&', '「', 'オ', '。'} //will false: 'ᆵ', 'ᄚ', 'ᄒ'
- for _, v := range len1 {
- if charWidth(v) != 1 {
- t.Error("len1 failed")
- }
- }
-
- len2 := []rune{'漢', '字', '한', '자', '你', '好', 'だ', '。', '%', 's', 'E', 'ョ', '、', 'ヲ'}
- for _, v := range len2 {
- if charWidth(v) != 2 {
- t.Error("len2 failed")
- }
- }
-}
-
-func TestTrim(t *testing.T) {
- s := "つのだ☆HIRO"
- if string(trimStr2Runes(s, 10)) != "つのだ☆HI"+dot {
- t.Error("trim failed")
- }
- if string(trimStr2Runes(s, 11)) != "つのだ☆HIRO" {
- t.Error("avoid tail trim failed")
- }
- if string(trimStr2Runes(s, 15)) != "つのだ☆HIRO" {
- t.Error("avoid trim failed")
- }
-}
-
-func TestTrimStrIfAppropriate_NoTrim(t *testing.T) {
- assert.Equal(t, "hello", TrimStrIfAppropriate("hello", 5))
-}
-
-func TestTrimStrIfAppropriate(t *testing.T) {
- assert.Equal(t, "hel…", TrimStrIfAppropriate("hello", 4))
- assert.Equal(t, "h…", TrimStrIfAppropriate("hello", 2))
-}
-
-func TestStringToAttribute(t *testing.T) {
- assert.Equal(t, ColorRed, StringToAttribute("ReD"))
- assert.Equal(t, ColorRed|AttrBold, StringToAttribute("RED, bold"))
-}
diff --git a/vendor/github.com/gizak/termui/linechart.go b/vendor/github.com/gizak/termui/linechart.go
deleted file mode 100644
index f7eea28..0000000
--- a/vendor/github.com/gizak/termui/linechart.go
+++ /dev/null
@@ -1,331 +0,0 @@
-// Copyright 2017 Zack Guo . All rights reserved.
-// Use of this source code is governed by a MIT license that can
-// be found in the LICENSE file.
-
-package termui
-
-import (
- "fmt"
- "math"
-)
-
-// only 16 possible combinations, why bother
-var braillePatterns = map[[2]int]rune{
- [2]int{0, 0}: '⣀',
- [2]int{0, 1}: '⡠',
- [2]int{0, 2}: '⡐',
- [2]int{0, 3}: '⡈',
-
- [2]int{1, 0}: '⢄',
- [2]int{1, 1}: '⠤',
- [2]int{1, 2}: '⠔',
- [2]int{1, 3}: '⠌',
-
- [2]int{2, 0}: '⢂',
- [2]int{2, 1}: '⠢',
- [2]int{2, 2}: '⠒',
- [2]int{2, 3}: '⠊',
-
- [2]int{3, 0}: '⢁',
- [2]int{3, 1}: '⠡',
- [2]int{3, 2}: '⠑',
- [2]int{3, 3}: '⠉',
-}
-
-var lSingleBraille = [4]rune{'\u2840', '⠄', '⠂', '⠁'}
-var rSingleBraille = [4]rune{'\u2880', '⠠', '⠐', '⠈'}
-
-// LineChart has two modes: braille(default) and dot. Using braille gives 2x capicity as dot mode,
-// because one braille char can represent two data points.
-/*
- lc := termui.NewLineChart()
- lc.BorderLabel = "braille-mode Line Chart"
- lc.Data = [1.2, 1.3, 1.5, 1.7, 1.5, 1.6, 1.8, 2.0]
- lc.Width = 50
- lc.Height = 12
- lc.AxesColor = termui.ColorWhite
- lc.LineColor = termui.ColorGreen | termui.AttrBold
- // termui.Render(lc)...
-*/
-type LineChart struct {
- Block
- Data []float64
- DataLabels []string // if unset, the data indices will be used
- Mode string // braille | dot
- DotStyle rune
- LineColor Attribute
- scale float64 // data span per cell on y-axis
- AxesColor Attribute
- drawingX int
- drawingY int
- axisYHeight int
- axisXWidth int
- axisYLabelGap int
- axisXLabelGap int
- topValue float64
- bottomValue float64
- labelX [][]rune
- labelY [][]rune
- labelYSpace int
- maxY float64
- minY float64
- autoLabels bool
-}
-
-// NewLineChart returns a new LineChart with current theme.
-func NewLineChart() *LineChart {
- lc := &LineChart{Block: *NewBlock()}
- lc.AxesColor = ThemeAttr("linechart.axes.fg")
- lc.LineColor = ThemeAttr("linechart.line.fg")
- lc.Mode = "braille"
- lc.DotStyle = '•'
- lc.axisXLabelGap = 2
- lc.axisYLabelGap = 1
- lc.bottomValue = math.Inf(1)
- lc.topValue = math.Inf(-1)
- return lc
-}
-
-// one cell contains two data points
-// so the capicity is 2x as dot-mode
-func (lc *LineChart) renderBraille() Buffer {
- buf := NewBuffer()
-
- // return: b -> which cell should the point be in
- // m -> in the cell, divided into 4 equal height levels, which subcell?
- getPos := func(d float64) (b, m int) {
- cnt4 := int((d-lc.bottomValue)/(lc.scale/4) + 0.5)
- b = cnt4 / 4
- m = cnt4 % 4
- return
- }
- // plot points
- for i := 0; 2*i+1 < len(lc.Data) && i < lc.axisXWidth; i++ {
- b0, m0 := getPos(lc.Data[2*i])
- b1, m1 := getPos(lc.Data[2*i+1])
-
- if b0 == b1 {
- c := Cell{
- Ch: braillePatterns[[2]int{m0, m1}],
- Bg: lc.Bg,
- Fg: lc.LineColor,
- }
- y := lc.innerArea.Min.Y + lc.innerArea.Dy() - 3 - b0
- x := lc.innerArea.Min.X + lc.labelYSpace + 1 + i
- buf.Set(x, y, c)
- } else {
- c0 := Cell{Ch: lSingleBraille[m0],
- Fg: lc.LineColor,
- Bg: lc.Bg}
- x0 := lc.innerArea.Min.X + lc.labelYSpace + 1 + i
- y0 := lc.innerArea.Min.Y + lc.innerArea.Dy() - 3 - b0
- buf.Set(x0, y0, c0)
-
- c1 := Cell{Ch: rSingleBraille[m1],
- Fg: lc.LineColor,
- Bg: lc.Bg}
- x1 := lc.innerArea.Min.X + lc.labelYSpace + 1 + i
- y1 := lc.innerArea.Min.Y + lc.innerArea.Dy() - 3 - b1
- buf.Set(x1, y1, c1)
- }
-
- }
- return buf
-}
-
-func (lc *LineChart) renderDot() Buffer {
- buf := NewBuffer()
- for i := 0; i < len(lc.Data) && i < lc.axisXWidth; i++ {
- c := Cell{
- Ch: lc.DotStyle,
- Fg: lc.LineColor,
- Bg: lc.Bg,
- }
- x := lc.innerArea.Min.X + lc.labelYSpace + 1 + i
- y := lc.innerArea.Min.Y + lc.innerArea.Dy() - 3 - int((lc.Data[i]-lc.bottomValue)/lc.scale+0.5)
- buf.Set(x, y, c)
- }
-
- return buf
-}
-
-func (lc *LineChart) calcLabelX() {
- lc.labelX = [][]rune{}
-
- for i, l := 0, 0; i < len(lc.DataLabels) && l < lc.axisXWidth; i++ {
- if lc.Mode == "dot" {
- if l >= len(lc.DataLabels) {
- break
- }
-
- s := str2runes(lc.DataLabels[l])
- w := strWidth(lc.DataLabels[l])
- if l+w <= lc.axisXWidth {
- lc.labelX = append(lc.labelX, s)
- }
- l += w + lc.axisXLabelGap
- } else { // braille
- if 2*l >= len(lc.DataLabels) {
- break
- }
-
- s := str2runes(lc.DataLabels[2*l])
- w := strWidth(lc.DataLabels[2*l])
- if l+w <= lc.axisXWidth {
- lc.labelX = append(lc.labelX, s)
- }
- l += w + lc.axisXLabelGap
-
- }
- }
-}
-
-func shortenFloatVal(x float64) string {
- s := fmt.Sprintf("%.2f", x)
- if len(s)-3 > 3 {
- s = fmt.Sprintf("%.2e", x)
- }
-
- if x < 0 {
- s = fmt.Sprintf("%.2f", x)
- }
- return s
-}
-
-func (lc *LineChart) calcLabelY() {
- span := lc.topValue - lc.bottomValue
- lc.scale = span / float64(lc.axisYHeight)
-
- n := (1 + lc.axisYHeight) / (lc.axisYLabelGap + 1)
- lc.labelY = make([][]rune, n)
- maxLen := 0
- for i := 0; i < n; i++ {
- s := str2runes(shortenFloatVal(lc.bottomValue + float64(i)*span/float64(n)))
- if len(s) > maxLen {
- maxLen = len(s)
- }
- lc.labelY[i] = s
- }
-
- lc.labelYSpace = maxLen
-}
-
-func (lc *LineChart) calcLayout() {
- // set datalabels if it is not provided
- if (lc.DataLabels == nil || len(lc.DataLabels) == 0) || lc.autoLabels {
- lc.autoLabels = true
- lc.DataLabels = make([]string, len(lc.Data))
- for i := range lc.Data {
- lc.DataLabels[i] = fmt.Sprint(i)
- }
- }
-
- // lazy increase, to avoid y shaking frequently
- // update bound Y when drawing is gonna overflow
- lc.minY = lc.Data[0]
- lc.maxY = lc.Data[0]
-
- // valid visible range
- vrange := lc.innerArea.Dx()
- if lc.Mode == "braille" {
- vrange = 2 * lc.innerArea.Dx()
- }
- if vrange > len(lc.Data) {
- vrange = len(lc.Data)
- }
-
- for _, v := range lc.Data[:vrange] {
- if v > lc.maxY {
- lc.maxY = v
- }
- if v < lc.minY {
- lc.minY = v
- }
- }
-
- span := lc.maxY - lc.minY
-
- if lc.minY < lc.bottomValue {
- lc.bottomValue = lc.minY - 0.2*span
- }
-
- if lc.maxY > lc.topValue {
- lc.topValue = lc.maxY + 0.2*span
- }
-
- lc.axisYHeight = lc.innerArea.Dy() - 2
- lc.calcLabelY()
-
- lc.axisXWidth = lc.innerArea.Dx() - 1 - lc.labelYSpace
- lc.calcLabelX()
-
- lc.drawingX = lc.innerArea.Min.X + 1 + lc.labelYSpace
- lc.drawingY = lc.innerArea.Min.Y
-}
-
-func (lc *LineChart) plotAxes() Buffer {
- buf := NewBuffer()
-
- origY := lc.innerArea.Min.Y + lc.innerArea.Dy() - 2
- origX := lc.innerArea.Min.X + lc.labelYSpace
-
- buf.Set(origX, origY, Cell{Ch: ORIGIN, Fg: lc.AxesColor, Bg: lc.Bg})
-
- for x := origX + 1; x < origX+lc.axisXWidth; x++ {
- buf.Set(x, origY, Cell{Ch: HDASH, Fg: lc.AxesColor, Bg: lc.Bg})
- }
-
- for dy := 1; dy <= lc.axisYHeight; dy++ {
- buf.Set(origX, origY-dy, Cell{Ch: VDASH, Fg: lc.AxesColor, Bg: lc.Bg})
- }
-
- // x label
- oft := 0
- for _, rs := range lc.labelX {
- if oft+len(rs) > lc.axisXWidth {
- break
- }
- for j, r := range rs {
- c := Cell{
- Ch: r,
- Fg: lc.AxesColor,
- Bg: lc.Bg,
- }
- x := origX + oft + j
- y := lc.innerArea.Min.Y + lc.innerArea.Dy() - 1
- buf.Set(x, y, c)
- }
- oft += len(rs) + lc.axisXLabelGap
- }
-
- // y labels
- for i, rs := range lc.labelY {
- for j, r := range rs {
- buf.Set(
- lc.innerArea.Min.X+j,
- origY-i*(lc.axisYLabelGap+1),
- Cell{Ch: r, Fg: lc.AxesColor, Bg: lc.Bg})
- }
- }
-
- return buf
-}
-
-// Buffer implements Bufferer interface.
-func (lc *LineChart) Buffer() Buffer {
- buf := lc.Block.Buffer()
-
- if lc.Data == nil || len(lc.Data) == 0 {
- return buf
- }
- lc.calcLayout()
- buf.Merge(lc.plotAxes())
-
- if lc.Mode == "dot" {
- buf.Merge(lc.renderDot())
- } else {
- buf.Merge(lc.renderBraille())
- }
-
- return buf
-}
diff --git a/vendor/github.com/gizak/termui/linechart_others.go b/vendor/github.com/gizak/termui/linechart_others.go
deleted file mode 100644
index 14897ea..0000000
--- a/vendor/github.com/gizak/termui/linechart_others.go
+++ /dev/null
@@ -1,11 +0,0 @@
-// Copyright 2017 Zack Guo . All rights reserved.
-// Use of this source code is governed by a MIT license that can
-// be found in the LICENSE file.
-
-// +build !windows
-
-package termui
-
-const VDASH = '┊'
-const HDASH = '┈'
-const ORIGIN = '└'
diff --git a/vendor/github.com/gizak/termui/linechart_windows.go b/vendor/github.com/gizak/termui/linechart_windows.go
deleted file mode 100644
index 994d3e5..0000000
--- a/vendor/github.com/gizak/termui/linechart_windows.go
+++ /dev/null
@@ -1,11 +0,0 @@
-// Copyright 2017 Zack Guo . All rights reserved.
-// Use of this source code is governed by a MIT license that can
-// be found in the LICENSE file.
-
-// +build windows
-
-package termui
-
-const VDASH = '|'
-const HDASH = '-'
-const ORIGIN = '+'
diff --git a/vendor/github.com/gizak/termui/list.go b/vendor/github.com/gizak/termui/list.go
deleted file mode 100644
index ea6635e..0000000
--- a/vendor/github.com/gizak/termui/list.go
+++ /dev/null
@@ -1,89 +0,0 @@
-// Copyright 2017 Zack Guo . All rights reserved.
-// Use of this source code is governed by a MIT license that can
-// be found in the LICENSE file.
-
-package termui
-
-import "strings"
-
-// List displays []string as its items,
-// it has a Overflow option (default is "hidden"), when set to "hidden",
-// the item exceeding List's width is truncated, but when set to "wrap",
-// the overflowed text breaks into next line.
-/*
- strs := []string{
- "[0] github.com/gizak/termui",
- "[1] editbox.go",
- "[2] iterrupt.go",
- "[3] keyboard.go",
- "[4] output.go",
- "[5] random_out.go",
- "[6] dashboard.go",
- "[7] nsf/termbox-go"}
-
- ls := termui.NewList()
- ls.Items = strs
- ls.ItemFgColor = termui.ColorYellow
- ls.BorderLabel = "List"
- ls.Height = 7
- ls.Width = 25
- ls.Y = 0
-*/
-type List struct {
- Block
- Items []string
- Overflow string
- ItemFgColor Attribute
- ItemBgColor Attribute
-}
-
-// NewList returns a new *List with current theme.
-func NewList() *List {
- l := &List{Block: *NewBlock()}
- l.Overflow = "hidden"
- l.ItemFgColor = ThemeAttr("list.item.fg")
- l.ItemBgColor = ThemeAttr("list.item.bg")
- return l
-}
-
-// Buffer implements Bufferer interface.
-func (l *List) Buffer() Buffer {
- buf := l.Block.Buffer()
-
- switch l.Overflow {
- case "wrap":
- cs := DefaultTxBuilder.Build(strings.Join(l.Items, "\n"), l.ItemFgColor, l.ItemBgColor)
- i, j, k := 0, 0, 0
- for i < l.innerArea.Dy() && k < len(cs) {
- w := cs[k].Width()
- if cs[k].Ch == '\n' || j+w > l.innerArea.Dx() {
- i++
- j = 0
- if cs[k].Ch == '\n' {
- k++
- }
- continue
- }
- buf.Set(l.innerArea.Min.X+j, l.innerArea.Min.Y+i, cs[k])
-
- k++
- j++
- }
-
- case "hidden":
- trimItems := l.Items
- if len(trimItems) > l.innerArea.Dy() {
- trimItems = trimItems[:l.innerArea.Dy()]
- }
- for i, v := range trimItems {
- cs := DTrimTxCls(DefaultTxBuilder.Build(v, l.ItemFgColor, l.ItemBgColor), l.innerArea.Dx())
- j := 0
- for _, vv := range cs {
- w := vv.Width()
- buf.Set(l.innerArea.Min.X+j, l.innerArea.Min.Y+i, vv)
- j += w
- }
- }
- }
- return buf
-}
diff --git a/vendor/github.com/gizak/termui/mbarchart.go b/vendor/github.com/gizak/termui/mbarchart.go
deleted file mode 100644
index 0f91e97..0000000
--- a/vendor/github.com/gizak/termui/mbarchart.go
+++ /dev/null
@@ -1,242 +0,0 @@
-// Copyright 2017 Zack Guo . All rights reserved.
-// Use of this source code is governed by a MIT license that can
-// be found in the LICENSE file.
-
-package termui
-
-import (
- "fmt"
-)
-
-// This is the implemetation of multi-colored or stacked bar graph. This is different from default barGraph which is implemented in bar.go
-// Multi-Colored-BarChart creates multiple bars in a widget:
-/*
- bc := termui.NewMBarChart()
- data := make([][]int, 2)
- data[0] := []int{3, 2, 5, 7, 9, 4}
- data[1] := []int{7, 8, 5, 3, 1, 6}
- bclabels := []string{"S0", "S1", "S2", "S3", "S4", "S5"}
- bc.BorderLabel = "Bar Chart"
- bc.Data = data
- bc.Width = 26
- bc.Height = 10
- bc.DataLabels = bclabels
- bc.TextColor = termui.ColorGreen
- bc.BarColor = termui.ColorRed
- bc.NumColor = termui.ColorYellow
-*/
-type MBarChart struct {
- Block
- BarColor [NumberofColors]Attribute
- TextColor Attribute
- NumColor [NumberofColors]Attribute
- Data [NumberofColors][]int
- DataLabels []string
- BarWidth int
- BarGap int
- labels [][]rune
- dataNum [NumberofColors][][]rune
- numBar int
- scale float64
- max int
- minDataLen int
- numStack int
- ShowScale bool
- maxScale []rune
-}
-
-// NewBarChart returns a new *BarChart with current theme.
-func NewMBarChart() *MBarChart {
- bc := &MBarChart{Block: *NewBlock()}
- bc.BarColor[0] = ThemeAttr("mbarchart.bar.bg")
- bc.NumColor[0] = ThemeAttr("mbarchart.num.fg")
- bc.TextColor = ThemeAttr("mbarchart.text.fg")
- bc.BarGap = 1
- bc.BarWidth = 3
- return bc
-}
-
-func (bc *MBarChart) layout() {
- bc.numBar = bc.innerArea.Dx() / (bc.BarGap + bc.BarWidth)
- bc.labels = make([][]rune, bc.numBar)
- DataLen := 0
- LabelLen := len(bc.DataLabels)
- bc.minDataLen = 9999 //Set this to some very hight value so that we find the minimum one We want to know which array among data[][] has got the least length
-
- // We need to know how many stack/data array data[0] , data[1] are there
- for i := 0; i < len(bc.Data); i++ {
- if bc.Data[i] == nil {
- break
- }
- DataLen++
- }
- bc.numStack = DataLen
-
- //We need to know what is the mimimum size of data array data[0] could have 10 elements data[1] could have only 5, so we plot only 5 bar graphs
-
- for i := 0; i < DataLen; i++ {
- if bc.minDataLen > len(bc.Data[i]) {
- bc.minDataLen = len(bc.Data[i])
- }
- }
-
- if LabelLen > bc.minDataLen {
- LabelLen = bc.minDataLen
- }
-
- for i := 0; i < LabelLen && i < bc.numBar; i++ {
- bc.labels[i] = trimStr2Runes(bc.DataLabels[i], bc.BarWidth)
- }
-
- for i := 0; i < bc.numStack; i++ {
- bc.dataNum[i] = make([][]rune, len(bc.Data[i]))
- //For each stack of bar calcualte the rune
- for j := 0; j < LabelLen && i < bc.numBar; j++ {
- n := bc.Data[i][j]
- s := fmt.Sprint(n)
- bc.dataNum[i][j] = trimStr2Runes(s, bc.BarWidth)
- }
- //If color is not defined by default then populate a color that is different from the prevous bar
- if bc.BarColor[i] == ColorDefault && bc.NumColor[i] == ColorDefault {
- if i == 0 {
- bc.BarColor[i] = ColorBlack
- } else {
- bc.BarColor[i] = bc.BarColor[i-1] + 1
- if bc.BarColor[i] > NumberofColors {
- bc.BarColor[i] = ColorBlack
- }
- }
- bc.NumColor[i] = (NumberofColors + 1) - bc.BarColor[i] //Make NumColor opposite of barColor for visibility
- }
- }
-
- //If Max value is not set then we have to populate, this time the max value will be max(sum(d1[0],d2[0],d3[0]) .... sum(d1[n], d2[n], d3[n]))
-
- if bc.max == 0 {
- bc.max = -1
- }
- for i := 0; i < bc.minDataLen && i < LabelLen; i++ {
- var dsum int
- for j := 0; j < bc.numStack; j++ {
- dsum += bc.Data[j][i]
- }
- if dsum > bc.max {
- bc.max = dsum
- }
- }
-
- //Finally Calculate max sale
- if bc.ShowScale {
- s := fmt.Sprintf("%d", bc.max)
- bc.maxScale = trimStr2Runes(s, len(s))
- bc.scale = float64(bc.max) / float64(bc.innerArea.Dy()-2)
- } else {
- bc.scale = float64(bc.max) / float64(bc.innerArea.Dy()-1)
- }
-
-}
-
-func (bc *MBarChart) SetMax(max int) {
-
- if max > 0 {
- bc.max = max
- }
-}
-
-// Buffer implements Bufferer interface.
-func (bc *MBarChart) Buffer() Buffer {
- buf := bc.Block.Buffer()
- bc.layout()
- var oftX int
-
- for i := 0; i < bc.numBar && i < bc.minDataLen && i < len(bc.DataLabels); i++ {
- ph := 0 //Previous Height to stack up
- oftX = i * (bc.BarWidth + bc.BarGap)
- for i1 := 0; i1 < bc.numStack; i1++ {
- h := int(float64(bc.Data[i1][i]) / bc.scale)
- // plot bars
- for j := 0; j < bc.BarWidth; j++ {
- for k := 0; k < h; k++ {
- c := Cell{
- Ch: ' ',
- Bg: bc.BarColor[i1],
- }
- if bc.BarColor[i1] == ColorDefault { // when color is default, space char treated as transparent!
- c.Bg |= AttrReverse
- }
- x := bc.innerArea.Min.X + i*(bc.BarWidth+bc.BarGap) + j
- y := bc.innerArea.Min.Y + bc.innerArea.Dy() - 2 - k - ph
- buf.Set(x, y, c)
-
- }
- }
- ph += h
- }
- // plot text
- for j, k := 0, 0; j < len(bc.labels[i]); j++ {
- w := charWidth(bc.labels[i][j])
- c := Cell{
- Ch: bc.labels[i][j],
- Bg: bc.Bg,
- Fg: bc.TextColor,
- }
- y := bc.innerArea.Min.Y + bc.innerArea.Dy() - 1
- x := bc.innerArea.Max.X + oftX + ((bc.BarWidth - len(bc.labels[i])) / 2) + k
- buf.Set(x, y, c)
- k += w
- }
- // plot num
- ph = 0 //re-initialize previous height
- for i1 := 0; i1 < bc.numStack; i1++ {
- h := int(float64(bc.Data[i1][i]) / bc.scale)
- for j := 0; j < len(bc.dataNum[i1][i]) && h > 0; j++ {
- c := Cell{
- Ch: bc.dataNum[i1][i][j],
- Fg: bc.NumColor[i1],
- Bg: bc.BarColor[i1],
- }
- if bc.BarColor[i1] == ColorDefault { // the same as above
- c.Bg |= AttrReverse
- }
- if h == 0 {
- c.Bg = bc.Bg
- }
- x := bc.innerArea.Min.X + oftX + (bc.BarWidth-len(bc.dataNum[i1][i]))/2 + j
- y := bc.innerArea.Min.Y + bc.innerArea.Dy() - 2 - ph
- buf.Set(x, y, c)
- }
- ph += h
- }
- }
-
- if bc.ShowScale {
- //Currently bar graph only supprts data range from 0 to MAX
- //Plot 0
- c := Cell{
- Ch: '0',
- Bg: bc.Bg,
- Fg: bc.TextColor,
- }
-
- y := bc.innerArea.Min.Y + bc.innerArea.Dy() - 2
- x := bc.X
- buf.Set(x, y, c)
-
- //Plot the maximum sacle value
- for i := 0; i < len(bc.maxScale); i++ {
- c := Cell{
- Ch: bc.maxScale[i],
- Bg: bc.Bg,
- Fg: bc.TextColor,
- }
-
- y := bc.innerArea.Min.Y
- x := bc.X + i
-
- buf.Set(x, y, c)
- }
-
- }
-
- return buf
-}
diff --git a/vendor/github.com/gizak/termui/mkdocs.yml b/vendor/github.com/gizak/termui/mkdocs.yml
deleted file mode 100644
index 2ab45f0..0000000
--- a/vendor/github.com/gizak/termui/mkdocs.yml
+++ /dev/null
@@ -1,28 +0,0 @@
-pages:
-- Home: 'index.md'
-- Quickstart: 'quickstart.md'
-- Recipes: 'recipes.md'
-- References:
- - Layouts: 'layouts.md'
- - Components: 'components.md'
- - Events: 'events.md'
- - Themes: 'themes.md'
-- Versions: 'versions.md'
-- About: 'about.md'
-
-site_name: termui
-repo_url: https://github.com/gizak/termui/
-site_description: 'termui user guide'
-site_author: gizak
-
-docs_dir: '_docs'
-
-theme: readthedocs
-
-markdown_extensions:
- - smarty
- - admonition
- - toc
-
-extra:
- version: 1.0
diff --git a/vendor/github.com/gizak/termui/par.go b/vendor/github.com/gizak/termui/par.go
deleted file mode 100644
index 29b6d46..0000000
--- a/vendor/github.com/gizak/termui/par.go
+++ /dev/null
@@ -1,73 +0,0 @@
-// Copyright 2017 Zack Guo . All rights reserved.
-// Use of this source code is governed by a MIT license that can
-// be found in the LICENSE file.
-
-package termui
-
-// Par displays a paragraph.
-/*
- par := termui.NewPar("Simple Text")
- par.Height = 3
- par.Width = 17
- par.BorderLabel = "Label"
-*/
-type Par struct {
- Block
- Text string
- TextFgColor Attribute
- TextBgColor Attribute
- WrapLength int // words wrap limit. Note it may not work properly with multi-width char
-}
-
-// NewPar returns a new *Par with given text as its content.
-func NewPar(s string) *Par {
- return &Par{
- Block: *NewBlock(),
- Text: s,
- TextFgColor: ThemeAttr("par.text.fg"),
- TextBgColor: ThemeAttr("par.text.bg"),
- WrapLength: 0,
- }
-}
-
-// Buffer implements Bufferer interface.
-func (p *Par) Buffer() Buffer {
- buf := p.Block.Buffer()
-
- fg, bg := p.TextFgColor, p.TextBgColor
- cs := DefaultTxBuilder.Build(p.Text, fg, bg)
-
- // wrap if WrapLength set
- if p.WrapLength < 0 {
- cs = wrapTx(cs, p.Width-2)
- } else if p.WrapLength > 0 {
- cs = wrapTx(cs, p.WrapLength)
- }
-
- y, x, n := 0, 0, 0
- for y < p.innerArea.Dy() && n < len(cs) {
- w := cs[n].Width()
- if cs[n].Ch == '\n' || x+w > p.innerArea.Dx() {
- y++
- x = 0 // set x = 0
- if cs[n].Ch == '\n' {
- n++
- }
-
- if y >= p.innerArea.Dy() {
- buf.Set(p.innerArea.Min.X+p.innerArea.Dx()-1,
- p.innerArea.Min.Y+p.innerArea.Dy()-1,
- Cell{Ch: '…', Fg: p.TextFgColor, Bg: p.TextBgColor})
- break
- }
- continue
- }
-
- buf.Set(p.innerArea.Min.X+x, p.innerArea.Min.Y+y, cs[n])
-
- n++
- x += w
- }
-
- return buf
-}
diff --git a/vendor/github.com/gizak/termui/par_test.go b/vendor/github.com/gizak/termui/par_test.go
deleted file mode 100644
index 4d28f4d..0000000
--- a/vendor/github.com/gizak/termui/par_test.go
+++ /dev/null
@@ -1,24 +0,0 @@
-// Copyright 2017 Zack Guo . All rights reserved.
-// Use of this source code is governed by a MIT license that can
-// be found in the LICENSE file.
-
-package termui
-
-import "testing"
-
-func TestPar_NoBorderBackground(t *testing.T) {
- par := NewPar("a")
- par.Border = false
- par.Bg = ColorBlue
- par.TextBgColor = ColorBlue
- par.Width = 2
- par.Height = 2
-
- pts := par.Buffer()
- for _, p := range pts.CellMap {
- t.Log(p)
- if p.Bg != par.Bg {
- t.Errorf("expected color to be %v but got %v", par.Bg, p.Bg)
- }
- }
-}
diff --git a/vendor/github.com/gizak/termui/pos.go b/vendor/github.com/gizak/termui/pos.go
deleted file mode 100644
index c7d647f..0000000
--- a/vendor/github.com/gizak/termui/pos.go
+++ /dev/null
@@ -1,78 +0,0 @@
-// Copyright 2017 Zack Guo . All rights reserved.
-// Use of this source code is governed by a MIT license that can
-// be found in the LICENSE file.
-
-package termui
-
-import "image"
-
-// Align is the position of the gauge's label.
-type Align uint
-
-// All supported positions.
-const (
- AlignNone Align = 0
- AlignLeft Align = 1 << iota
- AlignRight
- AlignBottom
- AlignTop
- AlignCenterVertical
- AlignCenterHorizontal
- AlignCenter = AlignCenterVertical | AlignCenterHorizontal
-)
-
-func AlignArea(parent, child image.Rectangle, a Align) image.Rectangle {
- w, h := child.Dx(), child.Dy()
-
- // parent center
- pcx, pcy := parent.Min.X+parent.Dx()/2, parent.Min.Y+parent.Dy()/2
- // child center
- ccx, ccy := child.Min.X+child.Dx()/2, child.Min.Y+child.Dy()/2
-
- if a&AlignLeft == AlignLeft {
- child.Min.X = parent.Min.X
- child.Max.X = child.Min.X + w
- }
-
- if a&AlignRight == AlignRight {
- child.Max.X = parent.Max.X
- child.Min.X = child.Max.X - w
- }
-
- if a&AlignBottom == AlignBottom {
- child.Max.Y = parent.Max.Y
- child.Min.Y = child.Max.Y - h
- }
-
- if a&AlignTop == AlignRight {
- child.Min.Y = parent.Min.Y
- child.Max.Y = child.Min.Y + h
- }
-
- if a&AlignCenterHorizontal == AlignCenterHorizontal {
- child.Min.X += pcx - ccx
- child.Max.X = child.Min.X + w
- }
-
- if a&AlignCenterVertical == AlignCenterVertical {
- child.Min.Y += pcy - ccy
- child.Max.Y = child.Min.Y + h
- }
-
- return child
-}
-
-func MoveArea(a image.Rectangle, dx, dy int) image.Rectangle {
- a.Min.X += dx
- a.Max.X += dx
- a.Min.Y += dy
- a.Max.Y += dy
- return a
-}
-
-var termWidth int
-var termHeight int
-
-func TermRect() image.Rectangle {
- return image.Rect(0, 0, termWidth, termHeight)
-}
diff --git a/vendor/github.com/gizak/termui/pos_test.go b/vendor/github.com/gizak/termui/pos_test.go
deleted file mode 100644
index 448876b..0000000
--- a/vendor/github.com/gizak/termui/pos_test.go
+++ /dev/null
@@ -1,38 +0,0 @@
-// Copyright 2017 Zack Guo . All rights reserved.
-// Use of this source code is governed by a MIT license that can
-// be found in the LICENSE file.
-
-package termui
-
-import (
- "image"
- "testing"
-)
-
-func TestAlignArea(t *testing.T) {
- p := image.Rect(0, 0, 100, 100)
- c := image.Rect(10, 10, 20, 20)
-
- nc := AlignArea(p, c, AlignLeft)
- if nc.Min.X != 0 || nc.Max.Y != 20 {
- t.Errorf("AlignLeft failed:\n%+v", nc)
- }
-
- nc = AlignArea(p, c, AlignCenter)
- if nc.Min.X != 45 || nc.Max.Y != 55 {
- t.Error("AlignCenter failed")
- }
-
- nc = AlignArea(p, c, AlignBottom|AlignRight)
- if nc.Min.X != 90 || nc.Max.Y != 100 {
- t.Errorf("AlignBottom|AlignRight failed\n%+v", nc)
- }
-}
-
-func TestMoveArea(t *testing.T) {
- a := image.Rect(10, 10, 20, 20)
- a = MoveArea(a, 5, 10)
- if a.Min.X != 15 || a.Min.Y != 20 || a.Max.X != 25 || a.Max.Y != 30 {
- t.Error("MoveArea failed")
- }
-}
diff --git a/vendor/github.com/gizak/termui/render.go b/vendor/github.com/gizak/termui/render.go
deleted file mode 100644
index 5b58409..0000000
--- a/vendor/github.com/gizak/termui/render.go
+++ /dev/null
@@ -1,164 +0,0 @@
-// Copyright 2017 Zack Guo . All rights reserved.
-// Use of this source code is governed by a MIT license that can
-// be found in the LICENSE file.
-
-package termui
-
-import (
- "image"
- "io"
- "sync"
- "time"
-
- "fmt"
-
- "os"
-
- "runtime/debug"
-
- "bytes"
-
- "github.com/maruel/panicparse/stack"
- tm "github.com/nsf/termbox-go"
-)
-
-// Bufferer should be implemented by all renderable components.
-type Bufferer interface {
- Buffer() Buffer
-}
-
-// Init initializes termui library. This function should be called before any others.
-// After initialization, the library must be finalized by 'Close' function.
-func Init() error {
- if err := tm.Init(); err != nil {
- return err
- }
-
- sysEvtChs = make([]chan Event, 0)
- go hookTermboxEvt()
-
- renderJobs = make(chan []Bufferer)
- //renderLock = new(sync.RWMutex)
-
- Body = NewGrid()
- Body.X = 0
- Body.Y = 0
- Body.BgColor = ThemeAttr("bg")
- Body.Width = TermWidth()
-
- DefaultEvtStream.Init()
- DefaultEvtStream.Merge("termbox", NewSysEvtCh())
- DefaultEvtStream.Merge("timer", NewTimerCh(time.Second))
- DefaultEvtStream.Merge("custom", usrEvtCh)
-
- DefaultEvtStream.Handle("/", DefualtHandler)
- DefaultEvtStream.Handle("/sys/wnd/resize", func(e Event) {
- w := e.Data.(EvtWnd)
- Body.Width = w.Width
- })
-
- DefaultWgtMgr = NewWgtMgr()
- DefaultEvtStream.Hook(DefaultWgtMgr.WgtHandlersHook())
-
- go func() {
- for bs := range renderJobs {
- render(bs...)
- }
- }()
-
- return nil
-}
-
-// Close finalizes termui library,
-// should be called after successful initialization when termui's functionality isn't required anymore.
-func Close() {
- tm.Close()
-}
-
-var renderLock sync.Mutex
-
-func termSync() {
- renderLock.Lock()
- tm.Sync()
- termWidth, termHeight = tm.Size()
- renderLock.Unlock()
-}
-
-// TermWidth returns the current terminal's width.
-func TermWidth() int {
- termSync()
- return termWidth
-}
-
-// TermHeight returns the current terminal's height.
-func TermHeight() int {
- termSync()
- return termHeight
-}
-
-// Render renders all Bufferer in the given order from left to right,
-// right could overlap on left ones.
-func render(bs ...Bufferer) {
- defer func() {
- if e := recover(); e != nil {
- Close()
- fmt.Fprintf(os.Stderr, "Captured a panic(value=%v) when rendering Bufferer. Exit termui and clean terminal...\nPrint stack trace:\n\n", e)
- //debug.PrintStack()
- gs, err := stack.ParseDump(bytes.NewReader(debug.Stack()), os.Stderr)
- if err != nil {
- debug.PrintStack()
- os.Exit(1)
- }
- p := &stack.Palette{}
- buckets := stack.SortBuckets(stack.Bucketize(gs, stack.AnyValue))
- srcLen, pkgLen := stack.CalcLengths(buckets, false)
- for _, bucket := range buckets {
- io.WriteString(os.Stdout, p.BucketHeader(&bucket, false, len(buckets) > 1))
- io.WriteString(os.Stdout, p.StackLines(&bucket.Signature, srcLen, pkgLen, false))
- }
- os.Exit(1)
- }
- }()
- for _, b := range bs {
-
- buf := b.Buffer()
- // set cels in buf
- for p, c := range buf.CellMap {
- if p.In(buf.Area) {
-
- tm.SetCell(p.X, p.Y, c.Ch, toTmAttr(c.Fg), toTmAttr(c.Bg))
-
- }
- }
-
- }
-
- renderLock.Lock()
- // render
- tm.Flush()
- renderLock.Unlock()
-}
-
-func Clear() {
- tm.Clear(tm.ColorDefault, toTmAttr(ThemeAttr("bg")))
-}
-
-func clearArea(r image.Rectangle, bg Attribute) {
- for i := r.Min.X; i < r.Max.X; i++ {
- for j := r.Min.Y; j < r.Max.Y; j++ {
- tm.SetCell(i, j, ' ', tm.ColorDefault, toTmAttr(bg))
- }
- }
-}
-
-func ClearArea(r image.Rectangle, bg Attribute) {
- clearArea(r, bg)
- tm.Flush()
-}
-
-var renderJobs chan []Bufferer
-
-func Render(bs ...Bufferer) {
- //go func() { renderJobs <- bs }()
- renderJobs <- bs
-}
diff --git a/vendor/github.com/gizak/termui/sparkline.go b/vendor/github.com/gizak/termui/sparkline.go
deleted file mode 100644
index d906e49..0000000
--- a/vendor/github.com/gizak/termui/sparkline.go
+++ /dev/null
@@ -1,167 +0,0 @@
-// Copyright 2017 Zack Guo . All rights reserved.
-// Use of this source code is governed by a MIT license that can
-// be found in the LICENSE file.
-
-package termui
-
-// Sparkline is like: ▅▆▂▂▅▇▂▂▃▆▆▆▅▃. The data points should be non-negative integers.
-/*
- data := []int{4, 2, 1, 6, 3, 9, 1, 4, 2, 15, 14, 9, 8, 6, 10, 13, 15, 12, 10, 5, 3, 6, 1}
- spl := termui.NewSparkline()
- spl.Data = data
- spl.Title = "Sparkline 0"
- spl.LineColor = termui.ColorGreen
-*/
-type Sparkline struct {
- Data []int
- Height int
- Title string
- TitleColor Attribute
- LineColor Attribute
- displayHeight int
- scale float32
- max int
-}
-
-// Sparklines is a renderable widget which groups together the given sparklines.
-/*
- spls := termui.NewSparklines(spl0,spl1,spl2) //...
- spls.Height = 2
- spls.Width = 20
-*/
-type Sparklines struct {
- Block
- Lines []Sparkline
- displayLines int
- displayWidth int
-}
-
-var sparks = []rune{'▁', '▂', '▃', '▄', '▅', '▆', '▇', '█'}
-
-// Add appends a given Sparkline to s *Sparklines.
-func (s *Sparklines) Add(sl Sparkline) {
- s.Lines = append(s.Lines, sl)
-}
-
-// NewSparkline returns a unrenderable single sparkline that intended to be added into Sparklines.
-func NewSparkline() Sparkline {
- return Sparkline{
- Height: 1,
- TitleColor: ThemeAttr("sparkline.title.fg"),
- LineColor: ThemeAttr("sparkline.line.fg")}
-}
-
-// NewSparklines return a new *Spaklines with given Sparkline(s), you can always add a new Sparkline later.
-func NewSparklines(ss ...Sparkline) *Sparklines {
- s := &Sparklines{Block: *NewBlock(), Lines: ss}
- return s
-}
-
-func (sl *Sparklines) update() {
- for i, v := range sl.Lines {
- if v.Title == "" {
- sl.Lines[i].displayHeight = v.Height
- } else {
- sl.Lines[i].displayHeight = v.Height + 1
- }
- }
- sl.displayWidth = sl.innerArea.Dx()
-
- // get how many lines gotta display
- h := 0
- sl.displayLines = 0
- for _, v := range sl.Lines {
- if h+v.displayHeight <= sl.innerArea.Dy() {
- sl.displayLines++
- } else {
- break
- }
- h += v.displayHeight
- }
-
- for i := 0; i < sl.displayLines; i++ {
- data := sl.Lines[i].Data
-
- max := 0
- for _, v := range data {
- if max < v {
- max = v
- }
- }
- sl.Lines[i].max = max
- if max != 0 {
- sl.Lines[i].scale = float32(8*sl.Lines[i].Height) / float32(max)
- } else { // when all negative
- sl.Lines[i].scale = 0
- }
- }
-}
-
-// Buffer implements Bufferer interface.
-func (sl *Sparklines) Buffer() Buffer {
- buf := sl.Block.Buffer()
- sl.update()
-
- oftY := 0
- for i := 0; i < sl.displayLines; i++ {
- l := sl.Lines[i]
- data := l.Data
-
- if len(data) > sl.innerArea.Dx() {
- data = data[len(data)-sl.innerArea.Dx():]
- }
-
- if l.Title != "" {
- rs := trimStr2Runes(l.Title, sl.innerArea.Dx())
- oftX := 0
- for _, v := range rs {
- w := charWidth(v)
- c := Cell{
- Ch: v,
- Fg: l.TitleColor,
- Bg: sl.Bg,
- }
- x := sl.innerArea.Min.X + oftX
- y := sl.innerArea.Min.Y + oftY
- buf.Set(x, y, c)
- oftX += w
- }
- }
-
- for j, v := range data {
- // display height of the data point, zero when data is negative
- h := int(float32(v)*l.scale + 0.5)
- if v < 0 {
- h = 0
- }
-
- barCnt := h / 8
- barMod := h % 8
- for jj := 0; jj < barCnt; jj++ {
- c := Cell{
- Ch: ' ', // => sparks[7]
- Bg: l.LineColor,
- }
- x := sl.innerArea.Min.X + j
- y := sl.innerArea.Min.Y + oftY + l.Height - jj
-
- //p.Bg = sl.BgColor
- buf.Set(x, y, c)
- }
- if barMod != 0 {
- c := Cell{
- Ch: sparks[barMod-1],
- Fg: l.LineColor,
- Bg: sl.Bg,
- }
- x := sl.innerArea.Min.X + j
- y := sl.innerArea.Min.Y + oftY + l.Height - barCnt
- buf.Set(x, y, c)
- }
- }
-
- oftY += l.displayHeight
- }
-
- return buf
-}
diff --git a/vendor/github.com/gizak/termui/table.go b/vendor/github.com/gizak/termui/table.go
deleted file mode 100644
index e3d1bbf..0000000
--- a/vendor/github.com/gizak/termui/table.go
+++ /dev/null
@@ -1,185 +0,0 @@
-// Copyright 2017 Zack Guo . All rights reserved.
-// Use of this source code is governed by a MIT license that can
-// be found in the LICENSE file.
-
-package termui
-
-import "strings"
-
-/* Table is like:
-
-┌Awesome Table ────────────────────────────────────────────────┐
-│ Col0 | Col1 | Col2 | Col3 | Col4 | Col5 | Col6 |
-│──────────────────────────────────────────────────────────────│
-│ Some Item #1 | AAA | 123 | CCCCC | EEEEE | GGGGG | IIIII |
-│──────────────────────────────────────────────────────────────│
-│ Some Item #2 | BBB | 456 | DDDDD | FFFFF | HHHHH | JJJJJ |
-└──────────────────────────────────────────────────────────────┘
-
-Datapoints are a two dimensional array of strings: [][]string
-
-Example:
- data := [][]string{
- {"Col0", "Col1", "Col3", "Col4", "Col5", "Col6"},
- {"Some Item #1", "AAA", "123", "CCCCC", "EEEEE", "GGGGG", "IIIII"},
- {"Some Item #2", "BBB", "456", "DDDDD", "FFFFF", "HHHHH", "JJJJJ"},
- }
-
- table := termui.NewTable()
- table.Rows = data // type [][]string
- table.FgColor = termui.ColorWhite
- table.BgColor = termui.ColorDefault
- table.Height = 7
- table.Width = 62
- table.Y = 0
- table.X = 0
- table.Border = true
-*/
-
-// Table tracks all the attributes of a Table instance
-type Table struct {
- Block
- Rows [][]string
- CellWidth []int
- FgColor Attribute
- BgColor Attribute
- FgColors []Attribute
- BgColors []Attribute
- Separator bool
- TextAlign Align
-}
-
-// NewTable returns a new Table instance
-func NewTable() *Table {
- table := &Table{Block: *NewBlock()}
- table.FgColor = ColorWhite
- table.BgColor = ColorDefault
- table.Separator = true
- return table
-}
-
-// CellsWidth calculates the width of a cell array and returns an int
-func cellsWidth(cells []Cell) int {
- width := 0
- for _, c := range cells {
- width += c.Width()
- }
- return width
-}
-
-// Analysis generates and returns an array of []Cell that represent all columns in the Table
-func (table *Table) Analysis() [][]Cell {
- var rowCells [][]Cell
- length := len(table.Rows)
- if length < 1 {
- return rowCells
- }
-
- if len(table.FgColors) == 0 {
- table.FgColors = make([]Attribute, len(table.Rows))
- }
- if len(table.BgColors) == 0 {
- table.BgColors = make([]Attribute, len(table.Rows))
- }
-
- cellWidths := make([]int, len(table.Rows[0]))
-
- for y, row := range table.Rows {
- if table.FgColors[y] == 0 {
- table.FgColors[y] = table.FgColor
- }
- if table.BgColors[y] == 0 {
- table.BgColors[y] = table.BgColor
- }
- for x, str := range row {
- cells := DefaultTxBuilder.Build(str, table.FgColors[y], table.BgColors[y])
- cw := cellsWidth(cells)
- if cellWidths[x] < cw {
- cellWidths[x] = cw
- }
- rowCells = append(rowCells, cells)
- }
- }
- table.CellWidth = cellWidths
- return rowCells
-}
-
-// SetSize calculates the table size and sets the internal value
-func (table *Table) SetSize() {
- length := len(table.Rows)
- if table.Separator {
- table.Height = length*2 + 1
- } else {
- table.Height = length + 2
- }
- table.Width = 2
- if length != 0 {
- for _, cellWidth := range table.CellWidth {
- table.Width += cellWidth + 3
- }
- }
-}
-
-// CalculatePosition ...
-func (table *Table) CalculatePosition(x int, y int, coordinateX *int, coordinateY *int, cellStart *int) {
- if table.Separator {
- *coordinateY = table.innerArea.Min.Y + y*2
- } else {
- *coordinateY = table.innerArea.Min.Y + y
- }
- if x == 0 {
- *cellStart = table.innerArea.Min.X
- } else {
- *cellStart += table.CellWidth[x-1] + 3
- }
-
- switch table.TextAlign {
- case AlignRight:
- *coordinateX = *cellStart + (table.CellWidth[x] - len(table.Rows[y][x])) + 2
- case AlignCenter:
- *coordinateX = *cellStart + (table.CellWidth[x]-len(table.Rows[y][x]))/2 + 2
- default:
- *coordinateX = *cellStart + 2
- }
-}
-
-// Buffer ...
-func (table *Table) Buffer() Buffer {
- buffer := table.Block.Buffer()
- rowCells := table.Analysis()
- pointerX := table.innerArea.Min.X + 2
- pointerY := table.innerArea.Min.Y
- borderPointerX := table.innerArea.Min.X
- for y, row := range table.Rows {
- for x := range row {
- table.CalculatePosition(x, y, &pointerX, &pointerY, &borderPointerX)
- background := DefaultTxBuilder.Build(strings.Repeat(" ", table.CellWidth[x]+3), table.BgColors[y], table.BgColors[y])
- cells := rowCells[y*len(row)+x]
- for i, back := range background {
- buffer.Set(borderPointerX+i, pointerY, back)
- }
-
- coordinateX := pointerX
- for _, printer := range cells {
- buffer.Set(coordinateX, pointerY, printer)
- coordinateX += printer.Width()
- }
-
- if x != 0 {
- dividors := DefaultTxBuilder.Build("|", table.FgColors[y], table.BgColors[y])
- for _, dividor := range dividors {
- buffer.Set(borderPointerX, pointerY, dividor)
- }
- }
- }
-
- if table.Separator {
- border := DefaultTxBuilder.Build(strings.Repeat("─", table.Width-2), table.FgColor, table.BgColor)
- for i, cell := range border {
- buffer.Set(i+1, pointerY+1, cell)
- }
- }
- }
-
- return buffer
-}
diff --git a/vendor/github.com/gizak/termui/test/runtest.go b/vendor/github.com/gizak/termui/test/runtest.go
deleted file mode 100644
index 2451ce9..0000000
--- a/vendor/github.com/gizak/termui/test/runtest.go
+++ /dev/null
@@ -1,66 +0,0 @@
-// Copyright 2017 Zack Guo . All rights reserved.
-// Use of this source code is governed by a MIT license that can
-// be found in the LICENSE file.
-
-package main
-
-import (
- "fmt"
- "os"
-
- "github.com/gizak/termui"
- "github.com/gizak/termui/debug"
-)
-
-func main() {
- // run as client
- if len(os.Args) > 1 {
- fmt.Print(debug.ConnectAndListen())
- return
- }
-
- // run as server
- go func() { panic(debug.ListenAndServe()) }()
-
- if err := termui.Init(); err != nil {
- panic(err)
- }
- defer termui.Close()
-
- //termui.UseTheme("helloworld")
- b := termui.NewBlock()
- b.Width = 20
- b.Height = 20
- b.Float = termui.AlignCenter
- b.BorderLabel = "[HELLO](fg-red,bg-white) [WORLD](fg-blue,bg-green)"
-
- termui.Render(b)
-
- termui.Handle("/sys", func(e termui.Event) {
- k, ok := e.Data.(termui.EvtKbd)
- debug.Logf("->%v\n", e)
- if ok && k.KeyStr == "q" {
- termui.StopLoop()
- }
- })
-
- termui.Handle(("/usr"), func(e termui.Event) {
- debug.Logf("->%v\n", e)
- })
-
- termui.Handle("/timer/1s", func(e termui.Event) {
- t := e.Data.(termui.EvtTimer)
- termui.SendCustomEvt("/usr/t", t.Count)
-
- if t.Count%2 == 0 {
- b.BorderLabel = "[HELLO](fg-red,bg-green) [WORLD](fg-blue,bg-white)"
- } else {
- b.BorderLabel = "[HELLO](fg-blue,bg-white) [WORLD](fg-red,bg-green)"
- }
-
- termui.Render(b)
-
- })
-
- termui.Loop()
-}
diff --git a/vendor/github.com/gizak/termui/textbuilder.go b/vendor/github.com/gizak/termui/textbuilder.go
deleted file mode 100644
index 12e2055..0000000
--- a/vendor/github.com/gizak/termui/textbuilder.go
+++ /dev/null
@@ -1,278 +0,0 @@
-// Copyright 2017 Zack Guo . All rights reserved.
-// Use of this source code is governed by a MIT license that can
-// be found in the LICENSE file.
-
-package termui
-
-import (
- "regexp"
- "strings"
-
- "github.com/mitchellh/go-wordwrap"
-)
-
-// TextBuilder is a minimal interface to produce text []Cell using specific syntax (markdown).
-type TextBuilder interface {
- Build(s string, fg, bg Attribute) []Cell
-}
-
-// DefaultTxBuilder is set to be MarkdownTxBuilder.
-var DefaultTxBuilder = NewMarkdownTxBuilder()
-
-// MarkdownTxBuilder implements TextBuilder interface, using markdown syntax.
-type MarkdownTxBuilder struct {
- baseFg Attribute
- baseBg Attribute
- plainTx []rune
- markers []marker
-}
-
-type marker struct {
- st int
- ed int
- fg Attribute
- bg Attribute
-}
-
-var colorMap = map[string]Attribute{
- "red": ColorRed,
- "blue": ColorBlue,
- "black": ColorBlack,
- "cyan": ColorCyan,
- "yellow": ColorYellow,
- "white": ColorWhite,
- "default": ColorDefault,
- "green": ColorGreen,
- "magenta": ColorMagenta,
-}
-
-var attrMap = map[string]Attribute{
- "bold": AttrBold,
- "underline": AttrUnderline,
- "reverse": AttrReverse,
-}
-
-func rmSpc(s string) string {
- reg := regexp.MustCompile(`\s+`)
- return reg.ReplaceAllString(s, "")
-}
-
-// readAttr translates strings like `fg-red,fg-bold,bg-white` to fg and bg Attribute
-func (mtb MarkdownTxBuilder) readAttr(s string) (Attribute, Attribute) {
- fg := mtb.baseFg
- bg := mtb.baseBg
-
- updateAttr := func(a Attribute, attrs []string) Attribute {
- for _, s := range attrs {
- // replace the color
- if c, ok := colorMap[s]; ok {
- a &= 0xFF00 // erase clr 0 ~ 8 bits
- a |= c // set clr
- }
- // add attrs
- if c, ok := attrMap[s]; ok {
- a |= c
- }
- }
- return a
- }
-
- ss := strings.Split(s, ",")
- fgs := []string{}
- bgs := []string{}
- for _, v := range ss {
- subs := strings.Split(v, "-")
- if len(subs) > 1 {
- if subs[0] == "fg" {
- fgs = append(fgs, subs[1])
- }
- if subs[0] == "bg" {
- bgs = append(bgs, subs[1])
- }
- }
- }
-
- fg = updateAttr(fg, fgs)
- bg = updateAttr(bg, bgs)
- return fg, bg
-}
-
-func (mtb *MarkdownTxBuilder) reset() {
- mtb.plainTx = []rune{}
- mtb.markers = []marker{}
-}
-
-// parse streams and parses text into normalized text and render sequence.
-func (mtb *MarkdownTxBuilder) parse(str string) {
- rs := str2runes(str)
- normTx := []rune{}
- square := []rune{}
- brackt := []rune{}
- accSquare := false
- accBrackt := false
- cntSquare := 0
-
- reset := func() {
- square = []rune{}
- brackt = []rune{}
- accSquare = false
- accBrackt = false
- cntSquare = 0
- }
- // pipe stacks into normTx and clear
- rollback := func() {
- normTx = append(normTx, square...)
- normTx = append(normTx, brackt...)
- reset()
- }
- // chop first and last
- chop := func(s []rune) []rune {
- return s[1 : len(s)-1]
- }
-
- for i, r := range rs {
- switch {
- // stacking brackt
- case accBrackt:
- brackt = append(brackt, r)
- if ')' == r {
- fg, bg := mtb.readAttr(string(chop(brackt)))
- st := len(normTx)
- ed := len(normTx) + len(square) - 2
- mtb.markers = append(mtb.markers, marker{st, ed, fg, bg})
- normTx = append(normTx, chop(square)...)
- reset()
- } else if i+1 == len(rs) {
- rollback()
- }
- // stacking square
- case accSquare:
- switch {
- // squares closed and followed by a '('
- case cntSquare == 0 && '(' == r:
- accBrackt = true
- brackt = append(brackt, '(')
- // squares closed but not followed by a '('
- case cntSquare == 0:
- rollback()
- if '[' == r {
- accSquare = true
- cntSquare = 1
- brackt = append(brackt, '[')
- } else {
- normTx = append(normTx, r)
- }
- // hit the end
- case i+1 == len(rs):
- square = append(square, r)
- rollback()
- case '[' == r:
- cntSquare++
- square = append(square, '[')
- case ']' == r:
- cntSquare--
- square = append(square, ']')
- // normal char
- default:
- square = append(square, r)
- }
- // stacking normTx
- default:
- if '[' == r {
- accSquare = true
- cntSquare = 1
- square = append(square, '[')
- } else {
- normTx = append(normTx, r)
- }
- }
- }
-
- mtb.plainTx = normTx
-}
-
-func wrapTx(cs []Cell, wl int) []Cell {
- tmpCell := make([]Cell, len(cs))
- copy(tmpCell, cs)
-
- // get the plaintext
- plain := CellsToStr(cs)
-
- // wrap
- plainWrapped := wordwrap.WrapString(plain, uint(wl))
-
- // find differences and insert
- finalCell := tmpCell // finalcell will get the inserts and is what is returned
-
- plainRune := []rune(plain)
- plainWrappedRune := []rune(plainWrapped)
- trigger := "go"
- plainRuneNew := plainRune
-
- for trigger != "stop" {
- plainRune = plainRuneNew
- for i := range plainRune {
- if plainRune[i] == plainWrappedRune[i] {
- trigger = "stop"
- } else if plainRune[i] != plainWrappedRune[i] && plainWrappedRune[i] == 10 {
- trigger = "go"
- cell := Cell{10, 0, 0}
- j := i - 0
-
- // insert a cell into the []Cell in correct position
- tmpCell[i] = cell
-
- // insert the newline into plain so we avoid indexing errors
- plainRuneNew = append(plainRune, 10)
- copy(plainRuneNew[j+1:], plainRuneNew[j:])
- plainRuneNew[j] = plainWrappedRune[j]
-
- // restart the inner for loop until plain and plain wrapped are
- // the same; yeah, it's inefficient, but the text amounts
- // should be small
- break
-
- } else if plainRune[i] != plainWrappedRune[i] &&
- plainWrappedRune[i-1] == 10 && // if the prior rune is a newline
- plainRune[i] == 32 { // and this rune is a space
- trigger = "go"
- // need to delete plainRune[i] because it gets rid of an extra
- // space
- plainRuneNew = append(plainRune[:i], plainRune[i+1:]...)
- break
-
- } else {
- trigger = "stop" // stops the outer for loop
- }
- }
- }
-
- finalCell = tmpCell
-
- return finalCell
-}
-
-// Build implements TextBuilder interface.
-func (mtb MarkdownTxBuilder) Build(s string, fg, bg Attribute) []Cell {
- mtb.baseFg = fg
- mtb.baseBg = bg
- mtb.reset()
- mtb.parse(s)
- cs := make([]Cell, len(mtb.plainTx))
- for i := range cs {
- cs[i] = Cell{Ch: mtb.plainTx[i], Fg: fg, Bg: bg}
- }
- for _, mrk := range mtb.markers {
- for i := mrk.st; i < mrk.ed; i++ {
- cs[i].Fg = mrk.fg
- cs[i].Bg = mrk.bg
- }
- }
-
- return cs
-}
-
-// NewMarkdownTxBuilder returns a TextBuilder employing markdown syntax.
-func NewMarkdownTxBuilder() TextBuilder {
- return MarkdownTxBuilder{}
-}
diff --git a/vendor/github.com/gizak/termui/textbuilder_test.go b/vendor/github.com/gizak/termui/textbuilder_test.go
deleted file mode 100644
index 8f458ec..0000000
--- a/vendor/github.com/gizak/termui/textbuilder_test.go
+++ /dev/null
@@ -1,70 +0,0 @@
-// Copyright 2017 Zack Guo . All rights reserved.
-// Use of this source code is governed by a MIT license that can
-// be found in the LICENSE file.
-
-package termui
-
-import "testing"
-
-func TestReadAttr(t *testing.T) {
- m := MarkdownTxBuilder{}
- m.baseFg = ColorCyan | AttrUnderline
- m.baseBg = ColorBlue | AttrBold
- fg, bg := m.readAttr("fg-red,bg-reverse")
- if fg != ColorRed|AttrUnderline || bg != ColorBlue|AttrBold|AttrReverse {
- t.Error("readAttr failed")
- }
-}
-
-func TestMTBParse(t *testing.T) {
- /*
- str := func(cs []Cell) string {
- rs := make([]rune, len(cs))
- for i := range cs {
- rs[i] = cs[i].Ch
- }
- return string(rs)
- }
- */
-
- tbls := [][]string{
- {"hello world", "hello world"},
- {"[hello](fg-red) world", "hello world"},
- {"[[hello]](bg-red) world", "[hello] world"},
- {"[1] hello world", "[1] hello world"},
- {"[[1]](bg-white) [hello] world", "[1] [hello] world"},
- {"[hello world]", "[hello world]"},
- {"", ""},
- {"[hello world)", "[hello world)"},
- {"[0] [hello](bg-red)[ world](fg-blue)!", "[0] hello world!"},
- }
-
- m := MarkdownTxBuilder{}
- m.baseFg = ColorWhite
- m.baseBg = ColorDefault
- for _, s := range tbls {
- m.reset()
- m.parse(s[0])
- res := string(m.plainTx)
- if s[1] != res {
- t.Errorf("\ninput :%s\nshould:%s\noutput:%s", s[0], s[1], res)
- }
- }
-
- m.reset()
- m.parse("[0] [hello](bg-red)[ world](fg-blue)")
- if len(m.markers) != 2 &&
- m.markers[0].st == 4 &&
- m.markers[0].ed == 11 &&
- m.markers[0].fg == ColorWhite &&
- m.markers[0].bg == ColorRed {
- t.Error("markers dismatch")
- }
-
- m2 := NewMarkdownTxBuilder()
- cs := m2.Build("[0] [hellob-e) wrd]fgblue)!", ColorWhite, ColorBlack)
- cs = m2.Build("[0] [hello](bg-red) [world](fg-blue)!", ColorWhite, ColorBlack)
- if cs[4].Ch != 'h' && cs[4].Bg != ColorRed && cs[4].Fg != ColorWhite {
- t.Error("dismatch in Build")
- }
-}
diff --git a/vendor/github.com/gizak/termui/theme.go b/vendor/github.com/gizak/termui/theme.go
deleted file mode 100644
index 21fb3bf..0000000
--- a/vendor/github.com/gizak/termui/theme.go
+++ /dev/null
@@ -1,140 +0,0 @@
-// Copyright 2017 Zack Guo . All rights reserved.
-// Use of this source code is governed by a MIT license that can
-// be found in the LICENSE file.
-
-package termui
-
-import "strings"
-
-/*
-// A ColorScheme represents the current look-and-feel of the dashboard.
-type ColorScheme struct {
- BodyBg Attribute
- BlockBg Attribute
- HasBorder bool
- BorderFg Attribute
- BorderBg Attribute
- BorderLabelTextFg Attribute
- BorderLabelTextBg Attribute
- ParTextFg Attribute
- ParTextBg Attribute
- SparklineLine Attribute
- SparklineTitle Attribute
- GaugeBar Attribute
- GaugePercent Attribute
- LineChartLine Attribute
- LineChartAxes Attribute
- ListItemFg Attribute
- ListItemBg Attribute
- BarChartBar Attribute
- BarChartText Attribute
- BarChartNum Attribute
- MBarChartBar Attribute
- MBarChartText Attribute
- MBarChartNum Attribute
- TabActiveBg Attribute
-}
-
-// default color scheme depends on the user's terminal setting.
-var themeDefault = ColorScheme{HasBorder: true}
-
-var themeHelloWorld = ColorScheme{
- BodyBg: ColorBlack,
- BlockBg: ColorBlack,
- HasBorder: true,
- BorderFg: ColorWhite,
- BorderBg: ColorBlack,
- BorderLabelTextBg: ColorBlack,
- BorderLabelTextFg: ColorGreen,
- ParTextBg: ColorBlack,
- ParTextFg: ColorWhite,
- SparklineLine: ColorMagenta,
- SparklineTitle: ColorWhite,
- GaugeBar: ColorRed,
- GaugePercent: ColorWhite,
- LineChartLine: ColorYellow | AttrBold,
- LineChartAxes: ColorWhite,
- ListItemBg: ColorBlack,
- ListItemFg: ColorYellow,
- BarChartBar: ColorRed,
- BarChartNum: ColorWhite,
- BarChartText: ColorCyan,
- MBarChartBar: ColorRed,
- MBarChartNum: ColorWhite,
- MBarChartText: ColorCyan,
- TabActiveBg: ColorMagenta,
-}
-
-var theme = themeDefault // global dep
-
-// Theme returns the currently used theme.
-func Theme() ColorScheme {
- return theme
-}
-
-// SetTheme sets a new, custom theme.
-func SetTheme(newTheme ColorScheme) {
- theme = newTheme
-}
-
-// UseTheme sets a predefined scheme. Currently available: "hello-world" and
-// "black-and-white".
-func UseTheme(th string) {
- switch th {
- case "helloworld":
- theme = themeHelloWorld
- default:
- theme = themeDefault
- }
-}
-*/
-
-var ColorMap = map[string]Attribute{
- "fg": ColorWhite,
- "bg": ColorDefault,
- "border.fg": ColorWhite,
- "label.fg": ColorGreen,
- "par.fg": ColorYellow,
- "par.label.bg": ColorWhite,
-}
-
-func ThemeAttr(name string) Attribute {
- return lookUpAttr(ColorMap, name)
-}
-
-func lookUpAttr(clrmap map[string]Attribute, name string) Attribute {
-
- a, ok := clrmap[name]
- if ok {
- return a
- }
-
- ns := strings.Split(name, ".")
- for i := range ns {
- nn := strings.Join(ns[i:len(ns)], ".")
- a, ok = ColorMap[nn]
- if ok {
- break
- }
- }
-
- return a
-}
-
-// 0<=r,g,b <= 5
-func ColorRGB(r, g, b int) Attribute {
- within := func(n int) int {
- if n < 0 {
- return 0
- }
-
- if n > 5 {
- return 5
- }
-
- return n
- }
-
- r, b, g = within(r), within(b), within(g)
- return Attribute(0x0f + 36*r + 6*g + b)
-}
diff --git a/vendor/github.com/gizak/termui/theme_test.go b/vendor/github.com/gizak/termui/theme_test.go
deleted file mode 100644
index f3d327c..0000000
--- a/vendor/github.com/gizak/termui/theme_test.go
+++ /dev/null
@@ -1,35 +0,0 @@
-// Copyright 2017 Zack Guo . All rights reserved.
-// Use of this source code is governed by a MIT license that can
-// be found in the LICENSE file.
-
-package termui
-
-import "testing"
-
-var cmap = map[string]Attribute{
- "fg": ColorWhite,
- "bg": ColorDefault,
- "border.fg": ColorWhite,
- "label.fg": ColorGreen,
- "par.fg": ColorYellow,
- "par.label.bg": ColorWhite,
-}
-
-func TestLoopUpAttr(t *testing.T) {
- tbl := []struct {
- name string
- should Attribute
- }{
- {"par.label.bg", ColorWhite},
- {"par.label.fg", ColorGreen},
- {"par.bg", ColorDefault},
- {"bar.border.fg", ColorWhite},
- {"bar.label.bg", ColorDefault},
- }
-
- for _, v := range tbl {
- if lookUpAttr(cmap, v.name) != v.should {
- t.Error(v.name)
- }
- }
-}
diff --git a/vendor/github.com/gizak/termui/widget.go b/vendor/github.com/gizak/termui/widget.go
deleted file mode 100644
index 80276bf..0000000
--- a/vendor/github.com/gizak/termui/widget.go
+++ /dev/null
@@ -1,94 +0,0 @@
-// Copyright 2017 Zack Guo . All rights reserved.
-// Use of this source code is governed by a MIT license that can
-// be found in the LICENSE file.
-
-package termui
-
-import (
- "fmt"
- "sync"
-)
-
-// event mixins
-type WgtMgr map[string]WgtInfo
-
-type WgtInfo struct {
- Handlers map[string]func(Event)
- WgtRef Widget
- Id string
-}
-
-type Widget interface {
- Id() string
-}
-
-func NewWgtInfo(wgt Widget) WgtInfo {
- return WgtInfo{
- Handlers: make(map[string]func(Event)),
- WgtRef: wgt,
- Id: wgt.Id(),
- }
-}
-
-func NewWgtMgr() WgtMgr {
- wm := WgtMgr(make(map[string]WgtInfo))
- return wm
-
-}
-
-func (wm WgtMgr) AddWgt(wgt Widget) {
- wm[wgt.Id()] = NewWgtInfo(wgt)
-}
-
-func (wm WgtMgr) RmWgt(wgt Widget) {
- wm.RmWgtById(wgt.Id())
-}
-
-func (wm WgtMgr) RmWgtById(id string) {
- delete(wm, id)
-}
-
-func (wm WgtMgr) AddWgtHandler(id, path string, h func(Event)) {
- if w, ok := wm[id]; ok {
- w.Handlers[path] = h
- }
-}
-
-func (wm WgtMgr) RmWgtHandler(id, path string) {
- if w, ok := wm[id]; ok {
- delete(w.Handlers, path)
- }
-}
-
-var counter struct {
- sync.RWMutex
- count int
-}
-
-func GenId() string {
- counter.Lock()
- defer counter.Unlock()
-
- counter.count += 1
- return fmt.Sprintf("%d", counter.count)
-}
-
-func (wm WgtMgr) WgtHandlersHook() func(Event) {
- return func(e Event) {
- for _, v := range wm {
- if k := findMatch(v.Handlers, e.Path); k != "" {
- v.Handlers[k](e)
- }
- }
- }
-}
-
-var DefaultWgtMgr WgtMgr
-
-func (b *Block) Handle(path string, handler func(Event)) {
- if _, ok := DefaultWgtMgr[b.Id()]; !ok {
- DefaultWgtMgr.AddWgt(b)
- }
-
- DefaultWgtMgr.AddWgtHandler(b.Id(), path, handler)
-}
diff --git a/vendor/github.com/jawher/mow.cli/.gitignore b/vendor/github.com/jawher/mow.cli/.gitignore
deleted file mode 100644
index 4feabb0..0000000
--- a/vendor/github.com/jawher/mow.cli/.gitignore
+++ /dev/null
@@ -1,2 +0,0 @@
-testdata/*.golden
-coverage.out
diff --git a/vendor/github.com/jawher/mow.cli/.travis.yml b/vendor/github.com/jawher/mow.cli/.travis.yml
deleted file mode 100644
index 768003f..0000000
--- a/vendor/github.com/jawher/mow.cli/.travis.yml
+++ /dev/null
@@ -1,19 +0,0 @@
-language: go
-go:
-- 1.8
-- 1.7
-- tip
-sudo: false
-
-install: make setup
-
-script: make check test
-
-deploy:
- provider: releases
- api_key:
- secure: D2fwuS7n54ZkjfRmLMEAnwR2lQLa5xd+4s0l65pI6UN4ljVfQwQiFdZXaZWFr8PYSTKTm0UPj6Iqqw7VOl8I6iDzcaOqN3hoh5mDaJ7kyo7GZRPodwK9MKdOp5dPw459L2Atll8kxb4iYmfnjmcl0lDCUuWvMxXx+zgiFTB7BO0=
- skip_cleanup: true
- on:
- tags: true
- go: 1.8
diff --git a/vendor/github.com/jawher/mow.cli/LICENSE b/vendor/github.com/jawher/mow.cli/LICENSE
deleted file mode 100644
index 37b598a..0000000
--- a/vendor/github.com/jawher/mow.cli/LICENSE
+++ /dev/null
@@ -1,22 +0,0 @@
- The MIT License
-
-Copyright (c) 2014, Jawher Moussa
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
-
diff --git a/vendor/github.com/jawher/mow.cli/Makefile b/vendor/github.com/jawher/mow.cli/Makefile
deleted file mode 100644
index ddb334d..0000000
--- a/vendor/github.com/jawher/mow.cli/Makefile
+++ /dev/null
@@ -1,25 +0,0 @@
-test:
- go test -v ./...
-
-check: lint vet fmtcheck ineffassign
-
-lint:
- golint -set_exit_status .
-
-vet:
- go vet
-
-fmtcheck:
- @ export output="$$(gofmt -s -d .)"; \
- [ -n "$${output}" ] && echo "$${output}" && export status=1; \
- exit $${status:-0}
-
-ineffassign:
- ineffassign .
-
-setup:
- go get github.com/gordonklaus/ineffassign
- go get github.com/golang/lint/golint
- go get -t -u ./...
-
-.PHONY: test check lint vet fmtcheck ineffassign
diff --git a/vendor/github.com/jawher/mow.cli/README.md b/vendor/github.com/jawher/mow.cli/README.md
deleted file mode 100644
index 62be431..0000000
--- a/vendor/github.com/jawher/mow.cli/README.md
+++ /dev/null
@@ -1,771 +0,0 @@
-# mow.cli
-
-[![Build Status](https://travis-ci.org/jawher/mow.cli.svg?branch=master)](https://travis-ci.org/jawher/mow.cli)
-[![GoDoc](https://godoc.org/github.com/jawher/mow.cli?status.svg)](https://godoc.org/github.com/jawher/mow.cli)
-
-A framework to build command line applications in Go with most of the burden of arguments parsing and validation placed on the framework instead of the developer.
-
-## First app
-
-### A simple app
-
-```go
-package main
-
-import (
- "fmt"
- "os"
-
- "github.com/jawher/mow.cli"
-)
-
-func main() {
- app := cli.App("cp", "Copy files around")
-
- app.Spec = "[-r] SRC... DST"
-
- var (
- recursive = app.BoolOpt("r recursive", false, "Copy files recursively")
- src = app.StringsArg("SRC", nil, "Source files to copy")
- dst = app.StringArg("DST", "", "Destination where to copy files to")
- )
-
- app.Action = func() {
- fmt.Printf("Copying %v to %s [recursively: %v]\n", *src, *dst, *recursive)
- }
-
- app.Run(os.Args)
-}
-```
-
-### An app with multiple commands:
-
-```go
-package main
-
-import (
- "fmt"
- "os"
-
- "github.com/jawher/mow.cli"
-)
-
-func main() {
- app := cli.App("uman", "User Manager")
-
- app.Spec = "[-v]"
-
- var (
- verbose = app.BoolOpt("v verbose", false, "Verbose debug mode")
- )
-
- app.Before = func() {
- if *verbose {
- // Here you can enable debug output in your logger for example
- fmt.Println("Verbose mode enabled")
- }
- }
-
- // Declare a first command, invocable with "uman list"
- app.Command("list", "list the users", func(cmd *cli.Cmd) {
- // These are the command specific options and args, nicely scoped inside a func
- var (
- all = cmd.BoolOpt("all", false, "Display all users, including disabled ones")
- )
-
- // What to run when this command is called
- cmd.Action = func() {
- // Inside the action, and only inside, you can safely access the values of the options and arguments
- fmt.Printf("user list (including disabled ones: %v)\n", *all)
- }
- })
-
- // The second command, invocable with "uman get"
- app.Command("get", "get a user details", func(cmd *cli.Cmd) {
- var (
- detailed = cmd.BoolOpt("detailed", false, "Disaply detailed information")
- id = cmd.StringArg("ID", "", "The user id to display")
- )
-
- cmd.Action = func() {
- fmt.Printf("user %q details (detailed mode: %v)\n", *id, *detailed)
- }
- })
-
- // Now that the app is configured, execute it passing in the os.Args array
- app.Run(os.Args)
-}
-```
-
-## Motivation
-
-| | mow.cli | codegangsta/cli | flag |
-|----------------------------------------------------------------------|---------|-----------------|------|
-| Contextual help | ✓ | ✓ | |
-| Commands | ✓ | ✓ | |
-| Option folding `-xyz` | ✓ | | |
-| Option Value folding `-fValue` | ✓ | | |
-| Option exclusion: `--start ❘ --stop` | ✓ | | |
-| Option dependency : `[-a -b]` or `[-a [-b]]` | ✓ | | |
-| Arguments validation : `SRC DST` | ✓ | | |
-| Argument optionality : `SRC [DST]` | ✓ | | |
-| Argument repetition : `SRC... DST` | ✓ | | |
-| Option/Argument dependency : `SRC [-f DST]` | ✓ | | |
-| Any combination of the above: `[-d ❘ --rm] IMAGE [COMMAND [ARG...]]` | ✓ | | |
-
-In the goland, docopt is another library with rich flags and arguments validation.
-However, it falls short for many use cases:
-
-| | mow.cli | docopt |
-|-----------------------------|---------|--------|
-| Contextual help | ✓ | |
-| Backtracking: `SRC... DST` | ✓ | |
-| Backtracking: `[SRC] DST` | ✓ | |
-| Branching: `(SRC ❘ -f DST)` | ✓ | |
-
-## Installation
-
-To install this library, simply run:
-
-```
-$ go get github.com/jawher/mow.cli
-```
-
-## Basics
-
-You start by creating an application by passing a name and a description:
-
-```go
-cp := cli.App("cp", "Copy files around")
-```
-
-To attach the code to execute when the app is launched, assign a function to the Action field:
-
-```go
-cp.Action = func() {
- fmt.Printf("Hello world\n")
-}
-```
-
-If you want you can add support for printing the app version (invoked by ```-v, --version```) like so:
-
-```go
-cp.Version("v version", "cp 1.2.3")
-```
-
-Finally, in your main func, call Run on the app:
-
-```go
-cp.Run(os.Args)
-```
-
-## Options
-
-To add a (global) option, call one of the (String[s]|Int[s]|Bool)Opt methods on the app:
-
-```go
-recursive := cp.BoolOpt("R recursive", false, "recursively copy the src to dst")
-```
-
-* The first argument is a space separated list of names (short and long) for the option without the dashes, e.g `"f force"`. While you can specify multiple short or long names, e.g. `"f x force force-push"`, only the first short name and the first long name will be displayed in the help messages
-* The second parameter is the default value for the option
-* The third and last parameter is the option description, as will be shown in the help messages
-
-There is also a second set of methods Bool, String, Int, Strings and Ints, which accepts a struct describing the option:
-
-```go
-recursive = cp.Bool(cli.BoolOpt{
- Name: "R recursive",
- Value: false,
- Desc: "copy src files recursively",
- EnvVar: "VAR_RECURSIVE",
- SetByUser: &recursiveSetByUser,
-})
-```
-
-`EnvVar` accepts a space separated list of environment variables names to be used to initialize the option.
-
-If `SetByUser` is specified (by passing a pointer to a bool variable), it will be set to `true` if the user explicitly set the option.
-
-The result is a pointer to a value which will be populated after parsing the command line arguments.
-You can access the values in the Action func.
-
-In the command line, mow.cli accepts the following syntaxes
-
-### For boolean options:
-
-
-* `-f` : a single dash for the one letter names
-* `-f=false` : a single dash for the one letter names, equal sign followed by true or false
-* `--force` : double dash for longer option names
-* `-it` : mow.cli supports option folding, this is equivalent to: -i -t
-
-### For string, int options:
-
-
-* `-e=value` : single dash for one letter names, equal sign followed by the value
-* `-e value` : single dash for one letter names, space followed by the value
-* `-Ivalue` : single dash for one letter names immediately followed by the value
-* `--extra=value` : double dash for longer option names, equal sign followed by the value
-* `--extra value` : double dash for longer option names, space followed by the value
-
-### For slice options (StringsOpt, IntsOpt):
-repeat the option to accumulate the values in the resulting slice:
-
-* `-e PATH:/bin -e PATH:/usr/bin` : resulting slice contains `["/bin", "/usr/bin"]`
-* `-ePATH:/bin -ePATH:/usr/bin` : resulting slice contains `["/bin", "/usr/bin"]`
-* `-e=PATH:/bin -e=PATH:/usr/bin` : resulting slice contains `["/bin", "/usr/bin"]`
-* `--env PATH:/bin --env PATH:/usr/bin` : resulting slice contains `["/bin", "/usr/bin"]`
-* `--env=PATH:/bin --env=PATH:/usr/bin` : resulting slice contains `["/bin", "/usr/bin"]`
-
-
-## Arguments
-
-To accept arguments, you need to explicitly declare them by calling one of the (String[s]|Int[s]|Bool)Arg methods on the app:
-
-```go
-src := cp.StringArg("SRC", "", "the file to copy")
-dst := cp.StringArg("DST", "", "the destination")
-```
-
-* The first argument is the argument name as will be shown in the help messages
-* The second parameter is the default value for the argument
-* The third parameter is the argument description, as will be shown in the help messages
-
-
-There is also a second set of methods Bool, String, Int, Strings and Ints, which accepts structs describing the argument:
-
-```go
-src = cp.Strings(cli.StringsArg{
- Name: "SRC",
- Desc: "The source files to copy",
- Value: "default value",
- EnvVar: "VAR1 VAR2",
- SetByUser: &srcSetByUser,
-})
-```
-
-The Value field is where you can set the initial value for the argument.
-
-`EnvVar` accepts a space separated list of environment variables names to be used to initialize the argument.
-
-If `SetByUser` is specified (by passing a pointer to a bool variable), it will be set to `true` only if the user explicitly sets the argument.
-
-The result is a pointer to a value that will be populated after parsing the command line arguments.
-You can access the values in the Action func.
-
-
-## Operators
-
-The `--` operator marks the end of options.
-Everything that follow will be treated as an argument,
-even if starts with a dash.
-
-For example, given the `touch` command which takes a filename as an argument (and possibly other options):
-
-```go
-file := cp.StringArg("FILE", "", "the file to create")
-```
-
-If we try to create a file named `-f` this way:
-
-```
-touch -f
-```
-
-Would fail, because `-f` will be parsed as an option not as an argument.
-The fix is to prefix the filename with the `--` operator:
-
-```
-touch -- -f
-```
-
-## Commands
-
-mow.cli supports nesting commands and sub commands.
-Declare a top level command by calling the Command func on the app struct, and a sub command by calling
-the Command func on the command struct:
-
-```go
-docker := cli.App("docker", "A self-sufficient runtime for linux containers")
-
-docker.Command("run", "Run a command in a new container", func(cmd *cli.Cmd) {
- // initialize the run command here
-})
-```
-
-* The first argument is the command name, as will be shown in the help messages and as will need to be input by the user in the command line to call the command
-* The second argument is the command description as will be shown in the help messages
-* The third argument is a CmdInitializer, a function that receives a pointer to a Cmd struct representing the command.
-In this function, you can add options and arguments by calling the same methods as you would with an app struct (BoolOpt, StringArg, ...).
-You would also assign a function to the Action field of the Cmd struct for it to be executed when the command is invoked.
-
-```go
-docker.Command("run", "Run a command in a new container", func(cmd *cli.Cmd) {
- var (
- detached = cmd.BoolOpt("d detach", false, "Detached mode: run the container in the background and print the new container ID")
- memory = cmd.StringOpt("m memory", "", "Memory limit (format: , where unit = b, k, m or g)")
- image = cmd.StringArg("IMAGE", "", "")
- )
-
- cmd.Action = func() {
- if *detached {
- //do something
- }
- runContainer(*image, *detached, *memory)
- }
-})
-```
-You can also add sub commands by calling Command on the Cmd struct:
-
-```go
-bzk.Command("job", "actions on jobs", func(cmd *cli.Cmd) {
- cmd.Command("list", "list jobs", listJobs)
- cmd.Command("start", "start a new job", startJob)
- cmd.Command("log", "show a job log", nil)
-})
-```
-
-When you just want to set Action to cmd, you can use ActionCommand function for this:
-
-```go
-app.Command("list", "list all configs", cli.ActionCommand(func() { list() }))
-```
-
-is the same as:
-
-```go
-app.Command("list", "list all configs", func(cmd *cli.Cmd)) {
- cmd.Action = func() {
- list()
- }
-}
-```
-
-This could go on to any depth if need be.
-
-mow.cli also supports command aliases. For example:
-
-```go
-app.Command("start run r", "start doing things", cli.ActionCommand(func() { start() }))
-```
-
-will alias `start`, `run`, and `r` to the same action. Aliases also work for
-subcommands:
-
-```go
-app.Command("job j", "actions on jobs", func(cmd *cli.Cmd) {
- cmd.Command("list ls", "list jobs", func(cmd *cli.Cmd) {
- cmd.Action = func() {
- list()
- }
- })
-})
-```
-
-which then allows you to invoke the subcommand as `app job list`, `app job ls`,
-`app j ls`, or `app j list`.
-
-
-As a side-note: it may seem a bit weird the way mow.cli uses a function to initialize a command instead of just returning the command struct.
-
-The motivation behind this choice is scoping: as with the standard flag package, adding an option or an argument returns a pointer to a value which will be populated when the app is run.
-
-Since you'll want to store these pointers in variables, and to avoid having dozens of them in the same scope (the main func for example or as global variables),
-mow.cli's API was specifically tailored to take a func parameter (called CmdInitializer) which accepts the command struct.
-
-This way, the command specific variables scope is limited to this function.
-
-## Custom types
-
-Out of the box, mow.cli supports the following types for options and arguments:
-
-* bool
-* string
-* int
-* strings (slice of strings)
-* ints (slice of ints)
-
-You can however extend mow.cli to handle other types, e.g. `time.Duration`, `float64`, or even your own struct types for example.
-
-To do so, you'll need to:
-
-* implement the `flag.Value` interface for the custom type
-* declare the option or the flag using `VarOpt`, `VarArg` for the short hands, and `Var` for the full form.
-
-Here's an example:
-
-```go
-// Declare your type
-type Duration time.Duration
-
-// Make it implement flag.Value
-func (d *Duration) Set(v string) error {
- parsed, err := time.ParseDuration(v)
- if err != nil {
- return err
- }
- *d = Duration(parsed)
- return nil
-}
-
-func (d *Duration) String() string {
- duration := time.Duration(*d)
- return duration.String()
-}
-
-func main() {
- duration := Duration(0)
-
- app := App("var", "")
-
- app.VarArg("DURATION", &duration, "")
-
- app.Run([]string{"cp", "1h31m42s"})
-}
-```
-
-### Boolean custom types
-
-To make your custom type behave as a boolean option, i.e. doesn't take a value, it has to implement a `IsBoolFlag` method that returns true:
-
-```go
-type BoolLike int
-
-
-func (d *BoolLike) IsBoolFlag() bool {
- return true
-}
-```
-
-### Multi-valued custom type
-
-To make your custom type behave as a multi-valued option or argument, i.e. takes multiple values,
-it has to implement a `Clear` method which will be called whenever the value list needs to be cleared,
-e.g. when the value was initially populated from an environment variable, and then explicitly set from the CLI:
-
-```go
-type Durations []time.Duration
-
-// Make it implement flag.Value
-func (d *Durations) Set(v string) error {
- parsed, err := time.ParseDuration(v)
- if err != nil {
- return err
- }
- *d = append(*d, Duration(parsed))
- return nil
-}
-
-func (d *Durations) String() string {
- return fmt.Sprintf("%v", *d)
-}
-
-
-// Make it multi-valued
-func (d *Durations) Clear() {
- *d = []Duration{}
-}
-```
-
-### Hide default value of custom type
-
-If your custom type implements a `IsDefault` method (returning a boolean), the help message generation will make use of it to decide whether or not to display the default value.
-
-```go
-type Action string
-
-// Make it implement flag.Value
-:
-:
-
-// Make it multi-valued
-func (a *Action) IsDefault() bool {
- return (*a) == "nop"
-}
-```
-
-## Interceptors
-
-It is possible to define snippets of code to be executed before and after a command or any of its sub commands is executed.
-
-For example, given an app with multiple commands but with a global flag which toggles a verbose mode:
-
-```go
-app := cli.App("app", "bla bla")
-
-verbose := app.Bool(cli.BoolOpt{
- Name: "verbose",
- Value: false,
- Desc: "Enable debug logs",
-})
-
-app.Command("command1", "...", func(cmd *cli.Cmd) {
-
-})
-
-app.Command("command2", "...", func(cmd *cli.Cmd) {
-
-})
-```
-
-Instead of repeating yourself by checking if the verbose flag is set or not, and setting the debug level in every command (and its sub-commands),
-a before interceptor can be set on the `app` instead:
-
-```go
-app.Before = func() {
- if (*verbose) {
- logrus.SetLevel(logrus.DebugLevel)
- }
-}
-```
-
-Whenever a valid command is called by the user, all the before interceptors defined on the app and the intermediate commands
-will be called, in order from the root to the leaf.
-
-Similarly, if you need to execute a code snippet after a command has been called, e.g. to cleanup resources allocated in before interceptors,
-simply set the `After` field of the app struct or any other command.
-`After` interceptors will be called, in order from the leaf up to the root (the opposite order of the `Before` interceptors).
-
-Here's a diagram which shows in when and in which order multiple `Before` and `After` interceptors get executed:
-
-![flow](http://i.imgur.com/oUEa8Sh.png)
-
-## Spec
-
-An app or command's call syntax can be customized using spec strings.
-This can be useful to indicate that an argument is optional for example, or that 2 options are mutually exclusive.
-
-You can set a spec string on:
-
-* The app: to configure the syntax for global options and arguments
-* A command: to configure the syntax for that command's options and arguments
-
-In both cases, a spec string is assigned to the Spec field:
-
-```go
-cp := cli.App("cp", "Copy files around")
-cp.Spec = "[-R [-H | -L | -P]]"
-```
-
-And:
-```go
-docker := cli.App("docker", "A self-sufficient runtime for linux containers")
-docker.Command("run", "Run a command in a new container", func(cmd *cli.Cmd) {
- cmd.Spec = "[-d|--rm] IMAGE [COMMAND [ARG...]]"
- :
- :
-}
-```
-
-The spec syntax is mostly based on the conventions used in POSIX command line apps help messages and man pages:
-
-### Options
-
-You can use both short and long option names in spec strings:
-```go
-x.Spec="-f"
-```
-And:
-```go
-x.Spec="--force"
-```
-
-In both cases, we required that the f or force flag be set
-
-Any option you reference in a spec string MUST be explicitly declared, otherwise mow.cli will panic:
-```go
-x.BoolOpt("f force", ...)
-```
-### Arguments
-
-Arguments are all-uppercased words:
-```go
-x.Spec="SRC DST"
-```
-
-This spec string will force the user to pass exactly 2 arguments, SRC and DST
-
-Any argument you reference in a spec string MUST be explicitly declared, otherwise mow.cli will panic:
-
-```go
-x.StringArg("SRC", ...)
-x.StringArg("DST", ...)
-```
-
-### Ordering
-
-Except for options, The order of the elements in a spec string is respected and enforced when parsing the command line arguments:
-
-```go
-x.Spec = "-f -g SRC -h DST"
-```
-
-Consecutive options (`-f` and `-g` for example) get parsed regardless of the order they are specified in (both `-f=5 -g=6` and `-g=6 -f=5` are valid).
-
-Order between options and arguments is significant (`-f` and `-g` must appear before the `SRC` argument).
-
-Same goes for arguments, where `SRC` must appear before `DST`.
-
-### Optionality
-
-You can mark items as optional in a spec string by enclosing them in square brackets :`[...]`
-```go
-x.Spec = "[-x]"
-```
-
-### Choice
-
-You can use the `|` operator to indicate a choice between two or more items
-```go
-x.Spec = "--rm | --daemon"
-x.Spec = "-H | -L | -P"
-x.Spec = "-t | DST"
-```
-
-### Repetition
-
-You can use the `...` postfix operator to mark an element as repeatable:
-
-```go
-x.Spec="SRC..."
-x.Spec="-e..."
-```
-
-### Grouping
-
-You can group items using parenthesis. This is useful in combination with the choice and repetition operators (`|` and `...`):
-
-```go
-x.Spec = "(-e COMMAND)... | (-x|-y)"
-```
-
-The parenthesis in the example above serve to mark that it is the sequence of a -e flag followed by an argument that is repeatable, and that
-all that is mutually exclusive to a choice between -x and -y options.
-
-### Option group
-
-This is a shortcut to declare a choice between multiple options:
-```go
-x.Spec = "-abcd"
-```
-
-Is equivalent to:
-
-```go
-x.Spec = "(-a | -b | -c | -d)..."
-```
-
-I.e. any combination of the listed options in any order, with at least one option.
-
-### All options
-
-Another shortcut:
-
-```go
-x.Spec = "[OPTIONS]"
-```
-
-This is a special syntax (the square brackets are not for marking an optional item, and the uppercased word is not for an argument).
-This is equivalent to a repeatable choice between all the available options.
-For example, if an app or a command declares 4 options a, b, c and d, `[OPTIONS]` is equivalent to:
-
-```go
-x.Spec = "[-a | -b | -c | -d]..."
-```
-
-### Inline option values
-
-You can use the `=` notation right after an option (long or short form) to give an inline description or value.
-
-An example:
-
-```go
-x.Spec = "[ -a= | --timeout= ] ARG"
-```
-
-The inline values are ignored by the spec parser and are just there for the final user as a contextual hint.
-
-### Operators
-
-The `--` operator can be used in a spec string to automatically treat everything following it as an options.
-
-In other words, placing a `--` in the spec string automatically inserts a `--` in the same position in the program call arguments.
-
-This lets you write programs like the `time` utility for example:
-
-```go
-x.Spec = "time -lp [-- CMD [ARG...]]"
-```
-
-## Grammar
-
-Here's the (simplified) EBNF grammar for the Specs language:
-
-```
-spec -> sequence
-sequence -> choice*
-req_sequence -> choice+
-choice -> atom ('|' atom)*
-atom -> (shortOpt | longOpt | optSeq | allOpts | group | optional) rep? | optEnd
-shortOp -> '-' [A-Za-z]
-longOpt -> '--' [A-Za-z][A-Za-z0-9]*
-optSeq -> '-' [A-Za-z]+
-allOpts -> '[OPTIONS]'
-group -> '(' req_sequence ')'
-optional -> '[' req_sequence ']'
-rep -> '...'
-optEnd -> '--'
-```
-And that's it for the spec language.
-You can combine these few building blocks in any way you want (while respecting the grammar above) to construct sophisticated validation constraints
-(don't go too wild though).
-
-Behind the scenes, mow.cli parses the spec string and constructs a finite state machine to be used to parse the command line arguments.
-mow.cli also handles backtracking, and so it can handle tricky cases, or what I like to call "the cp test"
-```
-cp SRC... DST
-```
-
-Without backtracking, this deceptively simple spec string cannot be parsed correctly.
-For instance, docopt can't handle this case, whereas mow.cli does.
-
-## Default spec
-
-By default, and unless a spec string is set by the user, mow.cli auto-generates one for the app and every command using this logic:
-
-* Start with an empty spec string
-* If at least one option was declared, append `[OPTIONS]` to the spec string
-* For every declared argument, append it, in the order of declaration, to the spec string
-
-For example, given this command declaration:
-
-```go
-docker.Command("run", "Run a command in a new container", func(cmd *cli.Cmd) {
- var (
- detached = cmd.BoolOpt("d detach", false, "Detached mode: run the container in the background and print the new container ID", nil)
- memory = cmd.StringOpt("m memory", "", "Memory limit (format: , where unit = b, k, m or g)", nil)
- image = cmd.StringArg("IMAGE", "", "", nil)
- args = cmd.StringsArg("ARG", "", "", nil)
- )
-})
-```
-
-The auto-generated spec string would be:
-```go
-[OPTIONS] IMAGE ARG
-```
-
-Which should suffice for simple cases. If not, the spec string has to be set explicitly.
-
-## Exiting
-
-`mow.cli` provides the `Exit` function which accepts an exit code and exits the app with the provided code.
-
-You are highly encouraged to call `cli.Exit` instead of `os.Exit` for the `After` interceptors to be executed.
-
-## License
-
-This work is published under the MIT license.
-
-Please see the `LICENSE` file for details.
diff --git a/vendor/github.com/jawher/mow.cli/args.go b/vendor/github.com/jawher/mow.cli/args.go
deleted file mode 100644
index 09ea940..0000000
--- a/vendor/github.com/jawher/mow.cli/args.go
+++ /dev/null
@@ -1,224 +0,0 @@
-package cli
-
-import (
- "flag"
- "fmt"
-)
-
-// BoolArg describes a boolean argument
-type BoolArg struct {
- // The argument name as will be shown in help messages
- Name string
- // The argument description as will be shown in help messages
- Desc string
- // A space separated list of environment variables names to be used to initialize this argument
- EnvVar string
- // The argument's inital value
- Value bool
- // A boolean to display or not the current value of the argument in the help message
- HideValue bool
- // Set to true if this arg was set by the user (as opposed to being set from env or not set at all)
- SetByUser *bool
-}
-
-func (a BoolArg) value() bool {
- return a.Value
-}
-
-// StringArg describes a string argument
-type StringArg struct {
- // The argument name as will be shown in help messages
- Name string
- // The argument description as will be shown in help messages
- Desc string
- // A space separated list of environment variables names to be used to initialize this argument
- EnvVar string
- // The argument's initial value
- Value string
- // A boolean to display or not the current value of the argument in the help message
- HideValue bool
- // Set to true if this arg was set by the user (as opposed to being set from env or not set at all)
- SetByUser *bool
-}
-
-func (a StringArg) value() string {
- return a.Value
-}
-
-// IntArg describes an int argument
-type IntArg struct {
- // The argument name as will be shown in help messages
- Name string
- // The argument description as will be shown in help messages
- Desc string
- // A space separated list of environment variables names to be used to initialize this argument
- EnvVar string
- // The argument's initial value
- Value int
- // A boolean to display or not the current value of the argument in the help message
- HideValue bool
- // Set to true if this arg was set by the user (as opposed to being set from env or not set at all)
- SetByUser *bool
-}
-
-func (a IntArg) value() int {
- return a.Value
-}
-
-// StringsArg describes a string slice argument
-type StringsArg struct {
- // The argument name as will be shown in help messages
- Name string
- // The argument description as will be shown in help messages
- Desc string
- // A space separated list of environment variables names to be used to initialize this argument.
- // The env variable should contain a comma separated list of values
- EnvVar string
- // The argument's initial value
- Value []string
- // A boolean to display or not the current value of the argument in the help message
- HideValue bool
- // Set to true if this arg was set by the user (as opposed to being set from env or not set at all)
- SetByUser *bool
-}
-
-func (a StringsArg) value() []string {
- return a.Value
-}
-
-// IntsArg describes an int slice argument
-type IntsArg struct {
- // The argument name as will be shown in help messages
- Name string
- // The argument description as will be shown in help messages
- Desc string
- // A space separated list of environment variables names to be used to initialize this argument.
- // The env variable should contain a comma separated list of values
- EnvVar string
- // The argument's initial value
- Value []int
- // A boolean to display or not the current value of the argument in the help message
- HideValue bool
- // Set to true if this arg was set by the user (as opposed to being set from env or not set at all)
- SetByUser *bool
-}
-
-func (a IntsArg) value() []int {
- return a.Value
-}
-
-// VarArg describes an argument where the type and format of the value is controlled by the developer
-type VarArg struct {
- // A space separated list of the option names *WITHOUT* the dashes, e.g. `f force` and *NOT* `-f --force`.
- // The one letter names will then be called with a single dash (short option), the others with two (long options).
- Name string
- // The option description as will be shown in help messages
- Desc string
- // A space separated list of environment variables names to be used to initialize this option
- EnvVar string
- // A value implementing the flag.Value type (will hold the final value)
- Value flag.Value
- // A boolean to display or not the current value of the option in the help message
- HideValue bool
- // Set to true if this arg was set by the user (as opposed to being set from env or not set at all)
- SetByUser *bool
-}
-
-func (a VarArg) value() flag.Value {
- return a.Value
-}
-
-/*
-BoolArg defines a boolean argument on the command c named `name`, with an initial value of `value` and a description of `desc` which will be used in help messages.
-
-The result should be stored in a variable (a pointer to a bool) which will be populated when the app is run and the call arguments get parsed
-*/
-func (c *Cmd) BoolArg(name string, value bool, desc string) *bool {
- return c.Bool(BoolArg{
- Name: name,
- Value: value,
- Desc: desc,
- })
-}
-
-/*
-StringArg defines a string argument on the command c named `name`, with an initial value of `value` and a description of `desc` which will be used in help messages.
-
-The result should be stored in a variable (a pointer to a string) which will be populated when the app is run and the call arguments get parsed
-*/
-func (c *Cmd) StringArg(name string, value string, desc string) *string {
- return c.String(StringArg{
- Name: name,
- Value: value,
- Desc: desc,
- })
-}
-
-/*
-IntArg defines an int argument on the command c named `name`, with an initial value of `value` and a description of `desc` which will be used in help messages.
-
-The result should be stored in a variable (a pointer to an int) which will be populated when the app is run and the call arguments get parsed
-*/
-func (c *Cmd) IntArg(name string, value int, desc string) *int {
- return c.Int(IntArg{
- Name: name,
- Value: value,
- Desc: desc,
- })
-}
-
-/*
-StringsArg defines a string slice argument on the command c named `name`, with an initial value of `value` and a description of `desc` which will be used in help messages.
-
-The result should be stored in a variable (a pointer to a string slice) which will be populated when the app is run and the call arguments get parsed
-*/
-func (c *Cmd) StringsArg(name string, value []string, desc string) *[]string {
- return c.Strings(StringsArg{
- Name: name,
- Value: value,
- Desc: desc,
- })
-}
-
-/*
-IntsArg defines an int slice argument on the command c named `name`, with an initial value of `value` and a description of `desc` which will be used in help messages.
-
-The result should be stored in a variable (a pointer to an int slice) which will be populated when the app is run and the call arguments get parsed
-*/
-func (c *Cmd) IntsArg(name string, value []int, desc string) *[]int {
- return c.Ints(IntsArg{
- Name: name,
- Value: value,
- Desc: desc,
- })
-}
-
-/*
-VarArg defines an argument where the type and format is controlled by the developer on the command c named `name` and a description of `desc` which will be used in help messages.
-
-The result will be stored in the value parameter (a value implementing the flag.Value interface) which will be populated when the app is run and the call arguments get parsed
-*/
-func (c *Cmd) VarArg(name string, value flag.Value, desc string) {
- c.mkArg(arg{name: name, desc: desc, value: value})
-}
-
-type arg struct {
- name string
- desc string
- envVar string
- hideValue bool
- valueSetFromEnv bool
- valueSetByUser *bool
- value flag.Value
-}
-
-func (a *arg) String() string {
- return fmt.Sprintf("ARG(%s)", a.name)
-}
-
-func (c *Cmd) mkArg(arg arg) {
- arg.valueSetFromEnv = setFromEnv(arg.value, arg.envVar)
-
- c.args = append(c.args, &arg)
- c.argsIdx[arg.name] = &arg
-}
diff --git a/vendor/github.com/jawher/mow.cli/args_test.go b/vendor/github.com/jawher/mow.cli/args_test.go
deleted file mode 100644
index e661b73..0000000
--- a/vendor/github.com/jawher/mow.cli/args_test.go
+++ /dev/null
@@ -1,142 +0,0 @@
-package cli
-
-import (
- "os"
- "strconv"
- "testing"
-
- "github.com/stretchr/testify/require"
-)
-
-func TestStringArg(t *testing.T) {
- cmd := &Cmd{argsIdx: map[string]*arg{}}
- a := cmd.String(StringArg{Name: "a", Value: "test"})
- require.Equal(t, "test", *a)
-
- os.Setenv("B", "")
- b := cmd.String(StringArg{Name: "b", Value: "test", EnvVar: "B"})
- require.Equal(t, "test", *b)
-
- os.Setenv("B", "mow")
- b = cmd.String(StringArg{Name: "b", Value: "test", EnvVar: "B"})
- require.Equal(t, "mow", *b)
-
- os.Setenv("B", "")
- os.Setenv("C", "cli")
- os.Setenv("D", "mow")
- b = cmd.String(StringArg{Name: "b", Value: "test", EnvVar: "B C D"})
- require.Equal(t, "cli", *b)
-}
-
-func TestBoolArg(t *testing.T) {
- cmd := &Cmd{argsIdx: map[string]*arg{}}
- a := cmd.Bool(BoolArg{Name: "a", Value: true, Desc: ""})
- require.True(t, *a)
-
- os.Setenv("B", "")
- b := cmd.Bool(BoolArg{Name: "b", Value: false, EnvVar: "B", Desc: ""})
- require.False(t, *b)
-
- trueValues := []string{"1", "true", "TRUE"}
- for _, tv := range trueValues {
- os.Setenv("B", tv)
- b = cmd.Bool(BoolArg{Name: "b", Value: false, EnvVar: "B", Desc: ""})
- require.True(t, *b, "env=%s", tv)
- }
-
- falseValues := []string{"0", "false", "FALSE", "xyz"}
- for _, tv := range falseValues {
- os.Setenv("B", tv)
- b = cmd.Bool(BoolArg{Name: "b", Value: false, EnvVar: "B", Desc: ""})
- require.False(t, *b, "env=%s", tv)
- }
-
- os.Setenv("B", "")
- os.Setenv("C", "false")
- os.Setenv("D", "true")
- b = cmd.Bool(BoolArg{Name: "b", Value: true, EnvVar: "B C D", Desc: ""})
- require.False(t, *b)
-}
-
-func TestIntArg(t *testing.T) {
- cmd := &Cmd{argsIdx: map[string]*arg{}}
- a := cmd.Int(IntArg{Name: "a", Value: -1, Desc: ""})
- require.Equal(t, -1, *a)
-
- os.Setenv("B", "")
- b := cmd.Int(IntArg{Name: "b", Value: -1, EnvVar: "B", Desc: ""})
- require.Equal(t, -1, *b)
-
- goodValues := []int{1, 0, 33}
- for _, tv := range goodValues {
- os.Setenv("B", strconv.Itoa(tv))
- b := cmd.Int(IntArg{Name: "b", Value: -1, EnvVar: "B", Desc: ""})
- require.Equal(t, tv, *b, "env=%s", tv)
- }
-
- badValues := []string{"", "b", "q1", "_"}
- for _, tv := range badValues {
- os.Setenv("B", tv)
- b := cmd.Int(IntArg{Name: "b", Value: -1, EnvVar: "B", Desc: ""})
- require.Equal(t, -1, *b, "env=%s", tv)
- }
-
- os.Setenv("B", "")
- os.Setenv("C", "42")
- os.Setenv("D", "666")
- b = cmd.Int(IntArg{Name: "b", Value: -1, EnvVar: "B C D", Desc: ""})
- require.Equal(t, 42, *b)
-}
-
-func TestStringsArg(t *testing.T) {
- cmd := &Cmd{argsIdx: map[string]*arg{}}
- v := []string{"test"}
- a := cmd.Strings(StringsArg{Name: "a", Value: v, Desc: ""})
- require.Equal(t, v, *a)
-
- os.Setenv("B", "")
- b := cmd.Strings(StringsArg{Name: "b", Value: v, EnvVar: "B", Desc: ""})
- require.Equal(t, v, *b)
-
- os.Setenv("B", "mow")
- b = cmd.Strings(StringsArg{Name: "b", Value: nil, EnvVar: "B", Desc: ""})
- require.Equal(t, []string{"mow"}, *b)
-
- os.Setenv("B", "mow, cli")
- b = cmd.Strings(StringsArg{Name: "b", Value: nil, EnvVar: "B", Desc: ""})
- require.Equal(t, []string{"mow", "cli"}, *b)
-
- os.Setenv("B", "")
- os.Setenv("C", "test")
- os.Setenv("D", "xxx")
- b = cmd.Strings(StringsArg{Name: "b", Value: nil, EnvVar: "B C D", Desc: ""})
- require.Equal(t, v, *b)
-}
-
-func TestIntsArg(t *testing.T) {
- cmd := &Cmd{argsIdx: map[string]*arg{}}
-
- vi := []int{42}
- a := cmd.Ints(IntsArg{Name: "a", Value: vi, Desc: ""})
- require.Equal(t, vi, *a)
-
- os.Setenv("B", "")
- b := cmd.Ints(IntsArg{Name: "b", Value: vi, EnvVar: "B", Desc: ""})
- require.Equal(t, vi, *b)
-
- os.Setenv("B", "666")
- b = cmd.Ints(IntsArg{Name: "b", Value: nil, EnvVar: "B", Desc: ""})
- require.Equal(t, []int{666}, *b)
-
- os.Setenv("B", "1, 2 , 3")
- b = cmd.Ints(IntsArg{Name: "b", Value: nil, EnvVar: "B", Desc: ""})
- require.Equal(t, []int{1, 2, 3}, *b)
-
- os.Setenv("B", "")
- os.Setenv("C", "abc")
- os.Setenv("D", "1, abc")
- os.Setenv("E", "42")
- os.Setenv("F", "666")
- b = cmd.Ints(IntsArg{Name: "b", Value: nil, EnvVar: "B C D E F", Desc: ""})
- require.Equal(t, vi, *b)
-}
diff --git a/vendor/github.com/jawher/mow.cli/cli.go b/vendor/github.com/jawher/mow.cli/cli.go
deleted file mode 100644
index 6b9ea76..0000000
--- a/vendor/github.com/jawher/mow.cli/cli.go
+++ /dev/null
@@ -1,133 +0,0 @@
-package cli
-
-import (
- "flag"
- "fmt"
- "io"
- "os"
-)
-
-/*
-Cli represents the structure of a CLI app. It should be constructed using the App() function
-*/
-type Cli struct {
- *Cmd
- version *cliVersion
-}
-
-type cliVersion struct {
- version string
- option *opt
-}
-
-/*
-App creates a new and empty CLI app configured with the passed name and description.
-
-name and description will be used to construct the help message for the app:
-
- Usage: $name [OPTIONS] COMMAND [arg...]
-
- $desc
-
-*/
-func App(name, desc string) *Cli {
- return &Cli{
- Cmd: &Cmd{
- name: name,
- desc: desc,
- optionsIdx: map[string]*opt{},
- argsIdx: map[string]*arg{},
- ErrorHandling: flag.ExitOnError,
- },
- }
-}
-
-/*
-Version sets the version string of the CLI app together with the options that can be used to trigger
-printing the version string via the CLI.
-
- Usage: appName --$name
- $version
-
-*/
-func (cli *Cli) Version(name, version string) {
- cli.Bool(BoolOpt{
- Name: name,
- Value: false,
- Desc: "Show the version and exit",
- HideValue: true,
- })
- names := mkOptStrs(name)
- option := cli.optionsIdx[names[0]]
- cli.version = &cliVersion{version, option}
-}
-
-func (cli *Cli) parse(args []string, entry, inFlow, outFlow *step) error {
- // We overload Cmd.parse() and handle cases that only apply to the CLI command, like versioning
- // After that, we just call Cmd.parse() for the default behavior
- if cli.versionSetAndRequested(args) {
- cli.PrintVersion()
- cli.onError(errVersionRequested)
- return nil
- }
- return cli.Cmd.parse(args, entry, inFlow, outFlow)
-}
-
-func (cli *Cli) versionSetAndRequested(args []string) bool {
- return cli.version != nil && cli.isFlagSet(args, cli.version.option.names)
-}
-
-/*
-PrintVersion prints the CLI app's version.
-In most cases the library users won't need to call this method, unless
-a more complex validation is needed.
-*/
-func (cli *Cli) PrintVersion() {
- fmt.Fprintln(stdErr, cli.version.version)
-}
-
-/*
-Run uses the app configuration (specs, commands, ...) to parse the args slice
-and to execute the matching command.
-
-In case of an incorrect usage, and depending on the configured ErrorHandling policy,
-it may return an error, panic or exit
-*/
-func (cli *Cli) Run(args []string) error {
- if err := cli.doInit(); err != nil {
- panic(err)
- }
- inFlow := &step{desc: "RootIn"}
- outFlow := &step{desc: "RootOut"}
- return cli.parse(args[1:], inFlow, inFlow, outFlow)
-}
-
-/*
-ActionCommand is a convenience function to configure a command with an action.
-
-cmd.ActionCommand(_, _, myFun } is equivalent to cmd.Command(_, _, func(cmd *cli.Cmd) { cmd.Action = myFun })
-*/
-func ActionCommand(action func()) CmdInitializer {
- return func(cmd *Cmd) {
- cmd.Action = action
- }
-}
-
-/*
-Exit causes the app the exit with the specified exit code while giving the After interceptors a chance to run.
-This should be used instead of os.Exit.
-*/
-func Exit(code int) {
- panic(exit(code))
-}
-
-type exit int
-
-var exiter = func(code int) {
- os.Exit(code)
-}
-
-var (
- stdOut io.Writer = os.Stdout
- stdErr io.Writer = os.Stderr
-)
diff --git a/vendor/github.com/jawher/mow.cli/cli_test.go b/vendor/github.com/jawher/mow.cli/cli_test.go
deleted file mode 100644
index 9ba1928..0000000
--- a/vendor/github.com/jawher/mow.cli/cli_test.go
+++ /dev/null
@@ -1,1106 +0,0 @@
-package cli
-
-import (
- "flag"
-
- "github.com/stretchr/testify/require"
-
- "io/ioutil"
- "os"
- "testing"
-)
-
-func TestTheCpCase(t *testing.T) {
- app := App("cp", "")
- app.Spec = "SRC... DST"
-
- src := app.Strings(StringsArg{Name: "SRC", Value: nil, Desc: ""})
- dst := app.String(StringArg{Name: "DST", Value: "", Desc: ""})
-
- ex := false
- app.Action = func() {
- ex = true
- }
- app.Run([]string{"cp", "x", "y", "z"})
-
- require.Equal(t, []string{"x", "y"}, *src)
- require.Equal(t, "z", *dst)
-
- require.True(t, ex, "Exec wasn't called")
-}
-
-func TestImplicitSpec(t *testing.T) {
- app := App("test", "")
- x := app.Bool(BoolOpt{Name: "x", Value: false, Desc: ""})
- y := app.String(StringOpt{Name: "y", Value: "", Desc: ""})
- called := false
- app.Action = func() {
- called = true
- }
- app.ErrorHandling = flag.ContinueOnError
-
- err := app.Run([]string{"test", "-x", "-y", "hello"})
-
- require.Nil(t, err)
- require.True(t, *x)
- require.Equal(t, "hello", *y)
-
- require.True(t, called, "Exec wasn't called")
-}
-
-func TestAppWithBoolOption(t *testing.T) {
-
- cases := []struct {
- args []string
- expectedOptValue bool
- }{
- {[]string{"app"}, false},
- {[]string{"app", "-o"}, true},
- {[]string{"app", "-o=true"}, true},
- {[]string{"app", "-o=false"}, false},
-
- {[]string{"app", "--option"}, true},
- {[]string{"app", "--option=true"}, true},
- {[]string{"app", "--option=false"}, false},
- }
-
- for _, cas := range cases {
- t.Logf("Testing %#v", cas.args)
-
- app := App("app", "")
- app.ErrorHandling = flag.ContinueOnError
- opt := app.BoolOpt("o option", false, "")
-
- ex := false
- app.Action = func() {
- ex = true
- require.Equal(t, cas.expectedOptValue, *opt)
- }
- err := app.Run(cas.args)
-
- require.NoError(t, err)
- require.True(t, ex, "Exec wasn't called")
- }
-}
-
-func TestAppWithStringOption(t *testing.T) {
-
- cases := []struct {
- args []string
- expectedOptValue string
- }{
- {[]string{"app"}, "default"},
- {[]string{"app", "-o", "user"}, "user"},
- {[]string{"app", "-o=user"}, "user"},
-
- {[]string{"app", "--option", "user"}, "user"},
- {[]string{"app", "--option=user"}, "user"},
- }
-
- for _, cas := range cases {
- t.Logf("Testing %#v", cas.args)
-
- app := App("app", "")
- app.ErrorHandling = flag.ContinueOnError
- opt := app.StringOpt("o option", "default", "")
-
- ex := false
- app.Action = func() {
- ex = true
- require.Equal(t, cas.expectedOptValue, *opt)
- }
- err := app.Run(cas.args)
-
- require.NoError(t, err)
- require.True(t, ex, "Exec wasn't called")
- }
-}
-
-func TestAppWithIntOption(t *testing.T) {
-
- cases := []struct {
- args []string
- expectedOptValue int
- }{
- {[]string{"app"}, 3},
- {[]string{"app", "-o", "16"}, 16},
- {[]string{"app", "-o=16"}, 16},
-
- {[]string{"app", "--option", "16"}, 16},
- {[]string{"app", "--option=16"}, 16},
- }
-
- for _, cas := range cases {
- t.Logf("Testing %#v", cas.args)
-
- app := App("app", "")
- app.ErrorHandling = flag.ContinueOnError
- opt := app.IntOpt("o option", 3, "")
-
- ex := false
- app.Action = func() {
- ex = true
- require.Equal(t, cas.expectedOptValue, *opt)
- }
- err := app.Run(cas.args)
-
- require.NoError(t, err)
- require.True(t, ex, "Exec wasn't called")
- }
-}
-
-func TestAppWithStringsOption(t *testing.T) {
-
- cases := []struct {
- args []string
- expectedOptValue []string
- }{
- {[]string{"app"}, []string{"a", "b"}},
- {[]string{"app", "-o", "x"}, []string{"x"}},
- {[]string{"app", "-o", "x", "-o=y"}, []string{"x", "y"}},
-
- {[]string{"app", "--option", "x"}, []string{"x"}},
- {[]string{"app", "--option", "x", "--option=y"}, []string{"x", "y"}},
- }
-
- for _, cas := range cases {
- t.Logf("Testing %#v", cas.args)
-
- app := App("app", "")
- app.ErrorHandling = flag.ContinueOnError
- opt := app.StringsOpt("o option", []string{"a", "b"}, "")
-
- ex := false
- app.Action = func() {
- ex = true
- require.Equal(t, cas.expectedOptValue, *opt)
- }
- err := app.Run(cas.args)
-
- require.NoError(t, err)
- require.True(t, ex, "Exec wasn't called")
- }
-}
-
-func TestAppWithIntsOption(t *testing.T) {
-
- cases := []struct {
- args []string
- expectedOptValue []int
- }{
- {[]string{"app"}, []int{1, 2}},
- {[]string{"app", "-o", "10"}, []int{10}},
- {[]string{"app", "-o", "10", "-o=11"}, []int{10, 11}},
-
- {[]string{"app", "--option", "10"}, []int{10}},
- {[]string{"app", "--option", "10", "--option=11"}, []int{10, 11}},
- }
-
- for _, cas := range cases {
- t.Logf("Testing %#v", cas.args)
-
- app := App("app", "")
- app.ErrorHandling = flag.ContinueOnError
- opt := app.IntsOpt("o option", []int{1, 2}, "")
-
- ex := false
- app.Action = func() {
- ex = true
- require.Equal(t, cas.expectedOptValue, *opt)
- }
- err := app.Run(cas.args)
-
- require.NoError(t, err)
- require.True(t, ex, "Exec wasn't called")
- }
-}
-
-func TestAppWithBoolArg(t *testing.T) {
-
- cases := []struct {
- args []string
- expectedOptValue bool
- }{
- {[]string{"app"}, false},
- {[]string{"app", "true"}, true},
- {[]string{"app", "false"}, false},
- }
-
- for _, cas := range cases {
- t.Logf("Testing %#v", cas.args)
-
- app := App("app", "")
- app.Spec = "[ARG]"
- app.ErrorHandling = flag.ContinueOnError
- opt := app.BoolArg("ARG", false, "")
-
- ex := false
- app.Action = func() {
- ex = true
- require.Equal(t, cas.expectedOptValue, *opt)
- }
- err := app.Run(cas.args)
-
- require.NoError(t, err)
- require.True(t, ex, "Exec wasn't called")
- }
-}
-
-func TestAppWithStringArg(t *testing.T) {
-
- cases := []struct {
- args []string
- expectedOptValue string
- }{
- {[]string{"app"}, "default"},
- {[]string{"app", "user"}, "user"},
- }
-
- for _, cas := range cases {
- t.Logf("Testing %#v", cas.args)
-
- app := App("app", "")
- app.Spec = "[ARG]"
- app.ErrorHandling = flag.ContinueOnError
- opt := app.StringArg("ARG", "default", "")
-
- ex := false
- app.Action = func() {
- ex = true
- require.Equal(t, cas.expectedOptValue, *opt)
- }
- err := app.Run(cas.args)
-
- require.NoError(t, err)
- require.True(t, ex, "Exec wasn't called")
- }
-}
-
-func TestAppWithIntArg(t *testing.T) {
-
- cases := []struct {
- args []string
- expectedOptValue int
- }{
- {[]string{"app"}, 3},
- {[]string{"app", "16"}, 16},
- }
-
- for _, cas := range cases {
- t.Logf("Testing %#v", cas.args)
-
- app := App("app", "")
- app.Spec = "[ARG]"
- app.ErrorHandling = flag.ContinueOnError
- opt := app.IntArg("ARG", 3, "")
-
- ex := false
- app.Action = func() {
- ex = true
- require.Equal(t, cas.expectedOptValue, *opt)
- }
- err := app.Run(cas.args)
-
- require.NoError(t, err)
- require.True(t, ex, "Exec wasn't called")
- }
-}
-
-func TestAppWithStringsArg(t *testing.T) {
-
- cases := []struct {
- args []string
- expectedOptValue []string
- }{
- {[]string{"app"}, []string{"a", "b"}},
- {[]string{"app", "x"}, []string{"x"}},
- {[]string{"app", "x", "y"}, []string{"x", "y"}},
- }
-
- for _, cas := range cases {
- t.Logf("Testing %#v", cas.args)
-
- app := App("app", "")
- app.Spec = "[ARG...]"
- app.ErrorHandling = flag.ContinueOnError
- opt := app.StringsArg("ARG", []string{"a", "b"}, "")
-
- ex := false
- app.Action = func() {
- ex = true
- require.Equal(t, cas.expectedOptValue, *opt)
- }
- err := app.Run(cas.args)
-
- require.NoError(t, err)
- require.True(t, ex, "Exec wasn't called")
- }
-}
-
-func TestAppWithIntsArg(t *testing.T) {
-
- cases := []struct {
- args []string
- expectedOptValue []int
- }{
- {[]string{"app"}, []int{1, 2}},
- {[]string{"app", "10"}, []int{10}},
- {[]string{"app", "10", "11"}, []int{10, 11}},
- }
-
- for _, cas := range cases {
- t.Logf("Testing %#v", cas.args)
-
- app := App("app", "")
- app.Spec = "[ARG...]"
- app.ErrorHandling = flag.ContinueOnError
- opt := app.IntsArg("ARG", []int{1, 2}, "")
-
- ex := false
- app.Action = func() {
- ex = true
- require.Equal(t, cas.expectedOptValue, *opt)
- }
- err := app.Run(cas.args)
-
- require.NoError(t, err)
- require.True(t, ex, "Exec wasn't called")
- }
-}
-
-func testHelpAndVersionWithOptionsEnd(flag string, t *testing.T) {
- t.Logf("Testing help/version with --: flag=%q", flag)
- defer suppressOutput()()
-
- exitCalled := false
- defer exitShouldBeCalledWith(t, 0, &exitCalled)()
-
- app := App("x", "")
- app.Version("v version", "1.0")
- app.Spec = "CMD"
-
- cmd := app.String(StringArg{Name: "CMD", Value: "", Desc: ""})
-
- actionCalled := false
- app.Action = func() {
- actionCalled = true
- require.Equal(t, flag, *cmd)
- }
-
- app.Run([]string{"x", "--", flag})
-
- require.True(t, actionCalled, "action should have been called")
- require.False(t, exitCalled, "exit should not have been called")
-
-}
-
-func TestHelpAndVersionWithOptionsEnd(t *testing.T) {
- for _, flag := range []string{"-h", "--help", "-v", "--version"} {
- testHelpAndVersionWithOptionsEnd(flag, t)
- }
-}
-
-var genGolden = flag.Bool("g", false, "Generate golden file(s)")
-
-func TestHelpMessage(t *testing.T) {
- var out, err string
- defer captureAndRestoreOutput(&out, &err)()
-
- exitCalled := false
- defer exitShouldBeCalledWith(t, 0, &exitCalled)()
-
- app := App("app", "App Desc")
- app.Spec = "[-bdsuikqs] BOOL1 [STR1] INT3..."
-
- // Options
- app.Bool(BoolOpt{Name: "b bool1 u uuu", Value: false, EnvVar: "BOOL1", Desc: "Bool Option 1"})
- app.Bool(BoolOpt{Name: "bool2", Value: true, EnvVar: " ", Desc: "Bool Option 2"})
- app.Bool(BoolOpt{Name: "d", Value: true, EnvVar: "BOOL3", Desc: "Bool Option 3", HideValue: true})
-
- app.String(StringOpt{Name: "s str1", Value: "", EnvVar: "STR1", Desc: "String Option 1"})
- app.String(StringOpt{Name: "str2", Value: "a value", Desc: "String Option 2"})
- app.String(StringOpt{Name: "u", Value: "another value", EnvVar: "STR3", Desc: "String Option 3", HideValue: true})
-
- app.Int(IntOpt{Name: "i int1", Value: 0, EnvVar: "INT1 ALIAS_INT1"})
- app.Int(IntOpt{Name: "int2", Value: 1, EnvVar: "INT2", Desc: "Int Option 2"})
- app.Int(IntOpt{Name: "k", Value: 1, EnvVar: "INT3", Desc: "Int Option 3", HideValue: true})
-
- app.Strings(StringsOpt{Name: "x strs1", Value: nil, EnvVar: "STRS1", Desc: "Strings Option 1"})
- app.Strings(StringsOpt{Name: "strs2", Value: []string{"value1", "value2"}, EnvVar: "STRS2", Desc: "Strings Option 2"})
- app.Strings(StringsOpt{Name: "z", Value: []string{"another value"}, EnvVar: "STRS3", Desc: "Strings Option 3", HideValue: true})
-
- app.Ints(IntsOpt{Name: "q ints1", Value: nil, EnvVar: "INTS1", Desc: "Ints Option 1"})
- app.Ints(IntsOpt{Name: "ints2", Value: []int{1, 2, 3}, EnvVar: "INTS2", Desc: "Ints Option 2"})
- app.Ints(IntsOpt{Name: "s", Value: []int{1}, EnvVar: "INTS3", Desc: "Ints Option 3", HideValue: true})
-
- // Args
- app.Bool(BoolArg{Name: "BOOL1", Value: false, EnvVar: "BOOL1", Desc: "Bool Argument 1"})
- app.Bool(BoolArg{Name: "BOOL2", Value: true, Desc: "Bool Argument 2"})
- app.Bool(BoolArg{Name: "BOOL3", Value: true, EnvVar: "BOOL3", Desc: "Bool Argument 3", HideValue: true})
-
- app.String(StringArg{Name: "STR1", Value: "", EnvVar: "STR1", Desc: "String Argument 1"})
- app.String(StringArg{Name: "STR2", Value: "a value", EnvVar: "STR2", Desc: "String Argument 2"})
- app.String(StringArg{Name: "STR3", Value: "another value", EnvVar: "STR3", Desc: "String Argument 3", HideValue: true})
-
- app.Int(IntArg{Name: "INT1", Value: 0, EnvVar: "INT1", Desc: "Int Argument 1"})
- app.Int(IntArg{Name: "INT2", Value: 1, EnvVar: "INT2", Desc: "Int Argument 2"})
- app.Int(IntArg{Name: "INT3", Value: 1, EnvVar: "INT3", Desc: "Int Argument 3", HideValue: true})
-
- app.Strings(StringsArg{Name: "STRS1", Value: nil, EnvVar: "STRS1", Desc: "Strings Argument 1"})
- app.Strings(StringsArg{Name: "STRS2", Value: []string{"value1", "value2"}, EnvVar: "STRS2"})
- app.Strings(StringsArg{Name: "STRS3", Value: []string{"another value"}, EnvVar: "STRS3", Desc: "Strings Argument 3", HideValue: true})
-
- app.Ints(IntsArg{Name: "INTS1", Value: nil, EnvVar: "INTS1", Desc: "Ints Argument 1"})
- app.Ints(IntsArg{Name: "INTS2", Value: []int{1, 2, 3}, EnvVar: "INTS2", Desc: "Ints Argument 2"})
- app.Ints(IntsArg{Name: "INTS3", Value: []int{1}, EnvVar: "INTS3", Desc: "Ints Argument 3", HideValue: true})
-
- app.Action = func() {}
-
- app.Command("command1", "command1 description", func(cmd *Cmd) {})
- app.Command("command2", "command2 description", func(cmd *Cmd) {})
- app.Command("command3", "command3 description", func(cmd *Cmd) {})
-
- app.Run([]string{"app", "-h"})
-
- if *genGolden {
- ioutil.WriteFile("testdata/help-output.txt.golden", []byte(err), 0644)
- }
-
- expected, e := ioutil.ReadFile("testdata/help-output.txt")
- require.NoError(t, e, "Failed to read the expected help output from testdata/help-output.txt")
-
- require.Equal(t, expected, []byte(err))
-}
-
-func TestLongHelpMessage(t *testing.T) {
- var out, err string
- defer captureAndRestoreOutput(&out, &err)()
-
- exitCalled := false
- defer exitShouldBeCalledWith(t, 0, &exitCalled)()
-
- app := App("app", "App Desc")
- app.LongDesc = "Longer App Desc"
- app.Spec = "[-o] ARG"
-
- app.String(StringOpt{Name: "o opt", Value: "", Desc: "Option"})
- app.String(StringArg{Name: "ARG", Value: "", Desc: "Argument"})
-
- app.Action = func() {}
- app.Run([]string{"app", "-h"})
-
- if *genGolden {
- ioutil.WriteFile("testdata/long-help-output.txt.golden", []byte(err), 0644)
- }
-
- expected, e := ioutil.ReadFile("testdata/long-help-output.txt")
- require.NoError(t, e, "Failed to read the expected help output from testdata/long-help-output.txt")
-
- require.Equal(t, expected, []byte(err))
-}
-
-func TestVersionShortcut(t *testing.T) {
- defer suppressOutput()()
- exitCalled := false
- defer exitShouldBeCalledWith(t, 0, &exitCalled)()
-
- app := App("cp", "")
- app.Version("v version", "cp 1.2.3")
-
- actionCalled := false
- app.Action = func() {
- actionCalled = true
- }
-
- app.Run([]string{"cp", "--version"})
-
- require.False(t, actionCalled, "action should not have been called")
- require.True(t, exitCalled, "exit should have been called")
-}
-
-func TestSubCommands(t *testing.T) {
- app := App("say", "")
-
- hi, bye := false, false
-
- app.Command("hi", "", func(cmd *Cmd) {
- cmd.Action = func() {
- hi = true
- }
- })
-
- app.Command("byte", "", func(cmd *Cmd) {
- cmd.Action = func() {
- bye = true
- }
- })
-
- app.Run([]string{"say", "hi"})
- require.True(t, hi, "hi should have been called")
- require.False(t, bye, "byte should NOT have been called")
-}
-
-func TestContinueOnError(t *testing.T) {
- defer exitShouldNotCalled(t)()
- defer suppressOutput()()
-
- app := App("say", "")
- app.String(StringOpt{Name: "f", Value: "", Desc: ""})
- app.Spec = "-f"
- app.ErrorHandling = flag.ContinueOnError
- called := false
- app.Action = func() {
- called = true
- }
-
- err := app.Run([]string{"say"})
- require.NotNil(t, err)
- require.False(t, called, "Exec should NOT have been called")
-}
-
-func TestContinueOnErrorWithHelpAndVersion(t *testing.T) {
- defer exitShouldNotCalled(t)()
- defer suppressOutput()()
-
- app := App("say", "")
- app.Version("v", "1.0")
- app.String(StringOpt{Name: "f", Value: "", Desc: ""})
- app.Spec = "-f"
- app.ErrorHandling = flag.ContinueOnError
- called := false
- app.Action = func() {
- called = true
- }
-
- {
- err := app.Run([]string{"say", "-h"})
- require.Nil(t, err)
- require.False(t, called, "Exec should NOT have been called")
- }
-
- {
- err := app.Run([]string{"say", "-v"})
- require.Nil(t, err)
- require.False(t, called, "Exec should NOT have been called")
- }
-
-}
-
-func TestExitOnError(t *testing.T) {
- defer suppressOutput()()
-
- exitCalled := false
- defer exitShouldBeCalledWith(t, 2, &exitCalled)()
-
- app := App("x", "")
- app.ErrorHandling = flag.ExitOnError
- app.Spec = "Y"
-
- app.String(StringArg{Name: "Y", Value: "", Desc: ""})
-
- app.Run([]string{"x", "y", "z"})
- require.True(t, exitCalled, "exit should have been called")
-}
-
-func TestExitOnErrorWithHelp(t *testing.T) {
- defer suppressOutput()()
-
- exitCalled := false
- defer exitShouldBeCalledWith(t, 0, &exitCalled)()
-
- app := App("x", "")
- app.Spec = "Y"
- app.ErrorHandling = flag.ExitOnError
-
- app.String(StringArg{Name: "Y", Value: "", Desc: ""})
-
- app.Run([]string{"x", "-h"})
- require.True(t, exitCalled, "exit should have been called")
-}
-
-func TestExitOnErrorWithVersion(t *testing.T) {
- defer suppressOutput()()
-
- exitCalled := false
- defer exitShouldBeCalledWith(t, 0, &exitCalled)()
-
- app := App("x", "")
- app.Version("v", "1.0")
- app.Spec = "Y"
- app.ErrorHandling = flag.ExitOnError
-
- app.String(StringArg{Name: "Y", Value: "", Desc: ""})
-
- app.Run([]string{"x", "-v"})
- require.True(t, exitCalled, "exit should have been called")
-}
-
-func TestPanicOnError(t *testing.T) {
- defer suppressOutput()()
-
- app := App("say", "")
- app.String(StringOpt{Name: "f", Value: "", Desc: ""})
- app.Spec = "-f"
- app.ErrorHandling = flag.PanicOnError
- called := false
- app.Action = func() {
- called = true
- }
-
- defer func() {
- if r := recover(); r != nil {
- require.False(t, called, "Exec should NOT have been called")
- } else {
-
- }
- }()
- app.Run([]string{"say"})
- t.Fatalf("wanted panic")
-}
-
-func TestOptSetByUser(t *testing.T) {
- cases := []struct {
- desc string
- config func(*Cli, *bool)
- args []string
- expected bool
- }{
- // OPTS
- // String
- {
- desc: "String Opt, not set by user, default value",
- config: func(c *Cli, s *bool) {
- c.String(StringOpt{Name: "f", Value: "a", SetByUser: s})
- },
- args: []string{"test"},
- expected: false,
- },
- {
- desc: "String Opt, not set by user, env value",
- config: func(c *Cli, s *bool) {
- os.Setenv("MOW_VALUE", "value")
- c.String(StringOpt{Name: "f", EnvVar: "MOW_VALUE", SetByUser: s})
- },
- args: []string{"test"},
- expected: false,
- },
- {
- desc: "String Opt, set by user",
- config: func(c *Cli, s *bool) {
- c.String(StringOpt{Name: "f", Value: "a", SetByUser: s})
- },
- args: []string{"test", "-f=hello"},
- expected: true,
- },
-
- // Bool
- {
- desc: "Bool Opt, not set by user, default value",
- config: func(c *Cli, s *bool) {
- c.Bool(BoolOpt{Name: "f", Value: true, SetByUser: s})
- },
- args: []string{"test"},
- expected: false,
- },
- {
- desc: "Bool Opt, not set by user, env value",
- config: func(c *Cli, s *bool) {
- os.Setenv("MOW_VALUE", "true")
- c.Bool(BoolOpt{Name: "f", EnvVar: "MOW_VALUE", SetByUser: s})
- },
- args: []string{"test"},
- expected: false,
- },
- {
- desc: "Bool Opt, set by user",
- config: func(c *Cli, s *bool) {
- c.Bool(BoolOpt{Name: "f", SetByUser: s})
- },
- args: []string{"test", "-f"},
- expected: true,
- },
-
- // Int
- {
- desc: "Int Opt, not set by user, default value",
- config: func(c *Cli, s *bool) {
- c.Int(IntOpt{Name: "f", Value: 42, SetByUser: s})
- },
- args: []string{"test"},
- expected: false,
- },
- {
- desc: "Int Opt, not set by user, env value",
- config: func(c *Cli, s *bool) {
- os.Setenv("MOW_VALUE", "33")
- c.Int(IntOpt{Name: "f", EnvVar: "MOW_VALUE", SetByUser: s})
- },
- args: []string{"test"},
- expected: false,
- },
- {
- desc: "Int Opt, set by user",
- config: func(c *Cli, s *bool) {
- c.Int(IntOpt{Name: "f", SetByUser: s})
- },
- args: []string{"test", "-f=666"},
- expected: true,
- },
-
- // Ints
- {
- desc: "Ints Opt, not set by user, default value",
- config: func(c *Cli, s *bool) {
- c.Ints(IntsOpt{Name: "f", Value: []int{42}, SetByUser: s})
- },
- args: []string{"test"},
- expected: false,
- },
- {
- desc: "Ints Opt, not set by user, env value",
- config: func(c *Cli, s *bool) {
- os.Setenv("MOW_VALUE", "11,22,33")
- c.Ints(IntsOpt{Name: "f", EnvVar: "MOW_VALUE", SetByUser: s})
- },
- args: []string{"test"},
- expected: false,
- },
- {
- desc: "Ints Opt, set by user",
- config: func(c *Cli, s *bool) {
- c.Ints(IntsOpt{Name: "f", SetByUser: s})
- },
- args: []string{"test", "-f=666"},
- expected: true,
- },
-
- // Strings
- {
- desc: "Strings Opt, not set by user, default value",
- config: func(c *Cli, s *bool) {
- c.Strings(StringsOpt{Name: "f", Value: []string{"aaa"}, SetByUser: s})
- },
- args: []string{"test"},
- expected: false,
- },
- {
- desc: "Strings Opt, not set by user, env value",
- config: func(c *Cli, s *bool) {
- os.Setenv("MOW_VALUE", "a,b,c")
- c.Strings(StringsOpt{Name: "f", EnvVar: "MOW_VALUE", SetByUser: s})
- },
- args: []string{"test"},
- expected: false,
- },
- {
- desc: "Strings Opt, set by user",
- config: func(c *Cli, s *bool) {
- c.Strings(StringsOpt{Name: "f", SetByUser: s})
- },
- args: []string{"test", "-f=ccc"},
- expected: true,
- },
- }
-
- for _, cas := range cases {
- t.Log(cas.desc)
-
- setByUser := false
- app := App("test", "")
-
- cas.config(app, &setByUser)
-
- called := false
- app.Action = func() {
- called = true
- }
-
- app.Run(cas.args)
-
- require.True(t, called, "action should have been called")
- require.Equal(t, cas.expected, setByUser)
- }
-
-}
-
-func TestArgSetByUser(t *testing.T) {
- cases := []struct {
- desc string
- config func(*Cli, *bool)
- args []string
- expected bool
- }{
- // ARGS
- // String
- {
- desc: "String Arg, not set by user, default value",
- config: func(c *Cli, s *bool) {
- c.Spec = "[ARG]"
- c.String(StringArg{Name: "ARG", Value: "a", SetByUser: s})
- },
- args: []string{"test"},
- expected: false,
- },
- {
- desc: "String Arg, not set by user, env value",
- config: func(c *Cli, s *bool) {
- c.Spec = "[ARG]"
- os.Setenv("MOW_VALUE", "value")
- c.String(StringArg{Name: "ARG", EnvVar: "MOW_VALUE", SetByUser: s})
- },
- args: []string{"test"},
- expected: false,
- },
- {
- desc: "String Arg, set by user",
- config: func(c *Cli, s *bool) {
- c.Spec = "[ARG]"
- c.String(StringArg{Name: "ARG", Value: "a", SetByUser: s})
- },
- args: []string{"test", "aaa"},
- expected: true,
- },
-
- // Bool
- {
- desc: "Bool Arg, not set by user, default value",
- config: func(c *Cli, s *bool) {
- c.Spec = "[ARG]"
- c.Bool(BoolArg{Name: "ARG", Value: true, SetByUser: s})
- },
- args: []string{"test"},
- expected: false,
- },
- {
- desc: "Bool Arg, not set by user, env value",
- config: func(c *Cli, s *bool) {
- c.Spec = "[ARG]"
- os.Setenv("MOW_VALUE", "true")
- c.Bool(BoolArg{Name: "ARG", EnvVar: "MOW_VALUE", SetByUser: s})
- },
- args: []string{"test"},
- expected: false,
- },
- {
- desc: "Bool Arg, set by user",
- config: func(c *Cli, s *bool) {
- c.Spec = "[ARG]"
- c.Bool(BoolArg{Name: "ARG", SetByUser: s})
- },
- args: []string{"test", "true"},
- expected: true,
- },
-
- // Int
- {
- desc: "Int Arg, not set by user, default value",
- config: func(c *Cli, s *bool) {
- c.Spec = "[ARG]"
- c.Int(IntArg{Name: "ARG", Value: 42, SetByUser: s})
- },
- args: []string{"test"},
- expected: false,
- },
- {
- desc: "Int Arg, not set by user, env value",
- config: func(c *Cli, s *bool) {
- c.Spec = "[ARG]"
- os.Setenv("MOW_VALUE", "33")
- c.Int(IntArg{Name: "ARG", EnvVar: "MOW_VALUE", SetByUser: s})
- },
- args: []string{"test"},
- expected: false,
- },
- {
- desc: "Int Arg, set by user",
- config: func(c *Cli, s *bool) {
- c.Spec = "[ARG]"
- c.Int(IntArg{Name: "ARG", SetByUser: s})
- },
- args: []string{"test", "666"},
- expected: true,
- },
-
- // Ints
- {
- desc: "Ints Arg, not set by user, default value",
- config: func(c *Cli, s *bool) {
- c.Spec = "[ARG...]"
- c.Ints(IntsArg{Name: "ARG", Value: []int{42}, SetByUser: s})
- },
- args: []string{"test"},
- expected: false,
- },
- {
- desc: "Ints Arg, not set by user, env value",
- config: func(c *Cli, s *bool) {
- c.Spec = "[ARG...]"
- os.Setenv("MOW_VALUE", "11,22,33")
- c.Ints(IntsArg{Name: "ARG", EnvVar: "MOW_VALUE", SetByUser: s})
- },
- args: []string{"test"},
- expected: false,
- },
- {
- desc: "Ints Arg, set by user",
- config: func(c *Cli, s *bool) {
- c.Spec = "[ARG...]"
- c.Ints(IntsArg{Name: "ARG", SetByUser: s})
- },
- args: []string{"test", "333", "666"},
- expected: true,
- },
-
- // Strings
- {
- desc: "Strings Arg, not set by user, default value",
- config: func(c *Cli, s *bool) {
- c.Spec = "[ARG...]"
- c.Strings(StringsArg{Name: "ARG", Value: []string{"aaa"}, SetByUser: s})
- },
- args: []string{"test"},
- expected: false,
- },
- {
- desc: "Strings Arg, not set by user, env value",
- config: func(c *Cli, s *bool) {
- c.Spec = "[ARG...]"
- os.Setenv("MOW_VALUE", "a,b,c")
- c.Strings(StringsArg{Name: "ARG", EnvVar: "MOW_VALUE", SetByUser: s})
- },
- args: []string{"test"},
- expected: false,
- },
- {
- desc: "Strings Arg, set by user",
- config: func(c *Cli, s *bool) {
- c.Spec = "[ARG...]"
- c.Strings(StringsArg{Name: "ARG", SetByUser: s})
- },
- args: []string{"test", "aaa", "ccc"},
- expected: true,
- },
- }
-
- for _, cas := range cases {
- t.Log(cas.desc)
-
- setByUser := false
- app := App("test", "")
-
- cas.config(app, &setByUser)
-
- called := false
- app.Action = func() {
- called = true
- }
-
- app.Run(cas.args)
-
- require.True(t, called, "action should have been called")
- require.Equal(t, cas.expected, setByUser)
- }
-
-}
-
-func TestCommandAliases(t *testing.T) {
- defer suppressOutput()()
-
- cases := []struct {
- args []string
- errorExpected bool
- }{
- {
- args: []string{"say", "hello"},
- errorExpected: false,
- },
- {
- args: []string{"say", "hi"},
- errorExpected: false,
- },
- {
- args: []string{"say", "hello hi"},
- errorExpected: true,
- },
- {
- args: []string{"say", "hello", "hi"},
- errorExpected: true,
- },
- }
-
- for _, cas := range cases {
- app := App("say", "")
- app.ErrorHandling = flag.ContinueOnError
-
- called := false
-
- app.Command("hello hi", "", func(cmd *Cmd) {
- cmd.Action = func() {
- called = true
- }
- })
-
- err := app.Run(cas.args)
-
- if cas.errorExpected {
- require.Error(t, err, "Run() should have returned with an error")
- require.False(t, called, "action should not have been called")
- } else {
- require.NoError(t, err, "Run() should have returned without an error")
- require.True(t, called, "action should have been called")
- }
- }
-}
-
-func TestSubcommandAliases(t *testing.T) {
- cases := []struct {
- args []string
- }{
- {
- args: []string{"app", "foo", "bar", "baz"},
- },
- {
- args: []string{"app", "foo", "bar", "z"},
- },
- {
- args: []string{"app", "foo", "b", "baz"},
- },
- {
- args: []string{"app", "f", "bar", "baz"},
- },
- {
- args: []string{"app", "f", "b", "baz"},
- },
- {
- args: []string{"app", "f", "b", "z"},
- },
- {
- args: []string{"app", "foo", "b", "z"},
- },
- {
- args: []string{"app", "f", "bar", "z"},
- },
- }
-
- for _, cas := range cases {
- app := App("app", "")
- app.ErrorHandling = flag.ContinueOnError
-
- called := false
-
- app.Command("foo f", "", func(cmd *Cmd) {
- cmd.Command("bar b", "", func(cmd *Cmd) {
- cmd.Command("baz z", "", func(cmd *Cmd) {
- cmd.Action = func() {
- called = true
- }
- })
- })
- })
-
- err := app.Run(cas.args)
-
- require.NoError(t, err, "Run() should have returned without an error")
- require.True(t, called, "action should have been called")
- }
-}
diff --git a/vendor/github.com/jawher/mow.cli/commands.go b/vendor/github.com/jawher/mow.cli/commands.go
deleted file mode 100644
index 2dca78d..0000000
--- a/vendor/github.com/jawher/mow.cli/commands.go
+++ /dev/null
@@ -1,545 +0,0 @@
-package cli
-
-import (
- "flag"
- "fmt"
- "strings"
- "text/tabwriter"
-)
-
-/*
-Cmd represents a command (or sub command) in a CLI application. It should be constructed
-by calling Command() on an app to create a top level command or by calling Command() on another
-command to create a sub command
-*/
-type Cmd struct {
- // The code to execute when this command is matched
- Action func()
- // The code to execute before this command or any of its children is matched
- Before func()
- // The code to execute after this command or any of its children is matched
- After func()
- // The command options and arguments
- Spec string
- // The command long description to be shown when help is requested
- LongDesc string
- // The command error handling strategy
- ErrorHandling flag.ErrorHandling
-
- init CmdInitializer
- name string
- aliases []string
- desc string
-
- commands []*Cmd
- options []*opt
- optionsIdx map[string]*opt
- args []*arg
- argsIdx map[string]*arg
-
- parents []string
-
- fsm *state
-}
-
-/*
-BoolParam represents a Bool option or argument
-*/
-type BoolParam interface {
- value() bool
-}
-
-/*
-StringParam represents a String option or argument
-*/
-type StringParam interface {
- value() string
-}
-
-/*
-IntParam represents an Int option or argument
-*/
-type IntParam interface {
- value() int
-}
-
-/*
-StringsParam represents a string slice option or argument
-*/
-type StringsParam interface {
- value() []string
-}
-
-/*
-IntsParam represents an int slice option or argument
-*/
-type IntsParam interface {
- value() []int
-}
-
-/*
-VarParam represents an custom option or argument where the type and format are controlled by the developer
-*/
-type VarParam interface {
- value() flag.Value
-}
-
-/*
-CmdInitializer is a function that configures a command by adding options, arguments, a spec, sub commands and the code
-to execute when the command is called
-*/
-type CmdInitializer func(*Cmd)
-
-/*
-Command adds a new (sub) command to c where name is the command name (what you type in the console),
-description is what would be shown in the help messages, e.g.:
-
- Usage: git [OPTIONS] COMMAND [arg...]
-
- Commands:
- $name $desc
-
-the last argument, init, is a function that will be called by mow.cli to further configure the created
-(sub) command, e.g. to add options, arguments and the code to execute
-*/
-func (c *Cmd) Command(name, desc string, init CmdInitializer) {
- aliases := strings.Fields(name)
- c.commands = append(c.commands, &Cmd{
- ErrorHandling: c.ErrorHandling,
- name: aliases[0],
- aliases: aliases,
- desc: desc,
- init: init,
- commands: []*Cmd{},
- options: []*opt{},
- optionsIdx: map[string]*opt{},
- args: []*arg{},
- argsIdx: map[string]*arg{},
- })
-}
-
-/*
-Bool can be used to add a bool option or argument to a command.
-It accepts either a BoolOpt or a BoolArg struct.
-
-The result should be stored in a variable (a pointer to a bool) which will be populated when the app is run and the call arguments get parsed
-*/
-func (c *Cmd) Bool(p BoolParam) *bool {
- into := new(bool)
- value := newBoolValue(into, p.value())
-
- switch x := p.(type) {
- case BoolOpt:
- c.mkOpt(opt{name: x.Name, desc: x.Desc, envVar: x.EnvVar, hideValue: x.HideValue, value: value, valueSetByUser: x.SetByUser})
- case BoolArg:
- c.mkArg(arg{name: x.Name, desc: x.Desc, envVar: x.EnvVar, hideValue: x.HideValue, value: value, valueSetByUser: x.SetByUser})
- default:
- panic(fmt.Sprintf("Unhandled param %v", p))
- }
-
- return into
-}
-
-/*
-String can be used to add a string option or argument to a command.
-It accepts either a StringOpt or a StringArg struct.
-
-The result should be stored in a variable (a pointer to a string) which will be populated when the app is run and the call arguments get parsed
-*/
-func (c *Cmd) String(p StringParam) *string {
- into := new(string)
- value := newStringValue(into, p.value())
-
- switch x := p.(type) {
- case StringOpt:
- c.mkOpt(opt{name: x.Name, desc: x.Desc, envVar: x.EnvVar, hideValue: x.HideValue, value: value, valueSetByUser: x.SetByUser})
- case StringArg:
- c.mkArg(arg{name: x.Name, desc: x.Desc, envVar: x.EnvVar, hideValue: x.HideValue, value: value, valueSetByUser: x.SetByUser})
- default:
- panic(fmt.Sprintf("Unhandled param %v", p))
- }
-
- return into
-}
-
-/*
-Int can be used to add an int option or argument to a command.
-It accepts either a IntOpt or a IntArg struct.
-
-The result should be stored in a variable (a pointer to an int) which will be populated when the app is run and the call arguments get parsed
-*/
-func (c *Cmd) Int(p IntParam) *int {
- into := new(int)
- value := newIntValue(into, p.value())
-
- switch x := p.(type) {
- case IntOpt:
- c.mkOpt(opt{name: x.Name, desc: x.Desc, envVar: x.EnvVar, hideValue: x.HideValue, value: value, valueSetByUser: x.SetByUser})
- case IntArg:
- c.mkArg(arg{name: x.Name, desc: x.Desc, envVar: x.EnvVar, hideValue: x.HideValue, value: value, valueSetByUser: x.SetByUser})
- default:
- panic(fmt.Sprintf("Unhandled param %v", p))
- }
-
- return into
-}
-
-/*
-Strings can be used to add a string slice option or argument to a command.
-It accepts either a StringsOpt or a StringsArg struct.
-
-The result should be stored in a variable (a pointer to a string slice) which will be populated when the app is run and the call arguments get parsed
-*/
-func (c *Cmd) Strings(p StringsParam) *[]string {
- into := new([]string)
- value := newStringsValue(into, p.value())
-
- switch x := p.(type) {
- case StringsOpt:
- c.mkOpt(opt{name: x.Name, desc: x.Desc, envVar: x.EnvVar, hideValue: x.HideValue, value: value, valueSetByUser: x.SetByUser})
- case StringsArg:
- c.mkArg(arg{name: x.Name, desc: x.Desc, envVar: x.EnvVar, hideValue: x.HideValue, value: value, valueSetByUser: x.SetByUser})
- default:
- panic(fmt.Sprintf("Unhandled param %v", p))
- }
-
- return into
-}
-
-/*
-Ints can be used to add an int slice option or argument to a command.
-It accepts either a IntsOpt or a IntsArg struct.
-
-The result should be stored in a variable (a pointer to an int slice) which will be populated when the app is run and the call arguments get parsed
-*/
-func (c *Cmd) Ints(p IntsParam) *[]int {
- into := new([]int)
- value := newIntsValue(into, p.value())
-
- switch x := p.(type) {
- case IntsOpt:
- c.mkOpt(opt{name: x.Name, desc: x.Desc, envVar: x.EnvVar, hideValue: x.HideValue, value: value, valueSetByUser: x.SetByUser})
- case IntsArg:
- c.mkArg(arg{name: x.Name, desc: x.Desc, envVar: x.EnvVar, hideValue: x.HideValue, value: value, valueSetByUser: x.SetByUser})
- default:
- panic(fmt.Sprintf("Unhandled param %v", p))
- }
-
- return into
-}
-
-/*
-Var can be used to add a custom option or argument to a command.
-It accepts either a VarOpt or a VarArg struct.
-
-As opposed to the other built-in types, this function does not return a pointer the the value.
-Instead, the VarOpt or VarOptArg structs hold the said value.
-*/
-func (c *Cmd) Var(p VarParam) {
- switch x := p.(type) {
- case VarOpt:
- c.mkOpt(opt{name: x.Name, desc: x.Desc, envVar: x.EnvVar, hideValue: x.HideValue, value: p.value(), valueSetByUser: x.SetByUser})
- case VarArg:
- c.mkArg(arg{name: x.Name, desc: x.Desc, envVar: x.EnvVar, hideValue: x.HideValue, value: p.value(), valueSetByUser: x.SetByUser})
- default:
- panic(fmt.Sprintf("Unhandled param %v", p))
- }
-}
-
-func (c *Cmd) doInit() error {
- if c.init != nil {
- c.init(c)
- }
-
- parents := append(c.parents, c.name)
-
- for _, sub := range c.commands {
- sub.parents = parents
- }
-
- if len(c.Spec) == 0 {
- if len(c.options) > 0 {
- c.Spec = "[OPTIONS] "
- }
- for _, arg := range c.args {
- c.Spec += arg.name + " "
- }
- }
- fsm, err := uParse(c)
- if err != nil {
- return err
- }
- c.fsm = fsm
- return nil
-}
-
-func (c *Cmd) onError(err error) {
- if err == errHelpRequested || err == errVersionRequested {
- if c.ErrorHandling == flag.ExitOnError {
- exiter(0)
- }
- return
- }
-
- switch c.ErrorHandling {
- case flag.ExitOnError:
- exiter(2)
- case flag.PanicOnError:
- panic(err)
- }
-
-}
-
-/*
-PrintHelp prints the command's help message.
-In most cases the library users won't need to call this method, unless
-a more complex validation is needed
-*/
-func (c *Cmd) PrintHelp() {
- c.printHelp(false)
-}
-
-/*
-PrintLongHelp prints the command's help message using the command long description if specified.
-In most cases the library users won't need to call this method, unless
-a more complex validation is needed
-*/
-func (c *Cmd) PrintLongHelp() {
- c.printHelp(true)
-}
-
-func (c *Cmd) printHelp(longDesc bool) {
- full := append(c.parents, c.name)
- path := strings.Join(full, " ")
- fmt.Fprintf(stdErr, "\nUsage: %s", path)
-
- spec := strings.TrimSpace(c.Spec)
- if len(spec) > 0 {
- fmt.Fprintf(stdErr, " %s", spec)
- }
-
- if len(c.commands) > 0 {
- fmt.Fprint(stdErr, " COMMAND [arg...]")
- }
- fmt.Fprint(stdErr, "\n\n")
-
- desc := c.desc
- if longDesc && len(c.LongDesc) > 0 {
- desc = c.LongDesc
- }
- if len(desc) > 0 {
- fmt.Fprintf(stdErr, "%s\n", desc)
- }
-
- w := tabwriter.NewWriter(stdErr, 15, 1, 3, ' ', 0)
-
- if len(c.args) > 0 {
- fmt.Fprint(w, "\t\nArguments:\t\n")
-
- for _, arg := range c.args {
- var (
- env = formatEnvVarsForHelp(arg.envVar)
- value = formatValueForHelp(arg.hideValue, arg.value)
- )
- fmt.Fprintf(w, " %s\t%s\n", arg.name, joinStrings(arg.desc, env, value))
- }
- }
-
- if len(c.options) > 0 {
- fmt.Fprint(w, "\t\nOptions:\t\n")
-
- for _, opt := range c.options {
- var (
- optNames = formatOptNamesForHelp(opt)
- env = formatEnvVarsForHelp(opt.envVar)
- value = formatValueForHelp(opt.hideValue, opt.value)
- )
- fmt.Fprintf(w, " %s\t%s\n", optNames, joinStrings(opt.desc, env, value))
- }
- }
-
- if len(c.commands) > 0 {
- fmt.Fprint(w, "\t\nCommands:\t\n")
-
- for _, c := range c.commands {
- fmt.Fprintf(w, " %s\t%s\n", strings.Join(c.aliases, ", "), c.desc)
- }
- }
-
- if len(c.commands) > 0 {
- fmt.Fprintf(w, "\t\nRun '%s COMMAND --help' for more information on a command.\n", path)
- }
-
- w.Flush()
-}
-
-func formatOptNamesForHelp(o *opt) string {
- short, long := "", ""
-
- for _, n := range o.names {
- if len(n) == 2 && short == "" {
- short = n
- }
-
- if len(n) > 2 && long == "" {
- long = n
- }
- }
-
- switch {
- case short != "" && long != "":
- return fmt.Sprintf("%s, %s", short, long)
- case short != "":
- return fmt.Sprintf("%s", short)
- case long != "":
- // 2 spaces instead of the short option (-x), one space for the comma (,) and one space for the after comma blank
- return fmt.Sprintf(" %s", long)
- default:
- return ""
- }
-}
-
-func formatValueForHelp(hide bool, v flag.Value) string {
- if hide {
- return ""
- }
-
- if dv, ok := v.(defaultValued); ok {
- if dv.IsDefault() {
- return ""
- }
- }
-
- return fmt.Sprintf("(default %s)", v.String())
-}
-
-func formatEnvVarsForHelp(envVars string) string {
- if strings.TrimSpace(envVars) == "" {
- return ""
- }
- vars := strings.Fields(envVars)
- res := "(env"
- sep := " "
- for i, v := range vars {
- if i > 0 {
- sep = ", "
- }
- res += fmt.Sprintf("%s$%s", sep, v)
- }
- res += ")"
- return res
-}
-
-func (c *Cmd) parse(args []string, entry, inFlow, outFlow *step) error {
- if c.helpRequested(args) {
- c.PrintLongHelp()
- c.onError(errHelpRequested)
- return nil
- }
-
- nargsLen := c.getOptsAndArgs(args)
-
- if err := c.fsm.parse(args[:nargsLen]); err != nil {
- fmt.Fprintf(stdErr, "Error: %s\n", err.Error())
- c.PrintHelp()
- c.onError(err)
- return err
- }
-
- newInFlow := &step{
- do: c.Before,
- error: outFlow,
- desc: fmt.Sprintf("%s.Before", c.name),
- }
- inFlow.success = newInFlow
-
- newOutFlow := &step{
- do: c.After,
- success: outFlow,
- error: outFlow,
- desc: fmt.Sprintf("%s.After", c.name),
- }
-
- args = args[nargsLen:]
- if len(args) == 0 {
- if c.Action != nil {
- newInFlow.success = &step{
- do: c.Action,
- success: newOutFlow,
- error: newOutFlow,
- desc: fmt.Sprintf("%s.Action", c.name),
- }
-
- entry.run(nil)
- return nil
- }
- c.PrintHelp()
- c.onError(nil)
- return nil
- }
-
- arg := args[0]
- for _, sub := range c.commands {
- if sub.isAlias(arg) {
- if err := sub.doInit(); err != nil {
- panic(err)
- }
- return sub.parse(args[1:], entry, newInFlow, newOutFlow)
- }
- }
-
- var err error
- switch {
- case strings.HasPrefix(arg, "-"):
- err = fmt.Errorf("Error: illegal option %s", arg)
- fmt.Fprintln(stdErr, err.Error())
- default:
- err = fmt.Errorf("Error: illegal input %s", arg)
- fmt.Fprintln(stdErr, err.Error())
- }
- c.PrintHelp()
- c.onError(err)
- return err
-
-}
-
-func (c *Cmd) helpRequested(args []string) bool {
- return c.isFlagSet(args, []string{"-h", "--help"})
-}
-
-func (c *Cmd) isFlagSet(args []string, searchArgs []string) bool {
- if len(args) == 0 {
- return false
- }
-
- arg := args[0]
- for _, searchArg := range searchArgs {
- if arg == searchArg {
- return true
- }
- }
- return false
-}
-
-func (c *Cmd) getOptsAndArgs(args []string) int {
- consumed := 0
-
- for _, arg := range args {
- for _, sub := range c.commands {
- if sub.isAlias(arg) {
- return consumed
- }
- }
- consumed++
- }
- return consumed
-}
-
-func (c *Cmd) isAlias(arg string) bool {
- for _, alias := range c.aliases {
- if arg == alias {
- return true
- }
- }
- return false
-}
diff --git a/vendor/github.com/jawher/mow.cli/doc.go b/vendor/github.com/jawher/mow.cli/doc.go
deleted file mode 100644
index 398ae25..0000000
--- a/vendor/github.com/jawher/mow.cli/doc.go
+++ /dev/null
@@ -1,518 +0,0 @@
-/*
-Package cli provides a framework to build command line applications in Go with most of the burden of arguments parsing and validation
-placed on the framework instead of the user.
-
-
-Basics
-
-You start by creating an application by passing a name and a description:
-
- cp = cli.App("cp", "Copy files around")
-
-To attach the code to execute when the app is launched, assign a function to the Action field:
- cp.Action = func() {
- fmt.Printf("Hello world\n")
- }
-
-Finally, in your main func, call Run on the app:
-
- cp.Run(os.Args)
-
-Options
-
-To add a (global) option, call one of the (String[s]|Int[s]|Bool)Opt methods on the app:
-
- recursive := cp.BoolOpt("R recursive", false, "recursively copy the src to dst")
-
-* The first argument is a space separated list of names for the option without the dashes
-
-* The second parameter is the default value for the option
-
-* The third parameter is the option description, as will be shown in the help messages
-
-There is also a second set of methods Bool, String, Int, Strings and Ints, which accepts a struct describing the option:
-
- recursive = cp.Bool(BoolOpt{
- Name: "R",
- Value: false,
- Desc: "copy src files recursively",
- EnvVar: "",
- })
-
-There EnvVar field is a space separated list of environment variables names to be used to initialize the option.
-
-The result is a pointer to a value which will be populated after parsing the command line arguments.
-You can access the values in the Action func.
-
-In the command line, mow.cli accepts the following syntaxes
-
-* For boolean options:
-
- -f : a single dash for the one letter names
- -f=false : a single dash for the one letter names, equal sign followed by true or false
- --force : double dash for longer option names
- -it : mow.cli supports option folding, this is equivalent to: -i -t
-
-* For string, int options:
-
- -e=value : single dash for one letter names, equal sign followed by the value
- -e value : single dash for one letter names, space followed by the value
- -Ivalue : single dash for one letter names immediately followed by the value
- --extra=value : double dash for longer option names, equal sign followed by the value
- --extra value : double dash for longer option names, space followed by the value
-
-* For slice options (StringsOpt, IntsOpt): repeat the option to accumulate the values in the resulting slice:
-
- -e PATH:/bin -e PATH:/usr/bin : resulting slice contains ["/bin", "/usr/bin"]
-
-Arguments
-
-To accept arguments, you need to explicitly declare them by calling one of the (String[s]|Int[s]|Bool)Arg methods on the app:
-
- src := cp.StringArg("SRC", "", "the file to copy")
- dst := cp.StringArg("DST", "", "the destination")
-
-* The first argument is the argument name as will be shown in the help messages
-
-* The second parameter is the default value for the argument
-
-* The third parameter is the argument description, as will be shown in the help messages
-
-There is also a second set of methods Bool, String, Int, Strings and Ints, which accepts structs describing the argument:
-
- src = cp.Strings(StringsArg{
- Name: "SRC",
- Desc: "The source files to copy",
- Value: "",
- EnvVar: "",
- SetByUser: &srcSetByUser,
- })
-
-The Value field is where you can set the initial value for the argument.
-
-EnvVar accepts a space separated list of environment variables names to be used to initialize the argument.
-
-If SetByUser is specified (by passing a pointer to a bool variable), it will be set to true only if the user explicitly sets the argument.
-
-
-The result is a pointer to a value that will be populated after parsing the command line arguments.
-You can access the values in the Action func.
-
-
-
-Operators
-
-The -- operator marks the end of options.
-Everything that follow will be treated as an argument,
-even if starts with a dash.
-
-For example, given the touch command which takes a filename as an argument (and possibly other options):
-
-
- file := cp.StringArg("FILE", "", "the file to create")
-
-
-If we try to create a file named -f this way:
-
-
- touch -f
-
-Would fail, because -f will be parsed as an option not as an argument.
-The fix is to prefix the filename with the -- operator:
-
-
- touch -- -f
-
-
-
-Commands
-
-mow.cli supports nesting commands and sub commands.
-Declare a top level command by calling the Command func on the app struct, and a sub command by calling
-the Command func on the command struct:
-
- docker := cli.App("docker", "A self-sufficient runtime for linux containers")
-
- docker.Command("run", "Run a command in a new container", func(cmd *cli.Cmd) {
- // initialize the run command here
- })
-
-* The first argument is the command name, as will be shown in the help messages and as will need to be input by the user in the command line to call the command
-
-* The second argument is the command description as will be shown in the help messages
-
-* The third argument is a CmdInitializer, a function that receives a pointer to a Cmd struct representing the command.
-In this function, you can add options and arguments by calling the same methods as you would with an app struct (BoolOpt, StringArg, ...).
-You would also assign a function to the Action field of the Cmd struct for it to be executed when the command is invoked.
-
- docker.Command("run", "Run a command in a new container", func(cmd *cli.Cmd) {
- detached := cmd.BoolOpt("d detach", false, "Detached mode: run the container in the background and print the new container ID")
- memory := cmd.StringOpt("m memory", "", "Memory limit (format: , where unit = b, k, m or g)")
-
- image := cmd.StringArg("IMAGE", "", "The image to run")
-
- cmd.Action = func() {
- if *detached {
- //do something
- }
- runContainer(*image, *detached, *memory)
- }
- })
-
-You can also add sub commands by calling Command on the Cmd struct:
-
- bzk.Command("job", "actions on jobs", func(cmd *cli.Cmd) {
- cmd.Command("list", "list jobs", listJobs)
- cmd.Command("start", "start a new job", startJob)
- cmd.Command("log", "show a job log", nil)
- })
-
-This could go on to any depth if need be.
-
-mow.cli also supports command aliases. For example:
-
- app.Command("start run r", "start doing things", cli.ActionCommand(func() { start() }))
-
-will alias `start`, `run`, and `r` to the same action. Aliases also work for
-subcommands:
-
- app.Command("job j", "actions on jobs", func(cmd *cli.Cmd) {
- cmd.Command("list ls", "list jobs", func(cmd *cli.Cmd) {
- cmd.Action = func() {
- list()
- }
- })
- })
-
-which then allows you to invoke the subcommand as `app job list`, `app job ls`,
-`app j ls`, or `app j list`.
-
-
-As a side-note: it may seem a bit weird the way mow.cli uses a function to initialize a command
-instead of just returning the command struct.
-
-The motivation behind this choice is scoping: as with the standard flag package, adding an option or an argument
-returns a pointer to a value which will be populated when the app is run.
-
-Since you'll want to store these pointers in variables, and to avoid having dozens of them in the same scope (the main func for example or as global variables),
-mow.cli's API was specifically tailored to take a func parameter (called CmdInitializer) which accepts the command struct.
-
-This way, the command specific variables scope is limited to this function.
-
-Custom types
-
-Out of the box, mow.cli supports the following types for options and arguments: bool, string, int, strings (slice of strings) and ints (slice of ints)
-
-You can however extend mow.cli to handle other types, e.g. `time.Duration`, `float64`, or even your own struct types for example.
-
-To do so, you'll need to:
-
-* implement the `flag.Value` interface for the custom type
-
-* declare the option or the flag using `VarOpt`, `VarArg` for the short hands, and `Var` for the full form.
-
-Here's an example:
-
-
- // Declare your type
- type Duration time.Duration
-
- // Make it implement flag.Value
- func (d *Duration) Set(v string) error {
- parsed, err := time.ParseDuration(v)
- if err != nil {
- return err
- }
- *d = Duration(parsed)
- return nil
- }
-
- func (d *Duration) String() string {
- duration := time.Duration(*d)
- return duration.String()
- }
-
- func main() {
- duration := Duration(0)
-
- app := App("var", "")
-
- app.VarArg("DURATION", &duration, "")
-
- app.Run([]string{"cp", "1h31m42s"})
- }
-
-Boolean custom types
-
-To make your custom type behave as a boolean option, i.e. doesn't take a value, it has to implement a IsBoolFlag method that returns true:
-
-
- type BoolLike int
-
-
- func (d *BoolLike) IsBoolFlag() bool {
- return true
- }
-
-
-Multi-valued custom type
-
-To make your custom type behave as a multi-valued option or argument, i.e. takes multiple values,
-it has to implement a `Clear` method which will be called whenever the values list needs to be cleared,
-e.g. when the value was initially populated from an environment variable, and then explicitly set from the CLI:
-
- type Durations []time.Duration
-
- // Make it implement flag.Value
- func (d *Durations) Set(v string) error {
- parsed, err := time.ParseDuration(v)
- if err != nil {
- return err
- }
- *d = append(*d, Duration(parsed))
- return nil
- }
-
- func (d *Durations) String() string {
- return fmt.Sprintf("%v", *d)
- }
-
-
- // Make it multi-valued
- func (d *Durations) Clear() {
- *d = []Duration{}
- }
-
-Interceptors
-
-It is possible to define snippets of code to be executed before and after a command or any of its sub commands is executed.
-
-For example, given an app with multiple commands but with a global flag which toggles a verbose mode:
-
-
- app := cli.App("app", "bla bla")
- verbose := app.Bool(cli.BoolOpt{
- Name: "verbose",
- Value: false,
- Desc: "Enable debug logs",
- })
-
- app.Command("command1", "...", func(cmd *cli.Cmd) {
-
- })
-
- app.Command("command2", "...", func(cmd *cli.Cmd) {
-
- })
-
-Instead of repeating yourself by checking if the verbose flag is set or not, and setting the debug level in every command (and its sub-commands),
-a before interceptor can be set on the `app` instead:
-
- app.Before = func() {
- if (*verbose) {
- logrus.SetLevel(logrus.DebugLevel)
- }
- }
-
-Whenever a valid command is called by the user, all the before interceptors defined on the app and the intermediate commands
-will be called, in order from the root to the leaf.
-
-Similarly, if you need to execute a code snippet after a command has been called, e.g. to cleanup resources allocated in before interceptors,
-simply set the After field of the app struct or any other command.
-
-After interceptors will be called, in order from the leaf up to the root (the opposite order of the Before interceptors).
-
-Here's a diagram which shows in when and in which order multiple Before and After interceptors get executed:
-
- +------------+ success +------------+ success +----------------+ success
- | app.Before +---------------> cmd.Before +-------------> sub_cmd.Before +---------+
- +------------+ +-+----------+ +--+-------------+ |
- | | +-v-------+
- error | error | | sub_cmd |
- +-----------------------+ +-----------------------+ | Action |
- | | +-+-------+
- +------v-----+ +-----v------+ +----------------+ |
- | app.After <---------------+ cmd.After <-------------+ sub_cmd.After <---------+
- +------------+ always +------------+ always +----------------+ always
-
-Spec
-
-An app or command's call syntax can be customized using spec strings.
-This can be useful to indicate that an argument is optional for example, or that 2 options are mutually exclusive.
-
-You can set a spec string on:
-
-* The app: to configure the syntax for global options and arguments
-
-* A command: to configure the syntax for that command's options and arguments
-
-In both cases, a spec string is assigned to the Spec field:
-
- cp := cli.App("cp", "Copy files around")
- cp.Spec = "[-R [-H | -L | -P]]"
-
-And:
-
- docker := cli.App("docker", "A self-sufficient runtime for linux containers")
- docker.Command("run", "Run a command in a new container", func(cmd *cli.Cmd) {
- cmd.Spec = "[-d|--rm] IMAGE [COMMAND [ARG...]]"
- :
- :
- }
-
-The spec syntax is mostly based on the conventions used in POSIX command line apps help messages and man pages:
-
-Options
-
-You can use both short and long option names in spec strings:
- x.Spec="-f"
-And:
- x.Spec="--force"
-
-In both cases, we required that the f or force flag be set
-
-Any option you reference in a spec string MUST be explicitly declared, otherwise mow.cli will panic:
-
- x.BoolOpt("f force", ...)
-
-Arguments
-
-Arguments are all-uppercased words:
- x.Spec="SRC DST"
-This spec string will force the user to pass exactly 2 arguments, SRC and DST
-
-Any argument you reference in a spec string MUST be explicitly declared, otherwise mow.cli will panic:
-
- x.StringArg("SRC", ...)
- x.StringArg("DST", ...)
-
-Ordering
-
-Except for options, The order of the elements in a spec string is respected and enforced when parsing the command line arguments:
-
- x.Spec = "-f -g SRC -h DST"
-
-Consecutive options (-f and -g for example) get parsed regardless of the order they are specified in (both "-f=5 -g=6" and "-g=6 -f=5" are valid).
-
-Order between options and arguments is significant (-f and -g must appear before the SRC argument).
-
-Same goes for arguments, where SRC must appear before DST.
-
-Optionality
-
-You can mark items as optional in a spec string by enclosing them in square brackets :[...]
- x.Spec = "[-x]"
-
-Choice
-
-You can use the | operator to indicate a choice between two or more items
- x.Spec = "--rm | --daemon"
- x.Spec = "-H | -L | -P"
- x.Spec = "-t | DST"
-
-Repetition
-
-You can use the ... postfix operator to mark an element as repeatable:
- x.Spec="SRC..."
- x.Spec="-e..."
-
-Grouping
-
-You can group items using parenthesis. This is useful in combination with the choice and repetition operators (| and ...):
- x.Spec = "(-e COMMAND)... | (-x|-y)"
-The parenthesis in the example above serve to mark that it is the sequence of a -e flag followed by an argument that is repeatable, and that
-all that is mutually exclusive to a choice between -x and -y options.
-
-Option group
-
-This is a shortcut to declare a choice between multiple options:
- x.Spec = "-abcd"
-Is equivalent to:
- x.Spec = "(-a | -b | -c | -d)..."
-I.e. any combination of the listed options in any order, with at least one option.
-
-All options
-
-Another shortcut:
- x.Spec = "[OPTIONS]"
-This is a special syntax (the square brackets are not for marking an optional item, and the uppercased word is not for an argument).
-This is equivalent to a repeatable choice between all the available options.
-For example, if an app or a command declares 4 options a, b, c and d, [OPTIONS] is equivalent to
- x.Spec = "[-a | -b | -c | -d]..."
-
-Inline option values
-
-You can use the = notation right after an option (long or short form) to give an inline description or value.
-An example:
- x.Spec = "[ -a= | --timeout= ] ARG"
-The inline values are ignored by the spec parser and are just there for the final user as a contextual hint.
-
-Operators
-
-The `--` operator can be used in a spec string to automatically treat everything following it as an options.
-
-In other words, placing a `--` in the spec string automatically inserts a `--` in the same position in the program call arguments.
-
-This lets you write programs like the `time` utility for example:
-
- x.Spec = "time -lp [-- CMD [ARG...]]"
-
-
-Spec Grammar
-
-Here's the EBNF grammar for the Specs language:
-
- spec -> sequence
- sequence -> choice*
- req_sequence -> choice+
- choice -> atom ('|' atom)*
- atom -> (shortOpt | longOpt | optSeq | allOpts | group | optional) rep?
- shortOp -> '-' [A-Za-z]
- longOpt -> '--' [A-Za-z][A-Za-z0-9]*
- optSeq -> '-' [A-Za-z]+
- allOpts -> '[OPTIONS]'
- group -> '(' req_sequence ')'
- optional -> '[' req_sequence ']'
- rep -> '...'
-
-And that's it for the spec language.
-You can combine these few building blocks in any way you want (while respecting the grammar above) to construct sophisticated validation constraints
-(don't go too wild though).
-
-Behind the scenes, mow.cli parses the spec string and constructs a finite state machine to be used to parse the command line arguments.
-mow.cli also handles backtracking, and so it can handle tricky cases, or what I like to call "the cp test"
- cp SRC... DST
-Without backtracking, this deceptively simple spec string cannot be parsed correctly.
-For instance, docopt can't handle this case, whereas mow.cli does.
-
-Default spec
-
-By default, and unless a spec string is set by the user, mow.cli auto-generates one for the app and every command using this logic:
-
-* Start with an empty spec string
-
-* If at least one option was declared, append "[OPTIONS]" to the spec string
-
-* For every declared argument, append it, in the order of declaration, to the spec string
-
-For example, given this command declaration:
- docker.Command("run", "Run a command in a new container", func(cmd *cli.Cmd) {
- detached := cmd.BoolOpt("d detach", false, "Detached mode: run the container in the background and print the new container ID")
- memory := cmd.StringOpt("m memory", "", "Memory limit (format: , where unit = b, k, m or g)")
-
- image := cmd.StringArg("IMAGE", "", "")
- args := cmd.StringsArg("ARG", "", "")
- })
-The auto-generated spec string would be:
- [OPTIONS] IMAGE ARG
-
-Which should suffice for simple cases. If not, the spec string has to be set explicitly.
-
-
-Exiting
-
-mow.cli provides the Exit function which accepts an exit code and exits the app with the provided code.
-
-You are highly encouraged to call cli.Exit instead of os.Exit for the After interceptors to be executed.
-*/
-package cli
diff --git a/vendor/github.com/jawher/mow.cli/errors.go b/vendor/github.com/jawher/mow.cli/errors.go
deleted file mode 100644
index b2e21fc..0000000
--- a/vendor/github.com/jawher/mow.cli/errors.go
+++ /dev/null
@@ -1,10 +0,0 @@
-package cli
-
-import (
- "errors"
-)
-
-var (
- errHelpRequested = errors.New("Help requested")
- errVersionRequested = errors.New("Version requested")
-)
diff --git a/vendor/github.com/jawher/mow.cli/examples_test.go b/vendor/github.com/jawher/mow.cli/examples_test.go
deleted file mode 100644
index 2638386..0000000
--- a/vendor/github.com/jawher/mow.cli/examples_test.go
+++ /dev/null
@@ -1,149 +0,0 @@
-package cli
-
-import (
- "fmt"
- "os"
- "time"
-)
-
-func Example_greet() {
- app := App("greet", "Greet")
- app.Spec = "[NAME]"
- name := app.String(StringArg{Name: "NAME", Value: "stranger", Desc: "Your name", EnvVar: "USER"})
- app.Action = func() {
- fmt.Printf("Hello %s\n", *name)
- }
- app.Run(os.Args)
-}
-
-func Example_cp() {
- cp := App("cp", "Copy files around")
- cp.Spec = "[-R [-H | -L | -P]] [-fi | -n] SRC... DST"
-
- var (
- recursive = cp.Bool(BoolOpt{
- Name: "R",
- Value: false,
- Desc: "copy src files recursively",
- })
-
- followSymbolicCL = cp.Bool(BoolOpt{Name: "H", Value: false, Desc: "If the -R option is specified, symbolic links on the command line are followed. (Symbolic links encountered in the tree traversal are not followed.)"})
- followSymbolicTree = cp.Bool(BoolOpt{Name: "L", Value: false, Desc: "If the -R option is specified, all symbolic links are followed."})
- followSymbolicNo = cp.Bool(BoolOpt{Name: "P", Value: true, Desc: "If the -R option is specified, no symbolic links are followed. This is the default."})
-
- force = cp.Bool(BoolOpt{Name: "f", Value: false, Desc: "If the destination file cannot be opened, remove it and create a new file, without prompting for confirmation regardless of its permissions. (The -f option overrides any previous -n option.)"})
- interactive = cp.Bool(BoolOpt{Name: "i", Value: false, Desc: "Cause cp to write a prompt to the standard error output before copying a file that would overwrite an existing file. If the response from the standard input begins with the character `y' or `Y', the file copy is attempted. (The -i option overrides any previous -n option.)"})
- noOverwrite = cp.Bool(BoolOpt{Name: "f", Value: false, Desc: "Do not overwrite an existing file. (The -n option overrides any previous -f or -i options.)"})
- )
-
- var (
- src = cp.Strings(StringsArg{
- Name: "SRC",
- Desc: "The source files to copy",
- })
- dst = cp.Strings(StringsArg{Name: "DST", Value: nil, Desc: "The destination directory"})
- )
-
- cp.Action = func() {
- fmt.Printf(`copy:
- SRC: %v
- DST: %v
- recursive: %v
- follow links (CL, Tree, No): %v %v %v
- force: %v
- interactive: %v
- no overwrite: %v`,
- *src, *dst, *recursive,
- *followSymbolicCL, *followSymbolicTree, *followSymbolicNo,
- *force,
- *interactive,
- *noOverwrite)
- }
-
- cp.Run(os.Args)
-}
-
-func Example_docker() {
- docker := App("docker", "A self-sufficient runtime for linux containers")
-
- docker.Command("run", "Run a command in a new container", func(cmd *Cmd) {
- cmd.Spec = "[-d|--rm] IMAGE [COMMAND [ARG...]]"
-
- var (
- detached = cmd.Bool(BoolOpt{Name: "d detach", Value: false, Desc: "Detached mode: run the container in the background and print the new container ID"})
- rm = cmd.Bool(BoolOpt{Name: "rm", Value: false, Desc: "Automatically remove the container when it exits (incompatible with -d)"})
- memory = cmd.String(StringOpt{Name: "m memory", Value: "", Desc: "Memory limit (format: , where unit = b, k, m or g)"})
- )
-
- var (
- image = cmd.String(StringArg{Name: "IMAGE", Value: "", Desc: ""})
- command = cmd.String(StringArg{Name: "COMMAND", Value: "", Desc: "The command to run"})
- args = cmd.Strings(StringsArg{Name: "ARG", Value: nil, Desc: "The command arguments"})
- )
-
- cmd.Action = func() {
- var how string
- switch {
- case *detached:
- how = "detached"
- case *rm:
- how = "rm after"
- default:
- how = "--"
- }
- fmt.Printf("Run image %s, command %s, args %v, how? %v, mem %s", *image, *command, *args, how, *memory)
- }
- })
-
- docker.Command("pull", "Pull an image or a repository from the registry", func(cmd *Cmd) {
- cmd.Spec = "[-a] NAME"
-
- all := cmd.Bool(BoolOpt{Name: "a all-tags", Value: false, Desc: "Download all tagged images in the repository"})
-
- name := cmd.String(StringArg{Name: "NAME", Value: "", Desc: "Image name (optionally NAME:TAG)"})
-
- cmd.Action = func() {
- if *all {
- fmt.Printf("Download all tags for image %s", *name)
- return
- }
- fmt.Printf("Download image %s", *name)
- }
- })
-
- docker.Run(os.Args)
-}
-
-func Example_beforeAfter() {
- app := App("app", "App")
- bench := app.BoolOpt("b bench", false, "Measure execution time")
-
- var t0 time.Time
-
- app.Before = func() {
- if *bench {
- t0 = time.Now()
- }
- }
-
- app.After = func() {
- if *bench {
- d := time.Since(t0)
- fmt.Printf("Command execution took: %vs", d.Seconds())
- }
- }
-
- app.Command("cmd1", "first command", func(cmd *Cmd) {
- cmd.Action = func() {
- fmt.Print("Running command 1")
- }
- })
-
- app.Command("cmd2", "second command", func(cmd *Cmd) {
- cmd.Action = func() {
- fmt.Print("Running command 2")
- }
- })
-
- app.Run(os.Args)
-}
diff --git a/vendor/github.com/jawher/mow.cli/examples_vararg_test.go b/vendor/github.com/jawher/mow.cli/examples_vararg_test.go
deleted file mode 100644
index aea7e38..0000000
--- a/vendor/github.com/jawher/mow.cli/examples_vararg_test.go
+++ /dev/null
@@ -1,43 +0,0 @@
-package cli_test
-
-import (
- "fmt"
-
- cli "github.com/jawher/mow.cli"
-)
-
-// Declare your type
-type Counter int
-
-// Make it implement flag.Value
-func (c *Counter) Set(v string) error {
- *c++
- return nil
-}
-
-func (c *Counter) String() string {
- return fmt.Sprintf("%d", *c)
-}
-
-// Make it a bool option
-func (c *Counter) IsBoolFlag() bool {
- return true
-}
-
-func ExampleVarOpt() {
-
- app := cli.App("var", "Var opt example")
-
- // Declare a variable of your type
- verbosity := Counter(0)
- // Call one of the Var methods (arg, opt, ...) to declare your custom type
- app.VarOpt("v", &verbosity, "verbosity level")
-
- app.Action = func() {
- // The variable will be populated after the app is ran
- fmt.Print(verbosity)
- }
-
- app.Run([]string{"app", "-vvvvv"})
- // Output: 5
-}
diff --git a/vendor/github.com/jawher/mow.cli/examples_varopt_test.go b/vendor/github.com/jawher/mow.cli/examples_varopt_test.go
deleted file mode 100644
index e797340..0000000
--- a/vendor/github.com/jawher/mow.cli/examples_varopt_test.go
+++ /dev/null
@@ -1,44 +0,0 @@
-package cli_test
-
-import (
- "fmt"
- "time"
-
- cli "github.com/jawher/mow.cli"
-)
-
-// Declare your type
-type Duration time.Duration
-
-// Make it implement flag.Value
-func (d *Duration) Set(v string) error {
- parsed, err := time.ParseDuration(v)
- if err != nil {
- return err
- }
- *d = Duration(parsed)
- return nil
-}
-
-func (d *Duration) String() string {
- duration := time.Duration(*d)
- return duration.String()
-}
-
-func ExampleVarArg() {
-
- app := cli.App("var", "Var arg example")
-
- // Declare a variable of your type
- duration := Duration(0)
- // Call one of the Var methods (arg, opt, ...) to declare your custom type
- app.VarArg("DURATION", &duration, "")
-
- app.Action = func() {
- // The variable will be populated after the app is ran
- fmt.Print(time.Duration(duration))
- }
-
- app.Run([]string{"cp", "1h31m42s"})
- // Output: 1h31m42s
-}
diff --git a/vendor/github.com/jawher/mow.cli/flow.go b/vendor/github.com/jawher/mow.cli/flow.go
deleted file mode 100644
index 21bbbf8..0000000
--- a/vendor/github.com/jawher/mow.cli/flow.go
+++ /dev/null
@@ -1,68 +0,0 @@
-package cli
-
-import (
- "fmt"
- "strings"
-)
-
-type step struct {
- do func()
- success *step
- error *step
- desc string
-}
-
-func (s *step) run(p interface{}) {
- s.callDo(p)
-
- switch {
- case s.success != nil:
- s.success.run(p)
- case p == nil:
- return
- default:
- if code, ok := p.(exit); ok {
- exiter(int(code))
- return
- }
- panic(p)
- }
-}
-
-func (s *step) callDo(p interface{}) {
- if s.do == nil {
- return
- }
- defer func() {
- if e := recover(); e != nil {
- if s.error == nil {
- panic(p)
- }
- s.error.run(e)
- }
- }()
- s.do()
-}
-
-func (s *step) dot() string {
- trs := flowDot(s, map[*step]bool{})
- return fmt.Sprintf("digraph G {\n\trankdir=LR\n%s\n}\n", strings.Join(trs, "\n"))
-}
-
-func flowDot(s *step, visited map[*step]bool) []string {
- res := []string{}
- if visited[s] {
- return res
- }
- visited[s] = true
-
- if s.success != nil {
- res = append(res, fmt.Sprintf("\t\"%s\" -> \"%s\" [label=\"ok\"]", s.desc, s.success.desc))
- res = append(res, flowDot(s.success, visited)...)
- }
- if s.error != nil {
- res = append(res, fmt.Sprintf("\t\"%s\" -> \"%s\" [label=\"ko\"]", s.desc, s.error.desc))
- res = append(res, flowDot(s.error, visited)...)
- }
- return res
-}
diff --git a/vendor/github.com/jawher/mow.cli/flow_test.go b/vendor/github.com/jawher/mow.cli/flow_test.go
deleted file mode 100644
index 234e457..0000000
--- a/vendor/github.com/jawher/mow.cli/flow_test.go
+++ /dev/null
@@ -1,236 +0,0 @@
-package cli
-
-import (
- "github.com/stretchr/testify/require"
-
- "testing"
-)
-
-func TestStepCallsDo(t *testing.T) {
- called := false
- step := &step{
- do: func() {
- called = true
- },
- }
-
- step.run(nil)
-
- require.True(t, called, "Step's do wasn't called")
-}
-
-func TestStepCallsSuccessAfterDo(t *testing.T) {
- calls := 0
- step := &step{
- do: func() {
- require.Equal(t, 0, calls, "Do should be called first")
- calls++
- },
- success: &step{
- do: func() {
- require.Equal(t, 1, calls, "Success should be called second")
- calls++
- },
- },
- error: &step{
- do: func() {
- t.Fatalf("Error should not have been called")
- },
- },
- }
-
- step.run(nil)
-
- require.Equal(t, 2, calls, "Both do and success should be called")
-}
-
-func TestStepCallsErrorIfDoPanics(t *testing.T) {
- defer func() { recover() }()
- calls := 0
- step := &step{
- do: func() {
- require.Equal(t, 0, calls, "Do should be called first")
- calls++
- panic(42)
- },
- success: &step{
- do: func() {
- t.Fatalf("Success should not have been called")
- },
- },
- error: &step{
- do: func() {
- require.Equal(t, 1, calls, "Error should be called second")
- calls++
- },
- },
- }
-
- step.run(nil)
-
- require.Equal(t, 2, calls, "Both do and error should be called")
-}
-
-func TestStepCallsOsExitIfAskedTo(t *testing.T) {
- exitCalled := false
- defer exitShouldBeCalledWith(t, 42, &exitCalled)()
-
- step := &step{}
-
- step.run(exit(42))
-
- require.True(t, exitCalled, "should have called exit")
-}
-
-func TestStepRethrowsPanic(t *testing.T) {
- defer func() {
- require.Equal(t, 42, recover(), "should panicked with the same value")
- }()
-
- step := &step{}
-
- step.run(42)
-
- t.Fatalf("Should have panicked")
-}
-
-func TestStepShouldNopIfNoSuccessNorPanic(t *testing.T) {
- defer exitShouldNotCalled(t)()
-
- step := &step{}
-
- step.run(nil)
-}
-
-func TestBeforeAndAfterFlowOrder(t *testing.T) {
- counter := 0
-
- app := App("app", "")
-
- app.Before = callChecker(t, 0, &counter)
- app.Command("c", "", func(c *Cmd) {
- c.Before = callChecker(t, 1, &counter)
- c.Command("cc", "", func(cc *Cmd) {
- cc.Before = callChecker(t, 2, &counter)
- cc.Action = callChecker(t, 3, &counter)
- cc.After = callChecker(t, 4, &counter)
- })
- c.After = callChecker(t, 5, &counter)
- })
- app.After = callChecker(t, 6, &counter)
-
- app.Run([]string{"app", "c", "cc"})
- require.Equal(t, 7, counter)
-}
-
-func TestBeforeAndAfterFlowOrderWhenOneBeforePanics(t *testing.T) {
- defer func() {
- recover()
- }()
-
- counter := 0
-
- app := App("app", "")
-
- app.Before = callChecker(t, 0, &counter)
- app.Command("c", "", func(c *Cmd) {
- c.Before = callChecker(t, 1, &counter)
- c.Command("cc", "", func(cc *Cmd) {
- cc.Before = callCheckerAndPanic(t, 42, 2, &counter)
- cc.Action = func() {
- t.Fatalf("should not have been called")
- }
- cc.After = func() {
- t.Fatalf("should not have been called")
- }
- })
- c.After = callChecker(t, 3, &counter)
- })
- app.After = callChecker(t, 4, &counter)
-
- app.Run([]string{"app", "c", "cc"})
- require.Equal(t, 5, counter)
-}
-
-func TestBeforeAndAfterFlowOrderWhenOneAfterPanics(t *testing.T) {
- defer func() {
- e := recover()
- require.Equal(t, 42, e)
- }()
-
- counter := 0
-
- app := App("app", "")
-
- app.Before = callChecker(t, 0, &counter)
- app.Command("c", "", func(c *Cmd) {
- c.Before = callChecker(t, 1, &counter)
- c.Command("cc", "", func(cc *Cmd) {
- cc.Before = callChecker(t, 2, &counter)
- cc.Action = callChecker(t, 3, &counter)
- cc.After = callCheckerAndPanic(t, 42, 4, &counter)
- })
- c.After = callChecker(t, 5, &counter)
- })
- app.After = callChecker(t, 6, &counter)
-
- app.Run([]string{"app", "c", "cc"})
- require.Equal(t, 7, counter)
-}
-
-func TestBeforeAndAfterFlowOrderWhenMultipleAftersPanic(t *testing.T) {
- defer func() {
- e := recover()
- require.Equal(t, 666, e)
- }()
-
- counter := 0
-
- app := App("app", "")
-
- app.Before = callChecker(t, 0, &counter)
- app.Command("c", "", func(c *Cmd) {
- c.Before = callChecker(t, 1, &counter)
- c.Command("cc", "", func(cc *Cmd) {
- cc.Before = callChecker(t, 2, &counter)
- cc.Action = callChecker(t, 3, &counter)
- cc.After = callCheckerAndPanic(t, 42, 4, &counter)
- })
- c.After = callChecker(t, 5, &counter)
- })
- app.After = callCheckerAndPanic(t, 666, 6, &counter)
-
- app.Run([]string{"app", "c", "cc"})
- require.Equal(t, 7, counter)
-}
-
-func TestCommandAction(t *testing.T) {
-
- called := false
-
- app := App("app", "")
-
- app.Command("a", "", ActionCommand(func() { called = true }))
-
- app.Run([]string{"app", "a"})
-
- require.True(t, called, "commandAction should be called")
-
-}
-
-func callChecker(t *testing.T, wanted int, counter *int) func() {
- return func() {
- t.Logf("checker: wanted: %d, got %d", wanted, *counter)
- require.Equal(t, wanted, *counter)
- *counter++
- }
-}
-
-func callCheckerAndPanic(t *testing.T, panicValue interface{}, wanted int, counter *int) func() {
- return func() {
- t.Logf("checker: wanted: %d, got %d", wanted, *counter)
- require.Equal(t, wanted, *counter)
- *counter++
- panic(panicValue)
- }
-}
diff --git a/vendor/github.com/jawher/mow.cli/fsm.go b/vendor/github.com/jawher/mow.cli/fsm.go
deleted file mode 100644
index fbeaf0b..0000000
--- a/vendor/github.com/jawher/mow.cli/fsm.go
+++ /dev/null
@@ -1,254 +0,0 @@
-package cli
-
-import (
- "sort"
- "strings"
-
- "fmt"
-)
-
-type state struct {
- id int
- terminal bool
- transitions transitions
- cmd *Cmd
-}
-
-type transition struct {
- matcher upMatcher
- next *state
-}
-
-type transitions []*transition
-
-func (t transitions) Len() int { return len(t) }
-func (t transitions) Swap(i, j int) { t[i], t[j] = t[j], t[i] }
-func (t transitions) Less(i, j int) bool {
- a, _ := t[i].matcher, t[j].matcher
- switch a.(type) {
- case upShortcut:
- return false
- case upOptsEnd:
- return false
- case *arg:
- return false
- default:
- return true
- }
-
-}
-
-var _id = 0
-
-func newState(cmd *Cmd) *state {
- _id++
- return &state{_id, false, []*transition{}, cmd}
-}
-
-func (s *state) t(matcher upMatcher, next *state) *state {
- s.transitions = append(s.transitions, &transition{matcher, next})
- return next
-}
-
-func (s *state) has(tr *transition) bool {
- for _, t := range s.transitions {
- if t.next == tr.next && t.matcher == tr.matcher {
- return true
- }
- }
- return false
-}
-
-func incoming(s, into *state, visited map[*state]bool) []*transition {
- res := []*transition{}
- if visited[s] {
- return res
- }
- visited[s] = true
-
- for _, tr := range s.transitions {
- if tr.next == into {
- res = append(res, tr)
- }
- res = append(res, incoming(tr.next, into, visited)...)
- }
- return res
-}
-
-func removeTransitionAt(idx int, arr transitions) transitions {
- res := make([]*transition, len(arr)-1)
- copy(res, arr[:idx])
- copy(res[idx:], arr[idx+1:])
- return res
-}
-
-func (s *state) simplify() {
- simplify(s, s, map[*state]bool{})
-}
-
-func simplify(start, s *state, visited map[*state]bool) {
- if visited[s] {
- return
- }
- visited[s] = true
- for _, tr := range s.transitions {
- simplify(start, tr.next, visited)
- }
- for s.simplifySelf(start) {
- }
-}
-
-func (s *state) simplifySelf(start *state) bool {
- for idx, tr := range s.transitions {
- if _, ok := tr.matcher.(upShortcut); ok {
- next := tr.next
- s.transitions = removeTransitionAt(idx, s.transitions)
- for _, tr := range next.transitions {
- if !s.has(tr) {
- s.transitions = append(s.transitions, tr)
- }
- }
- if next.terminal {
- s.terminal = true
- }
- return true
- }
- }
- return false
-}
-
-func (s *state) dot() string {
- trs := dot(s, map[*state]bool{})
- return fmt.Sprintf("digraph G {\n\trankdir=LR\n%s\n}\n", strings.Join(trs, "\n"))
-}
-
-func dot(s *state, visited map[*state]bool) []string {
- res := []string{}
- if visited[s] {
- return res
- }
- visited[s] = true
-
- for _, tr := range s.transitions {
- res = append(res, fmt.Sprintf("\tS%d -> S%d [label=\"%v\"]", s.id, tr.next.id, tr.matcher))
- res = append(res, dot(tr.next, visited)...)
- }
- if s.terminal {
- res = append(res, fmt.Sprintf("\tS%d [peripheries=2]", s.id))
- }
- return res
-}
-
-type parseContext struct {
- args map[*arg][]string
- opts map[*opt][]string
- excludedOpts map[*opt]struct{}
- rejectOptions bool
-}
-
-func newParseContext() parseContext {
- return parseContext{
- args: map[*arg][]string{},
- opts: map[*opt][]string{},
- excludedOpts: map[*opt]struct{}{},
- rejectOptions: false,
- }
-}
-
-func (pc parseContext) merge(o parseContext) {
- for k, vs := range o.args {
- pc.args[k] = append(pc.args[k], vs...)
- }
-
- for k, vs := range o.opts {
- pc.opts[k] = append(pc.opts[k], vs...)
- }
-}
-
-func (s *state) parse(args []string) error {
- pc := newParseContext()
- ok, err := s.apply(args, pc)
- if err != nil {
- return err
- }
- if !ok {
- return fmt.Errorf("incorrect usage")
- }
-
- for opt, vs := range pc.opts {
- if multiValued, ok := opt.value.(multiValued); ok {
- multiValued.Clear()
- opt.valueSetFromEnv = false
- }
- for _, v := range vs {
- if err := opt.value.Set(v); err != nil {
- return err
- }
- }
-
- if opt.valueSetByUser != nil {
- *opt.valueSetByUser = true
- }
- }
-
- for arg, vs := range pc.args {
- if multiValued, ok := arg.value.(multiValued); ok {
- multiValued.Clear()
- arg.valueSetFromEnv = false
- }
- for _, v := range vs {
- if err := arg.value.Set(v); err != nil {
- return err
- }
- }
-
- if arg.valueSetByUser != nil {
- *arg.valueSetByUser = true
- }
- }
-
- return nil
-}
-
-func (s *state) apply(args []string, pc parseContext) (bool, error) {
- if s.terminal && len(args) == 0 {
- return true, nil
- }
- sort.Sort(s.transitions)
-
- if len(args) > 0 {
- arg := args[0]
-
- if !pc.rejectOptions && arg == "--" {
- pc.rejectOptions = true
- args = args[1:]
- }
- }
-
- type match struct {
- tr *transition
- rem []string
- pc parseContext
- }
-
- matches := []*match{}
- for _, tr := range s.transitions {
- fresh := newParseContext()
- fresh.rejectOptions = pc.rejectOptions
- if ok, rem := tr.matcher.match(args, &fresh); ok {
- matches = append(matches, &match{tr, rem, fresh})
- }
- }
-
- for _, m := range matches {
- ok, err := m.tr.next.apply(m.rem, m.pc)
- if err != nil {
- return false, err
- }
- if ok {
- pc.merge(m.pc)
- return true, nil
- }
- }
- return false, nil
-}
diff --git a/vendor/github.com/jawher/mow.cli/helper_test.go b/vendor/github.com/jawher/mow.cli/helper_test.go
deleted file mode 100644
index cdcea4f..0000000
--- a/vendor/github.com/jawher/mow.cli/helper_test.go
+++ /dev/null
@@ -1,73 +0,0 @@
-package cli
-
-import (
- "testing"
-
- "bytes"
-
- "io/ioutil"
-
- "github.com/stretchr/testify/require"
-)
-
-func exitShouldBeCalledWith(t *testing.T, wantedExitCode int, called *bool) func() {
- oldExiter := exiter
- exiter = func(code int) {
- require.Equal(t, wantedExitCode, code, "unwanted exit code")
- *called = true
- }
- return func() { exiter = oldExiter }
-}
-
-func exitShouldNotCalled(t *testing.T) func() {
- oldExiter := exiter
- exiter = func(code int) {
- t.Errorf("exit should not have been called")
- }
- return func() { exiter = oldExiter }
-}
-
-func suppressOutput() func() {
- return captureAndRestoreOutput(nil, nil)
-}
-
-func captureAndRestoreOutput(out, err *string) func() {
- oldStdOut := stdOut
- oldStdErr := stdErr
-
- if out == nil {
- stdOut = ioutil.Discard
- } else {
- stdOut = trapWriter(out)
- }
- if err == nil {
- stdErr = ioutil.Discard
- } else {
- stdErr = trapWriter(err)
- }
-
- return func() {
- stdOut = oldStdOut
- stdErr = oldStdErr
- }
-}
-
-func trapWriter(writeTo *string) *writerTrap {
- return &writerTrap{
- buffer: bytes.NewBuffer(nil),
- writeTo: writeTo,
- }
-}
-
-type writerTrap struct {
- buffer *bytes.Buffer
- writeTo *string
-}
-
-func (w *writerTrap) Write(p []byte) (n int, err error) {
- n, err = w.buffer.Write(p)
- if err == nil {
- *(w.writeTo) = w.buffer.String()
- }
- return
-}
diff --git a/vendor/github.com/jawher/mow.cli/matchers.go b/vendor/github.com/jawher/mow.cli/matchers.go
deleted file mode 100644
index 11a8efc..0000000
--- a/vendor/github.com/jawher/mow.cli/matchers.go
+++ /dev/null
@@ -1,282 +0,0 @@
-package cli
-
-import (
- "fmt"
- "strings"
-)
-
-type upMatcher interface {
- match(args []string, c *parseContext) (bool, []string)
-}
-
-type upShortcut bool
-
-func (u upShortcut) match(args []string, c *parseContext) (bool, []string) {
- return true, args
-}
-
-func (u upShortcut) String() string {
- return "*"
-}
-
-type upOptsEnd bool
-
-func (u upOptsEnd) match(args []string, c *parseContext) (bool, []string) {
- c.rejectOptions = true
- return true, args
-}
-
-func (u upOptsEnd) String() string {
- return "--"
-}
-
-const (
- shortcut = upShortcut(true)
- optsEnd = upOptsEnd(true)
-)
-
-func (arg *arg) match(args []string, c *parseContext) (bool, []string) {
- if len(args) == 0 {
- return false, args
- }
- if !c.rejectOptions && strings.HasPrefix(args[0], "-") && args[0] != "-" {
- return false, args
- }
- c.args[arg] = append(c.args[arg], args[0])
- return true, args[1:]
-}
-
-type optMatcher struct {
- theOne *opt
- optionsIdx map[string]*opt
-}
-
-func (o *optMatcher) match(args []string, c *parseContext) (bool, []string) {
- if len(args) == 0 || c.rejectOptions {
- return o.theOne.valueSetFromEnv, args
- }
-
- idx := 0
- for idx < len(args) {
- arg := args[idx]
- switch {
- case arg == "-":
- idx++
- case arg == "--":
- return o.theOne.valueSetFromEnv, nil
- case strings.HasPrefix(arg, "--"):
- matched, consumed, nargs := o.matchLongOpt(args, idx, c)
-
- if matched {
- return true, nargs
- }
- if consumed == 0 {
- return o.theOne.valueSetFromEnv, args
- }
- idx += consumed
-
- case strings.HasPrefix(arg, "-"):
- matched, consumed, nargs := o.matchShortOpt(args, idx, c)
- if matched {
- return true, nargs
- }
- if consumed == 0 {
- return o.theOne.valueSetFromEnv, args
- }
- idx += consumed
-
- default:
- return o.theOne.valueSetFromEnv, args
- }
- }
- return o.theOne.valueSetFromEnv, args
-}
-
-func (o *optMatcher) matchLongOpt(args []string, idx int, c *parseContext) (bool, int, []string) {
- arg := args[idx]
- kv := strings.Split(arg, "=")
- name := kv[0]
- opt, found := o.optionsIdx[name]
- if !found {
- return false, 0, args
- }
-
- switch {
- case len(kv) == 2:
- if opt != o.theOne {
- return false, 1, args
- }
- value := kv[1]
- c.opts[o.theOne] = append(c.opts[o.theOne], value)
- return true, 1, removeStringAt(idx, args)
- case opt.isBool():
- if opt != o.theOne {
- return false, 1, args
- }
- c.opts[o.theOne] = append(c.opts[o.theOne], "true")
- return true, 1, removeStringAt(idx, args)
- default:
- if len(args[idx:]) < 2 {
- return false, 0, args
- }
- if opt != o.theOne {
- return false, 2, args
- }
- value := args[idx+1]
- if strings.HasPrefix(value, "-") {
- return false, 0, args
- }
- c.opts[o.theOne] = append(c.opts[o.theOne], value)
- return true, 2, removeStringsBetween(idx, idx+1, args)
- }
-}
-
-func (o *optMatcher) matchShortOpt(args []string, idx int, c *parseContext) (bool, int, []string) {
- arg := args[idx]
- if len(arg) < 2 {
- return false, 0, args
- }
-
- if strings.HasPrefix(arg[2:], "=") {
- name := arg[0:2]
- opt, _ := o.optionsIdx[name]
- if opt == o.theOne {
- value := arg[3:]
- if value == "" {
- return false, 0, args
- }
- c.opts[o.theOne] = append(c.opts[o.theOne], value)
- return true, 1, removeStringAt(idx, args)
- }
-
- return false, 1, args
- }
-
- rem := arg[1:]
-
- remIdx := 0
- for len(rem[remIdx:]) > 0 {
- name := "-" + rem[remIdx:remIdx+1]
-
- opt, found := o.optionsIdx[name]
- if !found {
- return false, 0, args
- }
-
- if opt.isBool() {
- if opt != o.theOne {
- remIdx++
- continue
- }
-
- c.opts[o.theOne] = append(c.opts[o.theOne], "true")
- newRem := rem[:remIdx] + rem[remIdx+1:]
- if newRem == "" {
- return true, 1, removeStringAt(idx, args)
- }
- return true, 0, replaceStringAt(idx, "-"+newRem, args)
- }
-
- value := rem[remIdx+1:]
- if value == "" {
- if len(args[idx+1:]) == 0 {
- return false, 0, args
- }
- if opt != o.theOne {
- return false, 2, args
- }
-
- value = args[idx+1]
- if strings.HasPrefix(value, "-") {
- return false, 0, args
- }
- c.opts[o.theOne] = append(c.opts[o.theOne], value)
-
- newRem := rem[:remIdx]
- if newRem == "" {
- return true, 2, removeStringsBetween(idx, idx+1, args)
- }
-
- nargs := replaceStringAt(idx, "-"+newRem, args)
-
- return true, 1, removeStringAt(idx+1, nargs)
- }
-
- if opt != o.theOne {
- return false, 1, args
- }
- c.opts[o.theOne] = append(c.opts[o.theOne], value)
- newRem := rem[:remIdx]
- if newRem == "" {
- return true, 1, removeStringAt(idx, args)
- }
- return true, 0, replaceStringAt(idx, "-"+newRem, args)
-
- }
-
- return false, 1, args
-}
-
-type optsMatcher struct {
- options []*opt
- optionsIndex map[string]*opt
-}
-
-func (om optsMatcher) try(args []string, c *parseContext) (bool, []string) {
- if len(args) == 0 || c.rejectOptions {
- return false, args
- }
- for _, o := range om.options {
- if _, exclude := c.excludedOpts[o]; exclude {
- continue
- }
- if ok, nargs := (&optMatcher{theOne: o, optionsIdx: om.optionsIndex}).match(args, c); ok {
- if o.valueSetFromEnv {
- c.excludedOpts[o] = struct{}{}
- }
- return true, nargs
- }
- }
- return false, args
-}
-
-func (om optsMatcher) match(args []string, c *parseContext) (bool, []string) {
- ok, nargs := om.try(args, c)
- if !ok {
- return false, args
- }
-
- for {
- ok, nnargs := om.try(nargs, c)
- if !ok {
- return true, nargs
- }
- nargs = nnargs
- }
-}
-
-func (om optsMatcher) String() string {
- return fmt.Sprintf("Opts(%v)", om.options)
-}
-
-func removeStringAt(idx int, arr []string) []string {
- res := make([]string, len(arr)-1)
- copy(res, arr[:idx])
- copy(res[idx:], arr[idx+1:])
- return res
-}
-
-func removeStringsBetween(from, to int, arr []string) []string {
- res := make([]string, len(arr)-(to-from+1))
- copy(res, arr[:from])
- copy(res[from:], arr[to+1:])
- return res
-}
-
-func replaceStringAt(idx int, with string, arr []string) []string {
- res := make([]string, len(arr))
- copy(res, arr[:idx])
- res[idx] = with
- copy(res[idx+1:], arr[idx+1:])
- return res
-}
diff --git a/vendor/github.com/jawher/mow.cli/matchers_test.go b/vendor/github.com/jawher/mow.cli/matchers_test.go
deleted file mode 100644
index 999b78c..0000000
--- a/vendor/github.com/jawher/mow.cli/matchers_test.go
+++ /dev/null
@@ -1,227 +0,0 @@
-package cli
-
-import (
- "testing"
-
- "time"
-
- "github.com/stretchr/testify/require"
-)
-
-func TestShortcut(t *testing.T) {
- pc := &parseContext{}
- args := []string{"a", "b"}
- ok, nargs := shortcut.match(args, pc)
- require.True(t, ok, "shortcut always matches")
- require.Equal(t, args, nargs, "shortcut doesn't touch the passed args")
-}
-
-func TestOptsEnd(t *testing.T) {
- pc := &parseContext{}
- args := []string{"a", "b"}
- ok, nargs := optsEnd.match(args, pc)
- require.True(t, ok, "optsEnd always matches")
- require.Equal(t, args, nargs, "optsEnd doesn't touch the passed args")
- require.True(t, pc.rejectOptions, "optsEnd sets the rejectOptions flag")
-}
-
-func TestArgMatcher(t *testing.T) {
- arg := &arg{name: "X"}
-
- {
- pc := newParseContext()
- args := []string{"a", "b"}
- ok, nargs := arg.match(args, &pc)
- require.True(t, ok, "arg should match")
- require.Equal(t, []string{"b"}, nargs, "arg should consume the matched value")
- require.Equal(t, []string{"a"}, pc.args[arg], "arg should stored the matched value")
- }
- {
- pc := newParseContext()
- ok, _ := arg.match([]string{"-v"}, &pc)
- require.False(t, ok, "arg should not match options")
- }
- {
- pc := newParseContext()
- pc.rejectOptions = true
- ok, _ := arg.match([]string{"-v"}, &pc)
- require.True(t, ok, "arg should match options when the reject flag is set")
- }
-}
-
-func TestBoolOptMatcher(t *testing.T) {
- forceOpt := &opt{names: []string{"-f", "--force"}, value: newBoolValue(new(bool), false)}
- optMatcher := &optMatcher{
- theOne: forceOpt,
- optionsIdx: map[string]*opt{
- "-f": forceOpt,
- "--force": forceOpt,
- "-g": {names: []string{"-g"}, value: newBoolValue(new(bool), false)},
- "-x": {names: []string{"-x"}, value: newBoolValue(new(bool), false)},
- "-y": {names: []string{"-y"}, value: newBoolValue(new(bool), false)},
- },
- }
- cases := []struct {
- args []string
- nargs []string
- val []string
- }{
- {[]string{"-f", "x"}, []string{"x"}, []string{"true"}},
- {[]string{"-f=true", "x"}, []string{"x"}, []string{"true"}},
- {[]string{"-f=false", "x"}, []string{"x"}, []string{"false"}},
- {[]string{"--force", "x"}, []string{"x"}, []string{"true"}},
- {[]string{"--force=true", "x"}, []string{"x"}, []string{"true"}},
- {[]string{"--force=false", "x"}, []string{"x"}, []string{"false"}},
- {[]string{"-fgxy", "x"}, []string{"-gxy", "x"}, []string{"true"}},
- {[]string{"-gfxy", "x"}, []string{"-gxy", "x"}, []string{"true"}},
- {[]string{"-gxfy", "x"}, []string{"-gxy", "x"}, []string{"true"}},
- {[]string{"-gxyf", "x"}, []string{"-gxy", "x"}, []string{"true"}},
- }
- for _, cas := range cases {
- t.Logf("Testing case: %#v", cas)
- pc := newParseContext()
- ok, nargs := optMatcher.match(cas.args, &pc)
- require.True(t, ok, "opt should match")
- require.Equal(t, cas.nargs, nargs, "opt should consume the option name")
- require.Equal(t, cas.val, pc.opts[forceOpt], "true should stored as the option's value")
-
- pc = newParseContext()
- pc.rejectOptions = true
- nok, _ := optMatcher.match(cas.args, &pc)
- require.False(t, nok, "opt shouldn't match when rejectOptions flag is set")
- }
-}
-
-func TestOptMatcher(t *testing.T) {
- names := []string{"-f", "--force"}
- opts := []*opt{
- {names: names, value: newStringValue(new(string), "")},
- {names: names, value: newIntValue(new(int), 0)},
- {names: names, value: newStringsValue(new([]string), nil)},
- {names: names, value: newIntsValue(new([]int), nil)},
- }
-
- cases := []struct {
- args []string
- nargs []string
- val []string
- }{
- {[]string{"-f", "x"}, []string{}, []string{"x"}},
- {[]string{"-f=x", "y"}, []string{"y"}, []string{"x"}},
- {[]string{"-fx", "y"}, []string{"y"}, []string{"x"}},
- {[]string{"-afx", "y"}, []string{"-a", "y"}, []string{"x"}},
- {[]string{"-af", "x", "y"}, []string{"-a", "y"}, []string{"x"}},
- {[]string{"--force", "x"}, []string{}, []string{"x"}},
- {[]string{"--force=x", "y"}, []string{"y"}, []string{"x"}},
- }
-
- for _, cas := range cases {
- for _, forceOpt := range opts {
- t.Logf("Testing case: %#v with opt: %#v", cas, forceOpt)
- optMatcher := &optMatcher{
- theOne: forceOpt,
- optionsIdx: map[string]*opt{
- "-f": forceOpt,
- "--force": forceOpt,
- "-a": {names: []string{"-a"}, value: newBoolValue(new(bool), false)},
- },
- }
-
- pc := newParseContext()
- ok, nargs := optMatcher.match(cas.args, &pc)
- require.True(t, ok, "opt %#v should match args %v, %v", forceOpt, cas.args, forceOpt.isBool())
- require.Equal(t, cas.nargs, nargs, "opt should consume the option name")
- require.Equal(t, cas.val, pc.opts[forceOpt], "true should stored as the option's value")
-
- pc = newParseContext()
- pc.rejectOptions = true
- nok, _ := optMatcher.match(cas.args, &pc)
- require.False(t, nok, "opt shouldn't match when rejectOptions flag is set")
- }
- }
-}
-
-func TestOptsMatcher(t *testing.T) {
- opts := optsMatcher{
- options: []*opt{
- {names: []string{"-f", "--force"}, value: newBoolValue(new(bool), false)},
- {names: []string{"-g", "--green"}, value: newStringValue(new(string), "")},
- },
- optionsIndex: map[string]*opt{},
- }
-
- for _, o := range opts.options {
- for _, n := range o.names {
- opts.optionsIndex[n] = o
- }
- }
-
- cases := []struct {
- args []string
- nargs []string
- val [][]string
- }{
- {[]string{"-f", "x"}, []string{"x"}, [][]string{{"true"}, nil}},
- {[]string{"-f=false", "y"}, []string{"y"}, [][]string{{"false"}, nil}},
- {[]string{"--force", "x"}, []string{"x"}, [][]string{{"true"}, nil}},
- {[]string{"--force=false", "y"}, []string{"y"}, [][]string{{"false"}, nil}},
-
- {[]string{"-g", "x"}, []string{}, [][]string{nil, {"x"}}},
- {[]string{"-g=x", "y"}, []string{"y"}, [][]string{nil, {"x"}}},
- {[]string{"-gx", "y"}, []string{"y"}, [][]string{nil, {"x"}}},
- {[]string{"--green", "x"}, []string{}, [][]string{nil, {"x"}}},
- {[]string{"--green=x", "y"}, []string{"y"}, [][]string{nil, {"x"}}},
-
- {[]string{"-f", "-g", "x", "y"}, []string{"y"}, [][]string{{"true"}, {"x"}}},
- {[]string{"-g", "x", "-f", "y"}, []string{"y"}, [][]string{{"true"}, {"x"}}},
- {[]string{"-fg", "x", "y"}, []string{"y"}, [][]string{{"true"}, {"x"}}},
- {[]string{"-fgxxx", "y"}, []string{"y"}, [][]string{{"true"}, {"xxx"}}},
- }
-
- for _, cas := range cases {
- t.Logf("testing with args %v", cas.args)
- pc := newParseContext()
- ok, nargs := opts.match(cas.args, &pc)
- require.True(t, ok, "opts should match")
- require.Equal(t, cas.nargs, nargs, "opts should consume the option name")
- for i, opt := range opts.options {
- require.Equal(t, cas.val[i], pc.opts[opt], "the option value for %v should be stored", opt)
- }
-
- pc = newParseContext()
- pc.rejectOptions = true
- nok, _ := opts.match(cas.args, &pc)
- require.False(t, nok, "opts shouldn't match when rejectOptions flag is set")
- }
-}
-
-// Issue 55
-func TestOptsMatcherInfiniteLoop(t *testing.T) {
- opts := optsMatcher{
- options: []*opt{
- {names: []string{"-g"}, value: newStringValue(new(string), ""), valueSetFromEnv: true},
- },
- optionsIndex: map[string]*opt{},
- }
-
- for _, o := range opts.options {
- for _, n := range o.names {
- opts.optionsIndex[n] = o
- }
- }
-
- done := make(chan struct{}, 1)
- pc := newParseContext()
- go func() {
- opts.match([]string{"-x"}, &pc)
- done <- struct{}{}
- }()
-
- select {
- case <-done:
- // nop, everything is good
- case <-time.After(5 * time.Second):
- t.Fatalf("Timed out after 5 seconds. Infinite loop in optsMatcher.")
- }
-
-}
diff --git a/vendor/github.com/jawher/mow.cli/options.go b/vendor/github.com/jawher/mow.cli/options.go
deleted file mode 100644
index 7d12226..0000000
--- a/vendor/github.com/jawher/mow.cli/options.go
+++ /dev/null
@@ -1,279 +0,0 @@
-package cli
-
-import (
- "flag"
- "fmt"
- "strings"
-)
-
-// BoolOpt describes a boolean option
-type BoolOpt struct {
- // A space separated list of the option names *WITHOUT* the dashes, e.g. `f force` and *NOT* `-f --force`.
- // The one letter names will then be called with a single dash (short option), the others with two (long options).
- Name string
- // The option description as will be shown in help messages
- Desc string
- // A space separated list of environment variables names to be used to initialize this option
- EnvVar string
- // The option's initial value
- Value bool
- // A boolean to display or not the current value of the option in the help message
- HideValue bool
- // Set to true if this option was set by the user (as opposed to being set from env or not set at all)
- SetByUser *bool
-}
-
-func (o BoolOpt) value() bool {
- return o.Value
-}
-
-// StringOpt describes a string option
-type StringOpt struct {
- // A space separated list of the option names *WITHOUT* the dashes, e.g. `f force` and *NOT* `-f --force`.
- // The one letter names will then be called with a single dash (short option), the others with two (long options).
- Name string
- // The option description as will be shown in help messages
- Desc string
- // A space separated list of environment variables names to be used to initialize this option
- EnvVar string
- // The option's initial value
- Value string
- // A boolean to display or not the current value of the option in the help message
- HideValue bool
- // Set to true if this option was set by the user (as opposed to being set from env or not set at all)
- SetByUser *bool
-}
-
-func (o StringOpt) value() string {
- return o.Value
-}
-
-// IntOpt describes an int option
-type IntOpt struct {
- // A space separated list of the option names *WITHOUT* the dashes, e.g. `f force` and *NOT* `-f --force`.
- // The one letter names will then be called with a single dash (short option), the others with two (long options).
- Name string
- // The option description as will be shown in help messages
- Desc string
- // A space separated list of environment variables names to be used to initialize this option
- EnvVar string
- // The option's initial value
- Value int
- // A boolean to display or not the current value of the option in the help message
- HideValue bool
- // Set to true if this option was set by the user (as opposed to being set from env or not set at all)
- SetByUser *bool
-}
-
-func (o IntOpt) value() int {
- return o.Value
-}
-
-// StringsOpt describes a string slice option
-type StringsOpt struct {
- // A space separated list of the option names *WITHOUT* the dashes, e.g. `f force` and *NOT* `-f --force`.
- // The one letter names will then be called with a single dash (short option), the others with two (long options).
- Name string
- // The option description as will be shown in help messages
- Desc string
- // A space separated list of environment variables names to be used to initialize this option.
- // The env variable should contain a comma separated list of values
- EnvVar string
- // The option's initial value
- Value []string
- // A boolean to display or not the current value of the option in the help message
- HideValue bool
- // Set to true if this option was set by the user (as opposed to being set from env or not set at all)
- SetByUser *bool
-}
-
-func (o StringsOpt) value() []string {
- return o.Value
-}
-
-// IntsOpt describes an int slice option
-type IntsOpt struct {
- // A space separated list of the option names *WITHOUT* the dashes, e.g. `f force` and *NOT* `-f --force`.
- // The one letter names will then be called with a single dash (short option), the others with two (long options).
- Name string
- // The option description as will be shown in help messages
- Desc string
- // A space separated list of environment variables names to be used to initialize this option.
- // The env variable should contain a comma separated list of values
- EnvVar string
- // The option's initial value
- Value []int
- // A boolean to display or not the current value of the option in the help message
- HideValue bool
- // Set to true if this option was set by the user (as opposed to being set from env or not set at all)
- SetByUser *bool
-}
-
-func (o IntsOpt) value() []int {
- return o.Value
-}
-
-// VarOpt describes an option where the type and format of the value is controlled by the developer
-type VarOpt struct {
- // A space separated list of the option names *WITHOUT* the dashes, e.g. `f force` and *NOT* `-f --force`.
- // The one letter names will then be called with a single dash (short option), the others with two (long options).
- Name string
- // The option description as will be shown in help messages
- Desc string
- // A space separated list of environment variables names to be used to initialize this option
- EnvVar string
- // A value implementing the flag.Value type (will hold the final value)
- Value flag.Value
- // A boolean to display or not the current value of the option in the help message
- HideValue bool
- // Set to true if this option was set by the user (as opposed to being set from env or not set at all)
- SetByUser *bool
-}
-
-func (o VarOpt) value() flag.Value {
- return o.Value
-}
-
-/*
-BoolOpt defines a boolean option on the command c named `name`, with an initial value of `value` and a description of `desc` which will be used in help messages.
-
-The name is a space separated list of the option names *WITHOUT* the dashes, e.g. `f force` and *NOT* `-f --force`.
-The one letter names will then be called with a single dash (short option), the others with two (long options).
-
-
-The result should be stored in a variable (a pointer to a bool) which will be populated when the app is run and the call arguments get parsed
-*/
-func (c *Cmd) BoolOpt(name string, value bool, desc string) *bool {
- return c.Bool(BoolOpt{
- Name: name,
- Value: value,
- Desc: desc,
- })
-}
-
-/*
-StringOpt defines a string option on the command c named `name`, with an initial value of `value` and a description of `desc` which will be used in help messages.
-
-The name is a space separated list of the option names *WITHOUT* the dashes, e.g. `f force` and *NOT* `-f --force`.
-The one letter names will then be called with a single dash (short option), the others with two (long options).
-
-
-The result should be stored in a variable (a pointer to a string) which will be populated when the app is run and the call arguments get parsed
-*/
-func (c *Cmd) StringOpt(name string, value string, desc string) *string {
- return c.String(StringOpt{
- Name: name,
- Value: value,
- Desc: desc,
- })
-}
-
-/*
-IntOpt defines an int option on the command c named `name`, with an initial value of `value` and a description of `desc` which will be used in help messages.
-
-The name is a space separated list of the option names *WITHOUT* the dashes, e.g. `f force` and *NOT* `-f --force`.
-The one letter names will then be called with a single dash (short option), the others with two (long options).
-
-
-The result should be stored in a variable (a pointer to an int) which will be populated when the app is run and the call arguments get parsed
-*/
-func (c *Cmd) IntOpt(name string, value int, desc string) *int {
- return c.Int(IntOpt{
- Name: name,
- Value: value,
- Desc: desc,
- })
-}
-
-/*
-StringsOpt defines a string slice option on the command c named `name`, with an initial value of `value` and a description of `desc` which will be used in help messages.
-
-The name is a space separated list of the option names *WITHOUT* the dashes, e.g. `f force` and *NOT* `-f --force`.
-The one letter names will then be called with a single dash (short option), the others with two (long options).
-
-
-The result should be stored in a variable (a pointer to a string slice) which will be populated when the app is run and the call arguments get parsed
-*/
-func (c *Cmd) StringsOpt(name string, value []string, desc string) *[]string {
- return c.Strings(StringsOpt{
- Name: name,
- Value: value,
- Desc: desc,
- })
-}
-
-/*
-IntsOpt defines an int slice option on the command c named `name`, with an initial value of `value` and a description of `desc` which will be used in help messages.
-
-The name is a space separated list of the option names *WITHOUT* the dashes, e.g. `f force` and *NOT* `-f --force`.
-The one letter names will then be called with a single dash (short option), the others with two (long options).
-
-
-The result should be stored in a variable (a pointer to an int slice) which will be populated when the app is run and the call arguments get parsed
-*/
-func (c *Cmd) IntsOpt(name string, value []int, desc string) *[]int {
- return c.Ints(IntsOpt{
- Name: name,
- Value: value,
- Desc: desc,
- })
-}
-
-/*
-VarOpt defines an option where the type and format is controlled by the developer.
-
-The name is a space separated list of the option names *WITHOUT* the dashes, e.g. `f force` and *NOT* `-f --force`.
-The one letter names will then be called with a single dash (short option), the others with two (long options).
-
-
-The result will be stored in the value parameter (a value implementing the flag.Value interface) which will be populated when the app is run and the call arguments get parsed
-*/
-func (c *Cmd) VarOpt(name string, value flag.Value, desc string) {
- c.mkOpt(opt{name: name, desc: desc, value: value})
-}
-
-type opt struct {
- name string
- desc string
- envVar string
- names []string
- hideValue bool
- valueSetFromEnv bool
- valueSetByUser *bool
- value flag.Value
-}
-
-func (o *opt) isBool() bool {
- if bf, ok := o.value.(boolValued); ok {
- return bf.IsBoolFlag()
- }
-
- return false
-}
-
-func (o *opt) String() string {
- return fmt.Sprintf("Opt(%v)", o.names)
-}
-
-func mkOptStrs(optName string) []string {
- res := strings.Fields(optName)
- for i, name := range res {
- prefix := "-"
- if len(name) > 1 {
- prefix = "--"
- }
- res[i] = prefix + name
- }
- return res
-}
-
-func (c *Cmd) mkOpt(opt opt) {
- opt.valueSetFromEnv = setFromEnv(opt.value, opt.envVar)
-
- opt.names = mkOptStrs(opt.name)
-
- c.options = append(c.options, &opt)
- for _, name := range opt.names {
- c.optionsIdx[name] = &opt
- }
-}
diff --git a/vendor/github.com/jawher/mow.cli/options_test.go b/vendor/github.com/jawher/mow.cli/options_test.go
deleted file mode 100644
index 7523120..0000000
--- a/vendor/github.com/jawher/mow.cli/options_test.go
+++ /dev/null
@@ -1,141 +0,0 @@
-package cli
-
-import (
- "os"
- "strconv"
- "testing"
-
- "github.com/stretchr/testify/require"
-)
-
-func TestStringOpt(t *testing.T) {
- cmd := &Cmd{optionsIdx: map[string]*opt{}}
- a := cmd.String(StringOpt{Name: "a", Value: "test", Desc: ""})
- require.Equal(t, "test", *a)
-
- os.Setenv("B", "")
- b := cmd.String(StringOpt{Name: "b", Value: "test", EnvVar: "B", Desc: ""})
- require.Equal(t, "test", *b)
-
- os.Setenv("B", "mow")
- b = cmd.String(StringOpt{Name: "b", Value: "test", EnvVar: "B", Desc: ""})
- require.Equal(t, "mow", *b)
-
- os.Setenv("B", "")
- os.Setenv("C", "cli")
- os.Setenv("D", "mow")
- b = cmd.String(StringOpt{Name: "b", Value: "test", EnvVar: "B C D", Desc: ""})
- require.Equal(t, "cli", *b)
-}
-
-func TestBoolOpt(t *testing.T) {
- cmd := &Cmd{optionsIdx: map[string]*opt{}}
- a := cmd.Bool(BoolOpt{Name: "a", Value: true, Desc: ""})
- require.True(t, *a)
-
- os.Setenv("B", "")
- b := cmd.Bool(BoolOpt{Name: "b", Value: false, EnvVar: "B", Desc: ""})
- require.False(t, *b)
-
- trueValues := []string{"1", "true", "TRUE"}
- for _, tv := range trueValues {
- os.Setenv("B", tv)
- b = cmd.Bool(BoolOpt{Name: "b", Value: false, EnvVar: "B", Desc: ""})
- require.True(t, *b, "env=%s", tv)
- }
-
- falseValues := []string{"0", "false", "FALSE", "xyz"}
- for _, tv := range falseValues {
- os.Setenv("B", tv)
- b = cmd.Bool(BoolOpt{Name: "b", Value: false, EnvVar: "B", Desc: ""})
- require.False(t, *b, "env=%s", tv)
- }
-
- os.Setenv("B", "")
- os.Setenv("C", "false")
- os.Setenv("D", "true")
- b = cmd.Bool(BoolOpt{Name: "b", Value: true, EnvVar: "B C D", Desc: ""})
- require.False(t, *b)
-}
-
-func TestIntOpt(t *testing.T) {
- cmd := &Cmd{optionsIdx: map[string]*opt{}}
- a := cmd.Int(IntOpt{Name: "a", Value: -1, Desc: ""})
- require.Equal(t, -1, *a)
-
- os.Setenv("B", "")
- b := cmd.Int(IntOpt{Name: "b", Value: -1, EnvVar: "B", Desc: ""})
- require.Equal(t, -1, *b)
-
- goodValues := []int{1, 0, 33}
- for _, tv := range goodValues {
- os.Setenv("B", strconv.Itoa(tv))
- b := cmd.Int(IntOpt{Name: "b", Value: -1, EnvVar: "B", Desc: ""})
- require.Equal(t, tv, *b, "env=%s", tv)
- }
-
- badValues := []string{"", "b", "q1", "_"}
- for _, tv := range badValues {
- os.Setenv("B", tv)
- b := cmd.Int(IntOpt{Name: "b", Value: -1, EnvVar: "B", Desc: ""})
- require.Equal(t, -1, *b, "env=%s", tv)
- }
-
- os.Setenv("B", "")
- os.Setenv("C", "42")
- os.Setenv("D", "666")
- b = cmd.Int(IntOpt{Name: "b", Value: -1, EnvVar: "B C D", Desc: ""})
- require.Equal(t, 42, *b)
-}
-
-func TestStringsOpt(t *testing.T) {
- cmd := &Cmd{optionsIdx: map[string]*opt{}}
- v := []string{"test"}
- a := cmd.Strings(StringsOpt{Name: "a", Value: v, Desc: ""})
- require.Equal(t, v, *a)
-
- os.Setenv("B", "")
- b := cmd.Strings(StringsOpt{Name: "b", Value: v, EnvVar: "B", Desc: ""})
- require.Equal(t, v, *b)
-
- os.Setenv("B", "mow")
- b = cmd.Strings(StringsOpt{Name: "b", Value: nil, EnvVar: "B", Desc: ""})
- require.Equal(t, []string{"mow"}, *b)
-
- os.Setenv("B", "mow, cli")
- b = cmd.Strings(StringsOpt{Name: "b", Value: nil, EnvVar: "B", Desc: ""})
- require.Equal(t, []string{"mow", "cli"}, *b)
-
- os.Setenv("B", "")
- os.Setenv("C", "test")
- os.Setenv("D", "xxx")
- b = cmd.Strings(StringsOpt{Name: "b", Value: nil, EnvVar: "B C D", Desc: ""})
- require.Equal(t, v, *b)
-}
-
-func TestIntsOpt(t *testing.T) {
- cmd := &Cmd{optionsIdx: map[string]*opt{}}
- vi := []int{42}
- a := cmd.Ints(IntsOpt{Name: "a", Value: vi, Desc: ""})
- require.Equal(t, vi, *a)
-
- os.Setenv("B", "")
- b := cmd.Ints(IntsOpt{Name: "b", Value: vi, EnvVar: "B", Desc: ""})
- require.Equal(t, vi, *b)
-
- os.Setenv("B", "666")
- b = cmd.Ints(IntsOpt{Name: "b", Value: nil, EnvVar: "B", Desc: ""})
- require.Equal(t, []int{666}, *b)
-
- os.Setenv("B", "1, 2 , 3")
- b = cmd.Ints(IntsOpt{Name: "b", Value: nil, EnvVar: "B", Desc: ""})
- require.Equal(t, []int{1, 2, 3}, *b)
-
- os.Setenv("B", "")
- os.Setenv("C", "abc")
- os.Setenv("D", "1, abc")
- os.Setenv("E", "42")
- os.Setenv("F", "666")
- b = cmd.Ints(IntsOpt{Name: "b", Value: nil, EnvVar: "B C D E F", Desc: ""})
- require.Equal(t, vi, *b)
-}
diff --git a/vendor/github.com/jawher/mow.cli/spec_n_parse_test.go b/vendor/github.com/jawher/mow.cli/spec_n_parse_test.go
deleted file mode 100644
index 240a2bf..0000000
--- a/vendor/github.com/jawher/mow.cli/spec_n_parse_test.go
+++ /dev/null
@@ -1,1315 +0,0 @@
-package cli
-
-import (
- "flag"
- "os"
- "strings"
-
- "github.com/stretchr/testify/assert"
- "github.com/stretchr/testify/require"
-
- "testing"
-)
-
-func okCmd(t *testing.T, spec string, init CmdInitializer, args []string) {
- defer suppressOutput()()
-
- cmd := &Cmd{
- name: "test",
- optionsIdx: map[string]*opt{},
- argsIdx: map[string]*arg{},
- }
- cmd.Spec = spec
- cmd.ErrorHandling = flag.ContinueOnError
- init(cmd)
-
- err := cmd.doInit()
- require.Nil(t, err, "should parse")
- t.Logf("testing spec %s with args: %v", spec, args)
- inFlow := &step{}
- err = cmd.parse(args, inFlow, inFlow, &step{})
- require.Nil(t, err, "cmd parse should't fail")
-}
-
-func failCmd(t *testing.T, spec string, init CmdInitializer, args []string) {
- defer suppressOutput()()
-
- cmd := &Cmd{
- name: "test",
- optionsIdx: map[string]*opt{},
- argsIdx: map[string]*arg{},
- }
- cmd.Spec = spec
- cmd.ErrorHandling = flag.ContinueOnError
- init(cmd)
-
- err := cmd.doInit()
- require.NoError(t, err, "should parse")
- t.Logf("testing spec %s with args: %v", spec, args)
- inFlow := &step{}
- err = cmd.parse(args, inFlow, inFlow, &step{})
- require.Error(t, err, "cmd parse should have failed")
-}
-
-func badSpec(t *testing.T, spec string, init CmdInitializer) {
- cmd := &Cmd{
- name: "test",
- optionsIdx: map[string]*opt{},
- argsIdx: map[string]*arg{},
- }
- cmd.Spec = spec
- cmd.ErrorHandling = flag.ContinueOnError
- init(cmd)
-
- t.Logf("testing bad spec %s", spec)
- err := cmd.doInit()
- require.NotNil(t, err, "Bad spec %s should have failed to parse", spec)
- t.Logf("Bad spec %s did fail to parse with error: %v", spec, err)
-}
-
-func TestSpecBoolOpt(t *testing.T) {
- var f *bool
- init := func(c *Cmd) {
- f = c.BoolOpt("f force", false, "")
- }
- spec := "-f"
-
- okCmd(t, spec, init, []string{"-f"})
- require.True(t, *f)
-
- okCmd(t, spec, init, []string{"--force"})
- require.True(t, *f)
-
- okCmd(t, spec, init, []string{"-f=true"})
- require.True(t, *f)
-
- okCmd(t, spec, init, []string{"--force=true"})
- require.True(t, *f)
-
- okCmd(t, spec, init, []string{"--force=false"})
- require.False(t, *f)
-
- badCases := [][]string{
- {},
- {"-g"},
- {"-f", "-g"},
- {"-g", "-f"},
- {"-f", "true"},
- {"-f", "xxx"},
- {"xxx", "-f"},
- }
- for _, args := range badCases {
- failCmd(t, spec, init, args)
- }
-}
-
-func TestDefaultSpec(t *testing.T) {
- var (
- a *bool
- b *string
- c *string
- )
-
- type call struct {
- args []string
- a bool
- b, c string
- }
- cases := []struct {
- init func(cmd *Cmd)
- calls []call
- }{
- {
- func(cmd *Cmd) {
- a = cmd.BoolOpt("a", false, "")
- b = cmd.StringOpt("b", "", "")
- c = cmd.StringArg("C", "", "")
- },
- []call{
- {[]string{"X"}, false, "", "X"},
- {[]string{"-a", "X"}, true, "", "X"},
- {[]string{"-b=Z", "X"}, false, "Z", "X"},
- {[]string{"-b=Z", "-a", "X"}, true, "Z", "X"},
- {[]string{"-a", "-b=Z", "X"}, true, "Z", "X"},
- },
- },
- }
-
- for _, cas := range cases {
- for _, cl := range cas.calls {
- okCmd(t, "", cas.init, cl.args)
- require.Equal(t, cl.a, *a)
- require.Equal(t, cl.b, *b)
- require.Equal(t, cl.c, *c)
- }
- }
-
-}
-
-func TestSpecOptFolding(t *testing.T) {
- var a, b, c *bool
- var d *string
- init := func(cmd *Cmd) {
- a = cmd.BoolOpt("a", false, "")
- b = cmd.BoolOpt("b", false, "")
- c = cmd.BoolOpt("c", false, "")
-
- d = cmd.StringOpt("d", "", "")
- }
-
- cases := []struct {
- spec string
- args []string
- a, b, c bool
- d string
- }{
- {
- "[-abcd]", []string{},
- false, false, false,
- "",
- },
- {
- "[-abcd]", []string{"-ab"},
- true, true, false,
- "",
- },
- {
- "[-abcd]", []string{"-ba"},
- true, true, false,
- "",
- },
-
- {
- "[-abcd]", []string{"-ad", "TEST"},
- true, false, false,
- "TEST",
- },
- {
- "[-abcd]", []string{"-adTEST"},
- true, false, false,
- "TEST",
- },
- {
- "[-abcd]", []string{"-abd", "TEST"},
- true, true, false,
- "TEST",
- },
- {
- "[-abcd]", []string{"-abdTEST"},
- true, true, false,
- "TEST",
- },
- {
- "[-abcd]", []string{"-abcd", "TEST"},
- true, true, true,
- "TEST",
- },
- {
- "[-abcd]", []string{"-bcd", "TEST"},
- false, true, true,
- "TEST",
- },
- {
- "[-abcd]", []string{"-cbd", "TEST"},
- false, true, true,
- "TEST",
- },
- {
- "[-abcd]", []string{"-ac"},
- true, false, true,
- "",
- },
- {
- "[-abcd]", []string{"-ca"},
- true, false, true,
- "",
- },
- {
- "[-abcd]", []string{"-cab"},
- true, true, true,
- "",
- },
- }
-
- for _, cas := range cases {
- okCmd(t, cas.spec, init, cas.args)
- require.Equal(t, cas.a, *a)
- require.Equal(t, cas.b, *b)
- require.Equal(t, cas.c, *c)
- require.Equal(t, cas.d, *d)
- }
-
-}
-
-func TestSpecStrOpt(t *testing.T) {
- var f *string
- init := func(c *Cmd) {
- f = c.StringOpt("f", "", "")
- }
- spec := "-f"
-
- cases := [][]string{
- {"-fValue"},
- {"-f", "Value"},
- {"-f=Value"},
- }
- for _, args := range cases {
- okCmd(t, spec, init, args)
- require.Equal(t, "Value", *f)
- }
-
- badCases := [][]string{
- {},
- {"-g"},
- {"-f", "-g"},
- {"-g", "-f"},
- {"-f", "xxx", "yyy"},
- {"xxx", "-f"},
- }
- for _, args := range badCases {
- failCmd(t, spec, init, args)
- }
-}
-
-func TestSpecIntOpt(t *testing.T) {
- var f *int
- init := func(c *Cmd) {
- f = c.IntOpt("f", -1, "")
- }
-
- spec := "-f"
- cases := [][]string{
- {"-f42"},
- {"-f", "42"},
- {"-f=42"},
- }
- for _, args := range cases {
- okCmd(t, spec, init, args)
- require.Equal(t, 42, *f)
- }
-
- badCases := [][]string{
- {},
- {"-f", "x"},
- {"-g"},
- {"-f", "-g"},
- {"-g", "-f"},
- {"-f", "xxx"},
- {"xxx", "-f"},
- }
- for _, args := range badCases {
- failCmd(t, spec, init, args)
- }
-}
-
-func TestSpecStrsOpt(t *testing.T) {
- var f *[]string
- init := func(c *Cmd) {
- f = c.StringsOpt("f", nil, "")
- }
- spec := "-f..."
- cases := [][]string{
- {"-fA"},
- {"-f", "A"},
- {"-f=A"},
- }
- for _, args := range cases {
- okCmd(t, spec, init, args)
- require.Equal(t, []string{"A"}, *f)
- }
-
- cases = [][]string{
- {"-fA", "-f", "B"},
- {"-f", "A", "-f", "B"},
- {"-f=A", "-fB"},
- }
- for _, args := range cases {
- okCmd(t, spec, init, args)
- require.Equal(t, []string{"A", "B"}, *f)
- }
-
- badCases := [][]string{
- {},
- {"-g"},
- {"-f", "-g"},
- {"-g", "-f"},
- {"-f", "xxx", "yyy"},
- {"xxx", "-f"},
- }
- for _, args := range badCases {
- failCmd(t, spec, init, args)
- }
-}
-
-func TestSpecIntsOpt(t *testing.T) {
- var f *[]int
- init := func(c *Cmd) {
- f = c.IntsOpt("f", nil, "")
- }
- spec := "-f..."
- cases := [][]string{
- {"-f1"},
- {"-f", "1"},
- {"-f=1"},
- }
- for _, args := range cases {
- okCmd(t, spec, init, args)
- require.Equal(t, []int{1}, *f)
- }
-
- cases = [][]string{
- {"-f1", "-f", "2"},
- {"-f", "1", "-f", "2"},
- {"-f=1", "-f2"},
- }
- for _, args := range cases {
- okCmd(t, spec, init, args)
- require.Equal(t, []int{1, 2}, *f)
- }
-
- badCases := [][]string{
- {},
- {"-f", "b"},
- {"-f", "3", "-f", "c"},
- {"-g"},
- {"-f", "-g"},
- {"-g", "-f"},
- {"-f", "xxx"},
- {"xxx", "-f"},
- }
- for _, args := range badCases {
- failCmd(t, spec, init, args)
- }
-}
-
-func TestSpecOptionalOpt(t *testing.T) {
- var f *bool
- init := func(c *Cmd) {
- f = c.BoolOpt("f", false, "")
- }
- spec := "[-f]"
- okCmd(t, "[-f]", init, []string{"-f"})
- require.True(t, *f)
-
- okCmd(t, spec, init, []string{})
- require.False(t, *f)
-
- badCases := [][]string{
- {"-g"},
- {"-f", "-g"},
- {"-g", "-f"},
- {"-f", "xxx"},
- {"xxx", "-f"},
- }
- for _, args := range badCases {
- failCmd(t, spec, init, args)
- }
-}
-
-func TestSpecArg(t *testing.T) {
- var s *string
- init := func(c *Cmd) {
- s = c.StringArg("ARG", "", "")
- }
- spec := "ARG"
- okCmd(t, spec, init, []string{"value"})
- require.Equal(t, "value", *s)
-
- badCases := [][]string{
- {},
- {"-g"},
- {"-f", "xxx"},
- {"xxx", "-f"},
- }
- for _, args := range badCases {
- failCmd(t, spec, init, args)
- }
-}
-
-func TestSpecOptionalArg(t *testing.T) {
- var s *string
- init := func(c *Cmd) {
- s = c.StringArg("ARG", "", "")
- }
- spec := "[ARG]"
-
- okCmd(t, spec, init, []string{"value"})
- require.Equal(t, "value", *s)
-
- okCmd(t, spec, init, []string{})
- require.Equal(t, "", *s)
-
- badCases := [][]string{
- {"-g"},
- {"-g", "-f"},
- {"-f", "xxx"},
- {"xxx", "-f"},
- }
- for _, args := range badCases {
- failCmd(t, spec, init, args)
- }
-
-}
-
-func TestSpecOptionChoice(t *testing.T) {
- var f, g *bool
- init := func(c *Cmd) {
- f = c.BoolOpt("f", false, "")
- g = c.BoolOpt("g", false, "")
- }
- spec := "-f|-g"
-
- okCmd(t, spec, init, []string{"-f"})
- require.True(t, *f)
- require.False(t, *g)
-
- okCmd(t, spec, init, []string{"-g"})
- require.False(t, *f)
- require.True(t, *g)
-
- badCases := [][]string{
- {},
- {"-f", "-g"},
- {"-f", "-s"},
- {"-g", "-f"},
- {"-f", "xxx"},
- {"xxx", "-f"},
- }
- for _, args := range badCases {
- failCmd(t, spec, init, args)
- }
-}
-
-func TestSpecOptional2OptionChoice(t *testing.T) {
- var f, g *bool
- init := func(c *Cmd) {
- f = c.BoolOpt("f", false, "")
- g = c.BoolOpt("g", false, "")
- }
- spec := "[-f|-g]"
-
- okCmd(t, spec, init, []string{})
- require.False(t, *f)
- require.False(t, *g)
-
- okCmd(t, spec, init, []string{"-f"})
- require.True(t, *f)
- require.False(t, *g)
-
- okCmd(t, spec, init, []string{"-g"})
- require.False(t, *f)
- require.True(t, *g)
-
- badCases := [][]string{
- {"-s"},
- {"-f", "-g"},
- {"-g", "-f"},
- {"-f", "xxx"},
- {"xxx", "-f"},
- }
- for _, args := range badCases {
- failCmd(t, spec, init, args)
- }
-}
-
-func TestSpecRepeatable2OptionChoice(t *testing.T) {
- var f, g *bool
- init := func(c *Cmd) {
- f = c.BoolOpt("f", false, "")
- g = c.BoolOpt("g", false, "")
- }
- spec := "(-f|-g)..."
-
- okCmd(t, spec, init, []string{"-f"})
- require.True(t, *f)
- require.False(t, *g)
-
- okCmd(t, spec, init, []string{"-g"})
- require.False(t, *f)
- require.True(t, *g)
-
- okCmd(t, spec, init, []string{"-f", "-g"})
- require.True(t, *f)
- require.True(t, *g)
-
- okCmd(t, spec, init, []string{"-g", "-f"})
- require.True(t, *f)
- require.True(t, *g)
-
- badCases := [][]string{
- {"-s"},
- {"-f", "xxx"},
- {"xxx", "-f"},
- }
- for _, args := range badCases {
- failCmd(t, spec, init, args)
- }
-}
-
-func TestSpecRepeatableOptional2OptionChoice(t *testing.T) {
- var f, g *bool
- init := func(c *Cmd) {
- f = c.BoolOpt("f", false, "")
- g = c.BoolOpt("g", false, "")
- }
- spec := "[-f|-g]..."
-
- okCmd(t, spec, init, []string{})
- require.False(t, *f)
- require.False(t, *g)
-
- okCmd(t, spec, init, []string{"-f"})
- require.True(t, *f)
- require.False(t, *g)
-
- okCmd(t, spec, init, []string{"-g"})
- require.False(t, *f)
- require.True(t, *g)
-
- okCmd(t, spec, init, []string{"-f", "-g"})
- require.True(t, *f)
- require.True(t, *g)
-
- okCmd(t, spec, init, []string{"-g", "-f"})
- require.True(t, *f)
- require.True(t, *g)
-
- badCases := [][]string{
- {"-s"},
- {"-f", "xxx"},
- {"xxx", "-f"},
- }
- for _, args := range badCases {
- failCmd(t, spec, init, args)
- }
-}
-
-func TestSpecOption3Choice(t *testing.T) {
- var f, g, h *bool
- init := func(c *Cmd) {
- f = c.BoolOpt("f", false, "")
- g = c.BoolOpt("g", false, "")
- h = c.BoolOpt("x", false, "")
- }
- spec := "-f|-g|-x"
-
- okCmd(t, spec, init, []string{"-f"})
- require.True(t, *f)
- require.False(t, *g)
- require.False(t, *h)
-
- okCmd(t, spec, init, []string{"-g"})
- require.False(t, *f)
- require.True(t, *g)
- require.False(t, *h)
-
- okCmd(t, spec, init, []string{"-x"})
- require.False(t, *f)
- require.False(t, *g)
- require.True(t, *h)
-}
-
-func TestSpecOptionalOption3Choice(t *testing.T) {
- var f, g, h *bool
- init := func(c *Cmd) {
- f = c.BoolOpt("f", false, "")
- g = c.BoolOpt("g", false, "")
- h = c.BoolOpt("x", false, "")
- }
- spec := "[-f|-g|-x]"
-
- okCmd(t, spec, init, []string{})
- require.False(t, *f)
- require.False(t, *g)
- require.False(t, *h)
-
- okCmd(t, spec, init, []string{"-f"})
- require.True(t, *f)
- require.False(t, *g)
- require.False(t, *h)
-
- okCmd(t, spec, init, []string{"-g"})
- require.False(t, *f)
- require.True(t, *g)
- require.False(t, *h)
-
- okCmd(t, spec, init, []string{"-x"})
- require.False(t, *f)
- require.False(t, *g)
- require.True(t, *h)
-}
-
-func TestSpecC1(t *testing.T) {
- var f, g *bool
- init := func(c *Cmd) {
- f = c.BoolOpt("f", false, "")
- g = c.BoolOpt("g", false, "")
- }
- spec := "-f|-g..."
- // spec = "[-f|-g...]"
-
- okCmd(t, spec, init, []string{"-f"})
- require.True(t, *f)
- require.False(t, *g)
-
- okCmd(t, spec, init, []string{"-g"})
- require.False(t, *f)
- require.True(t, *g)
-
- okCmd(t, spec, init, []string{"-g", "-g"})
- require.False(t, *f)
- require.True(t, *g)
-}
-
-func TestSpecC2(t *testing.T) {
- var f, g *bool
- init := func(c *Cmd) {
- f = c.BoolOpt("f", false, "")
- g = c.BoolOpt("g", false, "")
- }
- spec := "[-f|-g...]"
-
- okCmd(t, spec, init, []string{})
- require.False(t, *f)
- require.False(t, *g)
-
- okCmd(t, spec, init, []string{"-f"})
- require.True(t, *f)
- require.False(t, *g)
-
- okCmd(t, spec, init, []string{"-g"})
- require.False(t, *f)
- require.True(t, *g)
-
- okCmd(t, spec, init, []string{"-g", "-g"})
- require.False(t, *f)
- require.True(t, *g)
-}
-
-func TestSpecCpCase(t *testing.T) {
- var f, g *[]string
- init := func(c *Cmd) {
- f = c.StringsArg("SRC", nil, "")
- g = c.StringsArg("DST", nil, "")
- }
- spec := "SRC... DST"
-
- okCmd(t, spec, init, []string{"A", "B"})
- require.Equal(t, []string{"A"}, *f)
- require.Equal(t, []string{"B"}, *g)
-
- okCmd(t, spec, init, []string{"A", "B", "C"})
- require.Equal(t, []string{"A", "B"}, *f)
- require.Equal(t, []string{"C"}, *g)
-
- okCmd(t, spec, init, []string{"A", "B", "C", "D"})
- require.Equal(t, []string{"A", "B", "C"}, *f)
- require.Equal(t, []string{"D"}, *g)
-}
-
-func TestSpecC3(t *testing.T) {
- var f, g *[]string
- init := func(c *Cmd) {
- f = c.StringsArg("SRC", nil, "")
- g = c.StringsArg("DST", nil, "")
- }
- spec := "(SRC... DST) | SRC"
-
- okCmd(t, spec, init, []string{"A"})
- require.Equal(t, []string{"A"}, *f)
- require.Equal(t, 0, len(*g))
-
- okCmd(t, spec, init, []string{"A", "B"})
- require.Equal(t, []string{"A"}, *f)
- require.Equal(t, []string{"B"}, *g)
-
- okCmd(t, spec, init, []string{"A", "B", "C"})
- require.Equal(t, []string{"A", "B"}, *f)
- require.Equal(t, []string{"C"}, *g)
-
- okCmd(t, spec, init, []string{"A", "B", "C", "D"})
- require.Equal(t, []string{"A", "B", "C"}, *f)
- require.Equal(t, []string{"D"}, *g)
-}
-
-func TestSpecC5(t *testing.T) {
- var f, g *[]string
- var x *bool
- init := func(c *Cmd) {
- f = c.StringsArg("SRC", nil, "")
- g = c.StringsArg("DST", nil, "")
- x = c.BoolOpt("x", false, "")
- }
- spec := "(SRC... -x DST) | (SRC... DST)"
-
- okCmd(t, spec, init, []string{"A", "B"})
- require.Equal(t, []string{"A"}, *f)
- require.Equal(t, []string{"B"}, *g)
- require.False(t, *x)
-
- okCmd(t, spec, init, []string{"A", "B", "C"})
- require.Equal(t, []string{"A", "B"}, *f)
- require.Equal(t, []string{"C"}, *g)
- require.False(t, *x)
-
- okCmd(t, spec, init, []string{"A", "B", "-x", "C"})
- require.Equal(t, []string{"A", "B"}, *f)
- require.Equal(t, []string{"C"}, *g)
- require.True(t, *x)
-
-}
-
-func TestSpecOptionsEndExplicit(t *testing.T) {
- var x *[]string
- init := func(c *Cmd) {
- x = c.StringsArg("X", nil, "")
- }
- spec := "-- X..."
-
- okCmd(t, spec, init, []string{"A"})
- require.Equal(t, []string{"A"}, *x)
-
- okCmd(t, spec, init, []string{"--", "A"})
- require.Equal(t, []string{"A"}, *x)
-
- okCmd(t, spec, init, []string{"--", "-x"})
- require.Equal(t, []string{"-x"}, *x)
-
- okCmd(t, spec, init, []string{"--", "A", "B"})
- require.Equal(t, []string{"A", "B"}, *x)
-}
-
-func TestSpecOptionsEndImplicit(t *testing.T) {
- var x *[]string
- var f *bool
- init := func(c *Cmd) {
- x = c.StringsArg("X", nil, "")
- f = c.BoolOpt("f", false, "")
- }
- spec := "-f|X..."
-
- okCmd(t, spec, init, []string{"A"})
- require.Equal(t, []string{"A"}, *x)
-
- okCmd(t, spec, init, []string{"--", "A"})
- require.Equal(t, []string{"A"}, *x)
-
- okCmd(t, spec, init, []string{"--", "-f"})
- require.Equal(t, []string{"-f"}, *x)
-
- okCmd(t, spec, init, []string{"-f"})
- require.True(t, *f)
-}
-
-func TestSpecChoiceWithOptionsEndInLastPos(t *testing.T) {
- var x *[]string
- var f *bool
- init := func(c *Cmd) {
- x = c.StringsArg("X", nil, "")
- f = c.BoolOpt("f", false, "")
- }
- spec := "-f|(-- X...)"
-
- okCmd(t, spec, init, []string{"A", "B"})
- require.Equal(t, []string{"A", "B"}, *x)
-
- okCmd(t, spec, init, []string{"--", "-f", "B"})
- require.Equal(t, []string{"-f", "B"}, *x)
-
- okCmd(t, spec, init, []string{"--", "A", "B"})
- require.Equal(t, []string{"A", "B"}, *x)
-
- okCmd(t, spec, init, []string{"-f"})
- require.True(t, *f)
-}
-
-func TestSpecChoiceWithOptionsEnd(t *testing.T) {
- var x *[]string
- var f *bool
- init := func(c *Cmd) {
- x = c.StringsArg("X", nil, "")
- f = c.BoolOpt("f", false, "")
- }
- spec := "(-- X...)|-f"
-
- badSpec(t, spec, init)
-}
-
-func TestSpecOptionAfterOptionsEnd(t *testing.T) {
- var x *[]string
- var f *bool
- init := func(c *Cmd) {
- x = c.StringsArg("X", nil, "")
- f = c.BoolOpt("f", false, "")
- }
-
- spec := "-- X... -f"
- badSpec(t, spec, init)
-}
-
-func TestSpecOptionAfterOptionsEndInAChoice(t *testing.T) {
- var x *[]string
- var f, d *bool
- init := func(c *Cmd) {
- x = c.StringsArg("X", nil, "")
- f = c.BoolOpt("f", false, "")
- d = c.BoolOpt("d", false, "")
- }
-
- spec := "-f | (-- X...) -d"
- badSpec(t, spec, init)
-}
-
-func TestSpecOptionAfterOptionalOptionsEnd(t *testing.T) {
- init := func(c *Cmd) {
- c.StringsArg("X", nil, "")
- c.BoolOpt("f", false, "")
- c.BoolOpt("d", false, "")
- }
-
- spec := "-f [-- X] -d"
- badSpec(t, spec, init)
-}
-
-func TestSpecOptionAfterOptionalOptionsEndInAChoice(t *testing.T) {
- init := func(c *Cmd) {
- c.StringsArg("X", nil, "")
- c.BoolOpt("f", false, "")
- c.BoolOpt("d", false, "")
- }
-
- spec := "(-f | [-- X]) -d"
- badSpec(t, spec, init)
-}
-
-func TestSpecOptionAfterOptionsEndIsParsedAsArg(t *testing.T) {
- init := func(c *Cmd) {
- c.StringArg("CMD", "", "")
- c.StringsArg("ARG", nil, "")
- }
-
- spec := "-- CMD [ARG...]"
- cases := [][]string{
- {"ls"},
- {"ls", "-l"},
- {"ls", "--test"},
- {"ls", "--test=true"},
- {"ls", "--test", "-f"},
- }
-
- for _, cas := range cases {
- okCmd(t, spec, init, cas)
- }
-}
-
-func TestSpecSingleDash(t *testing.T) {
- var path *string
- var f *bool
-
- init := func(c *Cmd) {
- path = c.StringArg("PATH", "", "'-' can be used to read from stdin' ")
- f = c.BoolOpt("f", false, "")
- }
-
- spec := "[-f] PATH"
-
- okCmd(t, spec, init, []string{"TEST"})
- require.Equal(t, "TEST", *path)
- require.False(t, *f)
-
- okCmd(t, spec, init, []string{"-f", "TEST"})
- require.Equal(t, "TEST", *path)
- require.True(t, *f)
-
- okCmd(t, spec, init, []string{"-"})
- require.Equal(t, "-", *path)
- require.False(t, *f)
-
- okCmd(t, spec, init, []string{"-f", "-"})
- require.Equal(t, "-", *path)
- require.True(t, *f)
-
- okCmd(t, spec, init, []string{"--", "-"})
- require.Equal(t, "-", *path)
- require.False(t, *f)
-
- okCmd(t, spec, init, []string{"-f", "--", "-"})
- require.Equal(t, "-", *path)
- require.True(t, *f)
-}
-
-func TestSpecOptOrdering(t *testing.T) {
- var a, b, c *bool
- var d, e, f *string
-
- init := func(cmd *Cmd) {
- a = cmd.BoolOpt("a", false, "")
- b = cmd.BoolOpt("b", false, "")
- c = cmd.BoolOpt("c", false, "")
- d = cmd.StringOpt("d", "", "")
-
- e = cmd.StringArg("E", "", "")
- f = cmd.StringArg("F", "", "")
- }
-
- cases := []struct {
- spec string
- args []string
- a, b, c bool
- d, e, f string
- }{
- {
- "-a -b",
- []string{"-a", "-b"},
- true, true, false,
- "", "", "",
- },
- {
- "-a -b",
- []string{"-b", "-a"},
- true, true, false,
- "", "", "",
- },
-
- {
- "-a [-b]",
- []string{"-a"},
- true, false, false,
- "", "", "",
- },
- {
- "-a [-b]",
- []string{"-b", "-a"},
- true, true, false,
- "", "", "",
- },
- {
- "-a [-b]",
- []string{"-b", "-a"},
- true, true, false,
- "", "", "",
- },
-
- {
- "[-a -b]",
- []string{"-a", "-b"},
- true, true, false,
- "", "", "",
- },
- {
- "[-a -b]",
- []string{"-b", "-a"},
- true, true, false,
- "", "", "",
- },
-
- {
- "[-a [-b]]",
- []string{"-a"},
- true, false, false,
- "", "", "",
- },
- {
- "[-a [-b]]",
- []string{"-a", "-b"},
- true, true, false,
- "", "", "",
- },
- {
- "[-a [-b]]",
- []string{"-b", "-a"},
- true, true, false,
- "", "", "",
- },
-
- {
- "-a | -b -c",
- []string{"-a", "-c"},
- true, false, true,
- "", "", "",
- },
- {
- "-a | -b -c",
- []string{"-c", "-a"},
- true, false, true,
- "", "", "",
- },
- {
- "-a | -b -c",
- []string{"-b", "-c"},
- false, true, true,
- "", "", "",
- },
- {
- "-a | -b -c",
- []string{"-c", "-b"},
- false, true, true,
- "", "", "",
- },
-
- {
- "(-a | -b) (-c | -d)",
- []string{"-a", "-c"},
- true, false, true,
- "", "", "",
- },
- {
- "(-a | -b) (-c | -d)",
- []string{"-c", "-a"},
- true, false, true,
- "", "", "",
- },
-
- {
- "(-a | -b) [-c | -d]",
- []string{"-a"},
- true, false, false,
- "", "", "",
- },
- {
- "(-a | -b) [-c | -d]",
- []string{"-a", "-c"},
- true, false, true,
- "", "", "",
- },
- {
- "(-a | -b) [-c | -d]",
- []string{"-d=X", "-b"},
- false, true, false,
- "X", "", "",
- },
-
- {
- "-a -b E -c -d",
- []string{"-a", "-b", "E", "-c", "-d", "D"},
- true, true, true,
- "D", "E", "",
- },
-
- {
- "-a -b E -c -d",
- []string{"-a", "-b", "E", "-c", "-d", "D"},
- true, true, true,
- "D", "E", "",
- },
- {
- "-a -b E -c -d",
- []string{"-b", "-a", "E", "-c", "-d", "D"},
- true, true, true,
- "D", "E", "",
- },
- {
- "-a -b E -c -d",
- []string{"-a", "-b", "E", "-d", "D", "-c"},
- true, true, true,
- "D", "E", "",
- },
-
- {
- "-a -d...",
- []string{"-a", "-d", "1"},
- true, false, false,
- "1", "", "",
- },
- {
- "-a -d...",
- []string{"-d", "1", "-d", "2", "-a"},
- true, false, false,
- "2", "", "",
- },
- }
-
- for _, cas := range cases {
- okCmd(t, cas.spec, init, cas.args)
- require.Equal(t, cas.a, *a)
- require.Equal(t, cas.b, *b)
- require.Equal(t, cas.c, *c)
- require.Equal(t, cas.d, *d)
- require.Equal(t, cas.e, *e)
- require.Equal(t, cas.f, *f)
- }
-
-}
-
-func TestSpecOptInlineValue(t *testing.T) {
- var f, g, x *string
- var y *[]string
- init := func(c *Cmd) {
- f = c.StringOpt("f", "", "")
- g = c.StringOpt("giraffe", "", "")
- x = c.StringOpt("x", "", "")
- y = c.StringsOpt("y", nil, "")
- }
- spec := "-x= [ -f= | --giraffe= ] -y=..."
-
- okCmd(t, spec, init, []string{"-x=a", "-y=b"})
- require.Equal(t, "a", *x)
- require.Equal(t, []string{"b"}, *y)
-
- okCmd(t, spec, init, []string{"-x=a", "-y=b", "-y=c"})
- require.Equal(t, "a", *x)
- require.Equal(t, []string{"b", "c"}, *y)
-
- okCmd(t, spec, init, []string{"-x=a", "-f=f", "-y=b"})
- require.Equal(t, "a", *x)
- require.Equal(t, "f", *f)
- require.Equal(t, []string{"b"}, *y)
-
- okCmd(t, spec, init, []string{"-x=a", "--giraffe=g", "-y=b"})
- require.Equal(t, "a", *x)
- require.Equal(t, "g", *g)
- require.Equal(t, []string{"b"}, *y)
-}
-
-// https://github.com/jawher/mow.cli/issues/28
-func TestWardDoesntRunTooSlowly(t *testing.T) {
- init := func(cmd *Cmd) {
- _ = cmd.StringOpt("login", "", "Login for credential, e.g. username or email.")
- _ = cmd.StringOpt("realm", "", "Realm for credential, e.g. website or WiFi AP name.")
- _ = cmd.StringOpt("note", "", "Note for credential.")
- _ = cmd.BoolOpt("no-copy", false, "Do not copy generated password to the clipboard.")
- _ = cmd.BoolOpt("gen", false, "Generate a password.")
- _ = cmd.IntOpt("length", 0, "Password length.")
- _ = cmd.IntOpt("min-length", 30, "Minimum length password.")
- _ = cmd.IntOpt("max-length", 40, "Maximum length password.")
- _ = cmd.BoolOpt("no-upper", false, "Exclude uppercase characters in password.")
- _ = cmd.BoolOpt("no-lower", false, "Exclude lowercase characters in password.")
- _ = cmd.BoolOpt("no-digit", false, "Exclude digit characters in password.")
- _ = cmd.BoolOpt("no-symbol", false, "Exclude symbol characters in password.")
- _ = cmd.BoolOpt("no-similar", false, "Exclude similar characters in password.")
- _ = cmd.IntOpt("min-upper", 0, "Minimum number of uppercase characters in password.")
- _ = cmd.IntOpt("max-upper", -1, "Maximum number of uppercase characters in password.")
- _ = cmd.IntOpt("min-lower", 0, "Minimum number of lowercase characters in password.")
- _ = cmd.IntOpt("max-lower", -1, "Maximum number of lowercase characters in password.")
- _ = cmd.IntOpt("min-digit", 0, "Minimum number of digit characters in password.")
- _ = cmd.IntOpt("max-digit", -1, "Maximum number of digit characters in password.")
- _ = cmd.IntOpt("min-symbol", 0, "Minimum number of symbol characters in password.")
- _ = cmd.IntOpt("max-symbol", -1, "Maximum number of symbol characters in password.")
- _ = cmd.StringOpt("exclude", "", "Exclude specific characters from password.")
- }
-
- spec := "[--login] [--realm] [--note] [--no-copy] [--gen [--length] [--min-length] [--max-length] [--no-upper] [--no-lower] [--no-digit] [--no-symbol] [--no-similar] [--min-upper] [--max-upper] [--min-lower] [--max-lower] [--min-digit] [--max-digit] [--min-symbol] [--max-symbol] [--exclude]]"
-
- okCmd(t, spec, init, []string{})
- okCmd(t, spec, init, []string{"--gen", "--length", "42"})
- okCmd(t, spec, init, []string{"--length", "42", "--gen"})
- okCmd(t, spec, init, []string{"--min-length", "10", "--length", "42", "--gen"})
- okCmd(t, spec, init, []string{"--min-length", "10", "--no-symbol", "--no-lower", "--length", "42", "--gen"})
-
-}
-
-func TestEnvOverrideOk(t *testing.T) {
- defer os.Unsetenv("envopt")
-
- cases := []struct {
- setenv bool
- spec string
- args []string
- envval string
- }{
- // pickup the value from the environment variable
- {true, "--envopt --other", []string{"--other", "otheropt"}, "fromenv"},
- {true, "[--envopt] --other", []string{"--other", "otheropt"}, "fromenv"},
- {true, "--envopt", []string{}, "fromenv"},
- {true, "--envopt", []string{"--"}, "fromenv"},
-
- // override on command line
- {true, "--envopt", []string{"-e", "fromopt"}, "fromopt"},
- {true, "--envopt", []string{"--envopt", "fromopt"}, "fromopt"},
-
- // no env set
- {false, "--envopt", []string{"--envopt", "fromopt"}, "fromopt"},
- {false, "--envopt", []string{"-e", "fromopt"}, "fromopt"},
-
- // no env var, fallback to default
- {false, "[--envopt]", []string{}, "envdefault"},
- {false, "[--envopt] --other", []string{"--other", "otheropt"}, "envdefault"},
- }
-
- for _, cas := range cases {
- var envopt *string
- var otheropt *string
-
- init := func(c *Cmd) {
- os.Unsetenv("envopt")
- if cas.setenv {
- os.Setenv("envopt", "fromenv")
- }
- envopt = c.String(StringOpt{
- Name: "e envopt",
- Value: "envdefault",
- EnvVar: "envopt",
- })
- if strings.Contains(cas.spec, "other") {
- otheropt = c.StringOpt("o other", "", "")
- }
- }
- okCmd(t, cas.spec, init, cas.args)
- if strings.Contains(cas.spec, "other") {
- // if the test spec defined --other, make sure it was actually set
- assert.Equal(t, "otheropt", *otheropt)
- }
- // ensure --envopt was actually set to the test's expectations
- assert.Equal(t, cas.envval, *envopt)
- }
-}
-
-// Anti-regression test for infinite loop case with envvar backed opts
-// https://github.com/jawher/mow.cli/pull/49
-func TestEnvOptSeq(t *testing.T) {
- defer os.Unsetenv("envopt")
-
- var envopt *string
- var arg *string
-
- init := func(c *Cmd) {
- defer os.Unsetenv("envopt")
-
- envopt = c.String(StringOpt{
- Name: "e envopt",
- Value: "envdefault",
- EnvVar: "envopt",
- })
-
- arg = c.StringArg("ARG", "", "")
- }
-
- os.Setenv("envopt", "envval")
- okCmd(t, "", init, []string{"argval"})
-
- assert.Equal(t, "envval", *envopt)
- assert.Equal(t, "argval", *arg)
-}
-
-// Test that not setting an environment variable correctly causes
-// required options to fail if no value is supplied in args.
-func TestEnvOverrideFail(t *testing.T) {
- os.Unsetenv("envopt")
-
- cases := []struct {
- spec string
- args []string
- envval string
- }{
- // no env var, not optional; should fail
- {"--envopt", []string{}, ""},
- {"--envopt --other", []string{"--other", "otheropt"}, ""},
- }
-
- for _, cas := range cases {
- var envopt *string
- var otheropt *string
-
- init := func(c *Cmd) {
- envopt = c.String(StringOpt{
- Name: "e envopt",
- Value: "envdefault",
- EnvVar: "envopt",
- })
- if strings.Contains(cas.spec, "other") {
- otheropt = c.StringOpt("o other", "", "")
- }
- }
- failCmd(t, cas.spec, init, cas.args)
- }
-}
diff --git a/vendor/github.com/jawher/mow.cli/spec_parser.go b/vendor/github.com/jawher/mow.cli/spec_parser.go
deleted file mode 100644
index 2042008..0000000
--- a/vendor/github.com/jawher/mow.cli/spec_parser.go
+++ /dev/null
@@ -1,243 +0,0 @@
-package cli
-
-import "fmt"
-
-func uParse(c *Cmd) (*state, error) {
- tokens, err := uTokenize(c.Spec)
- if err != nil {
- return nil, err
- }
-
- p := &uParser{cmd: c, tokens: tokens}
- return p.parse()
-}
-
-type uParser struct {
- cmd *Cmd
- tokens []*uToken
-
- tkpos int
-
- matchedToken *uToken
-
- rejectOptions bool
-}
-
-func (p *uParser) parse() (s *state, err error) {
- defer func() {
- if v := recover(); v != nil {
- pos := len(p.cmd.Spec)
- if !p.eof() {
- pos = p.token().pos
- }
- s = nil
- switch t, ok := v.(string); ok {
- case true:
- err = &parseError{p.cmd.Spec, t, pos}
- default:
- panic(v)
- }
- }
- }()
- err = nil
- var e *state
- s, e = p.seq(false)
- if !p.eof() {
- s = nil
- err = &parseError{p.cmd.Spec, "Unexpected input", p.token().pos}
- return
- }
-
- e.terminal = true
- s.simplify()
- return
-}
-
-func (p *uParser) seq(required bool) (*state, *state) {
- start := newState(p.cmd)
- end := start
-
- appendComp := func(s, e *state) {
- for _, tr := range s.transitions {
- end.t(tr.matcher, tr.next)
- }
- end = e
- }
-
- if required {
- s, e := p.choice()
- appendComp(s, e)
- }
- for p.canAtom() {
- s, e := p.choice()
- appendComp(s, e)
- }
-
- return start, end
-}
-
-func (p *uParser) choice() (*state, *state) {
- start, end := newState(p.cmd), newState(p.cmd)
-
- add := func(s, e *state) {
- start.t(shortcut, s)
- e.t(shortcut, end)
- }
-
- add(p.atom())
- for p.found(utChoice) {
- add(p.atom())
- }
- return start, end
-}
-
-func (p *uParser) atom() (*state, *state) {
- start := newState(p.cmd)
- var end *state
- switch {
- case p.eof():
- panic("Unexpected end of input")
- case p.found(utPos):
- name := p.matchedToken.val
- arg, declared := p.cmd.argsIdx[name]
- if !declared {
- p.back()
- panic(fmt.Sprintf("Undeclared arg %s", name))
- }
- end = start.t(arg, newState(p.cmd))
- case p.found(utOptions):
- if p.rejectOptions {
- p.back()
- panic("No options after --")
- }
- end = newState(p.cmd)
- start.t(optsMatcher{options: p.cmd.options, optionsIndex: p.cmd.optionsIdx}, end)
- case p.found(utShortOpt):
- if p.rejectOptions {
- p.back()
- panic("No options after --")
- }
- name := p.matchedToken.val
- opt, declared := p.cmd.optionsIdx[name]
- if !declared {
- p.back()
- panic(fmt.Sprintf("Undeclared option %s", name))
- }
- end = start.t(&optMatcher{
- theOne: opt,
- optionsIdx: p.cmd.optionsIdx,
- }, newState(p.cmd))
- p.found(utOptValue)
- case p.found(utLongOpt):
- if p.rejectOptions {
- p.back()
- panic("No options after --")
- }
- name := p.matchedToken.val
- opt, declared := p.cmd.optionsIdx[name]
- if !declared {
- p.back()
- panic(fmt.Sprintf("Undeclared option %s", name))
- }
- end = start.t(&optMatcher{
- theOne: opt,
- optionsIdx: p.cmd.optionsIdx,
- }, newState(p.cmd))
- p.found(utOptValue)
- case p.found(utOptSeq):
- if p.rejectOptions {
- p.back()
- panic("No options after --")
- }
- end = newState(p.cmd)
- sq := p.matchedToken.val
- opts := []*opt{}
- for i := range sq {
- sn := sq[i : i+1]
- opt, declared := p.cmd.optionsIdx["-"+sn]
- if !declared {
- p.back()
- panic(fmt.Sprintf("Undeclared option %s", sn))
- }
- opts = append(opts, opt)
- }
- start.t(optsMatcher{options: opts, optionsIndex: p.cmd.optionsIdx}, end)
- case p.found(utOpenPar):
- start, end = p.seq(true)
- p.expect(utClosePar)
- case p.found(utOpenSq):
- start, end = p.seq(true)
- start.t(shortcut, end)
- p.expect(utCloseSq)
- case p.found(utDoubleDash):
- p.rejectOptions = true
- end = start.t(optsEnd, newState(p.cmd))
- return start, end
- default:
- panic("Unexpected input: was expecting a command or a positional argument or an option")
- }
- if p.found(utRep) {
- end.t(shortcut, start)
- }
- return start, end
-}
-
-func (p *uParser) canAtom() bool {
- switch {
- case p.is(utPos):
- return true
- case p.is(utOptions):
- return true
- case p.is(utShortOpt):
- return true
- case p.is(utLongOpt):
- return true
- case p.is(utOptSeq):
- return true
- case p.is(utOpenPar):
- return true
- case p.is(utOpenSq):
- return true
- case p.is(utDoubleDash):
- return true
- default:
- return false
- }
-}
-
-func (p *uParser) found(t uTokenType) bool {
- if p.is(t) {
- p.matchedToken = p.token()
- p.tkpos++
- return true
- }
- return false
-}
-
-func (p *uParser) is(t uTokenType) bool {
- if p.eof() {
- return false
- }
- return p.token().typ == t
-}
-
-func (p *uParser) expect(t uTokenType) {
- if !p.found(t) {
- panic(fmt.Sprintf("Was expecting %v", t))
- }
-}
-
-func (p *uParser) back() {
- p.tkpos--
-}
-func (p *uParser) eof() bool {
- return p.tkpos >= len(p.tokens)
-}
-
-func (p *uParser) token() *uToken {
- if p.eof() {
- return nil
- }
-
- return p.tokens[p.tkpos]
-}
diff --git a/vendor/github.com/jawher/mow.cli/spec_tk.go b/vendor/github.com/jawher/mow.cli/spec_tk.go
deleted file mode 100644
index a4ebde8..0000000
--- a/vendor/github.com/jawher/mow.cli/spec_tk.go
+++ /dev/null
@@ -1,223 +0,0 @@
-package cli
-
-import (
- "strings"
-
- "fmt"
-)
-
-type uTokenType string
-
-const (
- utPos uTokenType = "Pos"
- utOpenPar uTokenType = "OpenPar"
- utClosePar uTokenType = "ClosePar"
- utOpenSq uTokenType = "OpenSq"
- utCloseSq uTokenType = "CloseSq"
- utChoice uTokenType = "Choice"
- utOptions uTokenType = "Options"
- utRep uTokenType = "Rep"
- utShortOpt uTokenType = "ShortOpt"
- utLongOpt uTokenType = "LongOpt"
- utOptSeq uTokenType = "OptSeq"
- utOptValue uTokenType = "OptValue"
- utDoubleDash uTokenType = "DblDash"
-)
-
-type uToken struct {
- typ uTokenType
- val string
- pos int
-}
-
-func (t *uToken) String() string {
- return fmt.Sprintf("%s('%s')@%d", t.typ, t.val, t.pos)
-}
-
-type parseError struct {
- input string
- msg string
- pos int
-}
-
-func (t *parseError) ident() string {
- return strings.Map(func(c rune) rune {
- switch c {
- case '\t':
- return c
- default:
- return ' '
- }
- }, t.input[:t.pos])
-}
-func (t *parseError) Error() string {
- return fmt.Sprintf("Parse error at position %d:\n%s\n%s^ %s",
- t.pos, t.input, t.ident(), t.msg)
-}
-
-func uTokenize(usage string) ([]*uToken, *parseError) {
- pos := 0
- res := []*uToken{}
- var (
- tk = func(t uTokenType, v string) {
- res = append(res, &uToken{t, v, pos})
- }
-
- tkp = func(t uTokenType, v string, p int) {
- res = append(res, &uToken{t, v, p})
- }
-
- err = func(msg string) *parseError {
- return &parseError{usage, msg, pos}
- }
- )
- eof := len(usage)
- for pos < eof {
- switch c := usage[pos]; c {
- case ' ':
- pos++
- case '\t':
- pos++
- case '[':
- tk(utOpenSq, "[")
- pos++
- case ']':
- tk(utCloseSq, "]")
- pos++
- case '(':
- tk(utOpenPar, "(")
- pos++
- case ')':
- tk(utClosePar, ")")
- pos++
- case '|':
- tk(utChoice, "|")
- pos++
- case '.':
- start := pos
- pos++
- if pos >= eof || usage[pos] != '.' {
- return nil, err("Unexpected end of usage, was expecting '..'")
- }
- pos++
- if pos >= eof || usage[pos] != '.' {
- return nil, err("Unexpected end of usage, was expecting '.'")
- }
- tkp(utRep, "...", start)
- pos++
- case '-':
- start := pos
- pos++
- if pos >= eof {
- return nil, err("Unexpected end of usage, was expecting an option name")
- }
-
- switch o := usage[pos]; {
- case isLetter(o):
- pos++
- for ; pos < eof; pos++ {
- ok := isLetter(usage[pos])
- if !ok {
- break
- }
- }
- typ := utShortOpt
- if pos-start > 2 {
- typ = utOptSeq
- start++
- }
- opt := usage[start:pos]
- tkp(typ, opt, start)
- if pos < eof && usage[pos] == '-' {
- return nil, err("Invalid syntax")
- }
- case o == '-':
- pos++
- if pos == eof || usage[pos] == ' ' {
- tkp(utDoubleDash, "--", start)
- continue
- }
- for pos0 := pos; pos < eof; pos++ {
- ok := isOkLongOpt(usage[pos], pos == pos0)
- if !ok {
- break
- }
- }
- opt := usage[start:pos]
- if len(opt) == 2 {
- return nil, err("Was expecting a long option name")
- }
- tkp(utLongOpt, opt, start)
- }
-
- case '=':
- start := pos
- pos++
- if pos >= eof || usage[pos] != '<' {
- return nil, err("Unexpected end of usage, was expecting '=<'")
- }
- closed := false
- for ; pos < eof; pos++ {
- closed = usage[pos] == '>'
- if closed {
- break
- }
- }
- if !closed {
- return nil, err("Unclosed option value")
- }
- if pos-start == 2 {
- return nil, err("Was expecting an option value")
- }
- pos++
- value := usage[start:pos]
-
- tkp(utOptValue, value, start)
-
- default:
- switch {
- case isUppercase(c):
- start := pos
- for pos = pos + 1; pos < eof; pos++ {
- if !isOkPos(usage[pos]) {
- break
- }
- }
- s := usage[start:pos]
- typ := utPos
- if s == "OPTIONS" {
- typ = utOptions
- }
- tkp(typ, s, start)
- default:
- return nil, err("Unexpected input")
- }
-
- }
- }
-
- return res, nil
-}
-
-func isLowercase(c uint8) bool {
- return c >= 'a' && c <= 'z'
-}
-
-func isUppercase(c uint8) bool {
- return c >= 'A' && c <= 'Z'
-}
-
-func isOkPos(c uint8) bool {
- return isUppercase(c) || isDigit(c) || c == '_'
-}
-
-func isLetter(c uint8) bool {
- return isLowercase(c) || isUppercase(c)
-}
-
-func isDigit(c uint8) bool {
- return c >= '0' && c <= '9'
-}
-func isOkLongOpt(c uint8, first bool) bool {
- return isLetter(c) || isDigit(c) || c == '_' || (!first && c == '-')
-}
diff --git a/vendor/github.com/jawher/mow.cli/spec_tk_test.go b/vendor/github.com/jawher/mow.cli/spec_tk_test.go
deleted file mode 100644
index 0656068..0000000
--- a/vendor/github.com/jawher/mow.cli/spec_tk_test.go
+++ /dev/null
@@ -1,111 +0,0 @@
-package cli
-
-import (
- "testing"
-)
-
-func TestUTokenize(t *testing.T) {
- cases := []struct {
- usage string
- expected []*uToken
- }{
- {"OPTIONS", []*uToken{{utOptions, "OPTIONS", 0}}},
-
- {"XOPTIONS", []*uToken{{utPos, "XOPTIONS", 0}}},
- {"OPTIONSX", []*uToken{{utPos, "OPTIONSX", 0}}},
- {"ARG", []*uToken{{utPos, "ARG", 0}}},
- {"ARG42", []*uToken{{utPos, "ARG42", 0}}},
- {"ARG_EXTRA", []*uToken{{utPos, "ARG_EXTRA", 0}}},
-
- {"ARG1 ARG2", []*uToken{{utPos, "ARG1", 0}, {utPos, "ARG2", 5}}},
- {"ARG1 ARG2", []*uToken{{utPos, "ARG1", 0}, {utPos, "ARG2", 6}}},
-
- {"[ARG]", []*uToken{{utOpenSq, "[", 0}, {utPos, "ARG", 1}, {utCloseSq, "]", 4}}},
- {"[ ARG ]", []*uToken{{utOpenSq, "[", 0}, {utPos, "ARG", 2}, {utCloseSq, "]", 6}}},
- {"ARG [ARG2 ]", []*uToken{{utPos, "ARG", 0}, {utOpenSq, "[", 4}, {utPos, "ARG2", 5}, {utCloseSq, "]", 10}}},
- {"ARG [ ARG2]", []*uToken{{utPos, "ARG", 0}, {utOpenSq, "[", 4}, {utPos, "ARG2", 6}, {utCloseSq, "]", 10}}},
-
- {"...", []*uToken{{utRep, "...", 0}}},
- {"ARG...", []*uToken{{utPos, "ARG", 0}, {utRep, "...", 3}}},
- {"ARG ...", []*uToken{{utPos, "ARG", 0}, {utRep, "...", 4}}},
- {"[ARG...]", []*uToken{{utOpenSq, "[", 0}, {utPos, "ARG", 1}, {utRep, "...", 4}, {utCloseSq, "]", 7}}},
-
- {"|", []*uToken{{utChoice, "|", 0}}},
- {"ARG|ARG2", []*uToken{{utPos, "ARG", 0}, {utChoice, "|", 3}, {utPos, "ARG2", 4}}},
- {"ARG |ARG2", []*uToken{{utPos, "ARG", 0}, {utChoice, "|", 4}, {utPos, "ARG2", 5}}},
- {"ARG| ARG2", []*uToken{{utPos, "ARG", 0}, {utChoice, "|", 3}, {utPos, "ARG2", 5}}},
-
- {"[OPTIONS]", []*uToken{{utOpenSq, "[", 0}, {utOptions, "OPTIONS", 1}, {utCloseSq, "]", 8}}},
-
- {"-p", []*uToken{{utShortOpt, "-p", 0}}},
- {"-X", []*uToken{{utShortOpt, "-X", 0}}},
-
- {"--force", []*uToken{{utLongOpt, "--force", 0}}},
- {"--sig-proxy", []*uToken{{utLongOpt, "--sig-proxy", 0}}},
-
- {"-aBc", []*uToken{{utOptSeq, "aBc", 1}}},
- {"--", []*uToken{{utDoubleDash, "--", 0}}},
- {"=", []*uToken{{utOptValue, "=", 0}}},
- {"=", []*uToken{{utOptValue, "=", 0}}},
- {"=", []*uToken{{utOptValue, "=", 0}}},
- {"-p=", []*uToken{{utShortOpt, "-p", 0}, {utOptValue, "=", 2}}},
- {"--path=", []*uToken{{utLongOpt, "--path", 0}, {utOptValue, "=", 6}}},
- }
- for _, c := range cases {
- t.Logf("test %s", c.usage)
- tks, err := uTokenize(c.usage)
- if err != nil {
- t.Errorf("[Tokenize '%s']: Unexpected error: %v", c.usage, err)
- continue
- }
-
- t.Logf("actual: %v\n", tks)
- if len(tks) != len(c.expected) {
- t.Errorf("[Tokenize '%s']: token count mismatch:\n\tExpected: %v\n\tActual : %v", c.usage, c.expected, tks)
- continue
- }
-
- for i, actual := range tks {
- expected := c.expected[i]
- switch {
- case actual.typ != expected.typ:
- t.Errorf("[Tokenize '%s']: token type mismatch:\n\tExpected: %v\n\tActual : %v", c.usage, expected, actual)
- case actual.val != expected.val:
- t.Errorf("[Tokenize '%s']: token text mismatch:\n\tExpected: %v\n\tActual : %v", c.usage, expected, actual)
- case actual.pos != expected.pos:
- t.Errorf("[Tokenize '%s']: token pos mismatch:\n\tExpected: %v\n\tActual : %v", c.usage, expected, actual)
- }
- }
-
- }
-}
-
-func TestUTokenizeErrors(t *testing.T) {
- cases := []struct {
- usage string
- pos int
- }{
- {"-", 1},
- {"---x", 2},
- {"-x-", 2},
-
- {"=", 1},
- {"=<", 2},
- {"=", 2},
- }
-
- for _, c := range cases {
- t.Logf("test %s", c.usage)
- tks, err := uTokenize(c.usage)
- if err == nil {
- t.Errorf("Tokenize('%s') should have failed, instead got %v", c.usage, tks)
- continue
- }
- t.Logf("Got expected error %v", err)
- if err.pos != c.pos {
- t.Errorf("[Tokenize '%s']: error pos mismatch:\n\tExpected: %v\n\tActual : %v", c.usage, c.pos, err.pos)
-
- }
- }
-}
diff --git a/vendor/github.com/jawher/mow.cli/testdata/help-output.txt b/vendor/github.com/jawher/mow.cli/testdata/help-output.txt
deleted file mode 100644
index 1ac03c3..0000000
--- a/vendor/github.com/jawher/mow.cli/testdata/help-output.txt
+++ /dev/null
@@ -1,45 +0,0 @@
-
-Usage: app [-bdsuikqs] BOOL1 [STR1] INT3... COMMAND [arg...]
-
-App Desc
-
-Arguments:
- BOOL1 Bool Argument 1 (env $BOOL1)
- BOOL2 Bool Argument 2 (default true)
- BOOL3 Bool Argument 3 (env $BOOL3)
- STR1 String Argument 1 (env $STR1)
- STR2 String Argument 2 (env $STR2) (default "a value")
- STR3 String Argument 3 (env $STR3)
- INT1 Int Argument 1 (env $INT1) (default 0)
- INT2 Int Argument 2 (env $INT2) (default 1)
- INT3 Int Argument 3 (env $INT3)
- STRS1 Strings Argument 1 (env $STRS1)
- STRS2 (env $STRS2) (default ["value1", "value2"])
- STRS3 Strings Argument 3 (env $STRS3)
- INTS1 Ints Argument 1 (env $INTS1)
- INTS2 Ints Argument 2 (env $INTS2) (default [1, 2, 3])
- INTS3 Ints Argument 3 (env $INTS3)
-
-Options:
- -b, --bool1 Bool Option 1 (env $BOOL1)
- --bool2 Bool Option 2 (default true)
- -d Bool Option 3 (env $BOOL3)
- -s, --str1 String Option 1 (env $STR1)
- --str2 String Option 2 (default "a value")
- -u String Option 3 (env $STR3)
- -i, --int1 (env $INT1, $ALIAS_INT1) (default 0)
- --int2 Int Option 2 (env $INT2) (default 1)
- -k Int Option 3 (env $INT3)
- -x, --strs1 Strings Option 1 (env $STRS1)
- --strs2 Strings Option 2 (env $STRS2) (default ["value1", "value2"])
- -z Strings Option 3 (env $STRS3)
- -q, --ints1 Ints Option 1 (env $INTS1)
- --ints2 Ints Option 2 (env $INTS2) (default [1, 2, 3])
- -s Ints Option 3 (env $INTS3)
-
-Commands:
- command1 command1 description
- command2 command2 description
- command3 command3 description
-
-Run 'app COMMAND --help' for more information on a command.
diff --git a/vendor/github.com/jawher/mow.cli/testdata/long-help-output.txt b/vendor/github.com/jawher/mow.cli/testdata/long-help-output.txt
deleted file mode 100644
index e47bf93..0000000
--- a/vendor/github.com/jawher/mow.cli/testdata/long-help-output.txt
+++ /dev/null
@@ -1,10 +0,0 @@
-
-Usage: app [-o] ARG
-
-Longer App Desc
-
-Arguments:
- ARG Argument
-
-Options:
- -o, --opt Option
diff --git a/vendor/github.com/jawher/mow.cli/utils.go b/vendor/github.com/jawher/mow.cli/utils.go
deleted file mode 100644
index f486c5c..0000000
--- a/vendor/github.com/jawher/mow.cli/utils.go
+++ /dev/null
@@ -1,66 +0,0 @@
-package cli
-
-import (
- "flag"
- "os"
- "strings"
-)
-
-func setFromEnv(into flag.Value, envVars string) bool {
- multiValued, isMulti := into.(multiValued)
-
- if len(envVars) > 0 {
- for _, rev := range strings.Split(envVars, " ") {
- ev := strings.TrimSpace(rev)
- if len(ev) == 0 {
- continue
- }
-
- v := os.Getenv(ev)
- if len(v) == 0 {
- continue
- }
- if !isMulti {
- if err := into.Set(v); err == nil {
- return true
- }
- continue
- }
-
- vs := strings.Split(v, ",")
- if err := setMultivalued(multiValued, vs); err == nil {
- return true
- }
- }
- }
- return false
-}
-
-func setMultivalued(into multiValued, values []string) error {
- into.Clear()
-
- for _, v := range values {
- v = strings.TrimSpace(v)
- if err := into.Set(v); err != nil {
- into.Clear()
- return err
- }
- }
-
- return nil
-}
-
-func joinStrings(parts ...string) string {
- res := ""
- for _, part := range parts {
- s := strings.TrimSpace(part)
- if s == "" {
- continue
- }
- if res != "" {
- res += " "
- }
- res += part
- }
- return res
-}
diff --git a/vendor/github.com/jawher/mow.cli/utils_test.go b/vendor/github.com/jawher/mow.cli/utils_test.go
deleted file mode 100644
index 62d3797..0000000
--- a/vendor/github.com/jawher/mow.cli/utils_test.go
+++ /dev/null
@@ -1,30 +0,0 @@
-package cli
-
-import (
- "testing"
-
- "github.com/stretchr/testify/require"
-)
-
-func TestJoinStrings(t *testing.T) {
- cases := []struct {
- input []string
- expected string
- }{
- {nil, ""},
- {[]string{""}, ""},
- {[]string{" "}, ""},
- {[]string{"\t"}, ""},
- {[]string{"", " ", "\t"}, ""},
- {[]string{"a"}, "a"},
- {[]string{"a", "b c"}, "a b c"},
- {[]string{"", "a", " ", "b", "\t"}, "a b"},
- }
-
- for _, cas := range cases {
- t.Logf("Testing %#v", cas.input)
- actual := joinStrings(cas.input...)
-
- require.Equal(t, cas.expected, actual)
- }
-}
diff --git a/vendor/github.com/jawher/mow.cli/values.go b/vendor/github.com/jawher/mow.cli/values.go
deleted file mode 100644
index 953f303..0000000
--- a/vendor/github.com/jawher/mow.cli/values.go
+++ /dev/null
@@ -1,203 +0,0 @@
-package cli
-
-import (
- "flag"
- "fmt"
- "strconv"
-)
-
-type boolValued interface {
- flag.Value
- IsBoolFlag() bool
-}
-
-type multiValued interface {
- flag.Value
- Clear()
-}
-
-type defaultValued interface {
- IsDefault() bool
-}
-
-/******************************************************************************/
-/* BOOL */
-/******************************************************************************/
-
-type boolValue bool
-
-var (
- _ flag.Value = newBoolValue(new(bool), false)
- _ boolValued = newBoolValue(new(bool), false)
- _ defaultValued = newBoolValue(new(bool), false)
-)
-
-func newBoolValue(into *bool, v bool) *boolValue {
- *into = v
- return (*boolValue)(into)
-}
-
-func (bo *boolValue) Set(s string) error {
- b, err := strconv.ParseBool(s)
- if err != nil {
- return err
- }
- *bo = boolValue(b)
- return nil
-}
-
-func (bo *boolValue) IsBoolFlag() bool {
- return true
-}
-
-func (bo *boolValue) String() string {
- return fmt.Sprintf("%v", *bo)
-}
-
-func (bo *boolValue) IsDefault() bool {
- return !bool(*bo)
-}
-
-/******************************************************************************/
-/* STRING */
-/******************************************************************************/
-
-type stringValue string
-
-var (
- _ flag.Value = newStringValue(new(string), "")
- _ defaultValued = newStringValue(new(string), "")
-)
-
-func newStringValue(into *string, v string) *stringValue {
- *into = v
- return (*stringValue)(into)
-}
-
-func (sa *stringValue) Set(s string) error {
- *sa = stringValue(s)
- return nil
-}
-
-func (sa *stringValue) String() string {
- return fmt.Sprintf("%#v", *sa)
-}
-
-func (sa *stringValue) IsDefault() bool {
- return string(*sa) == ""
-}
-
-/******************************************************************************/
-/* INT */
-/******************************************************************************/
-
-type intValue int
-
-var (
- _ flag.Value = newIntValue(new(int), 0)
-)
-
-func newIntValue(into *int, v int) *intValue {
- *into = v
- return (*intValue)(into)
-}
-
-func (ia *intValue) Set(s string) error {
- i, err := strconv.ParseInt(s, 10, 64)
- if err != nil {
- return err
- }
- *ia = intValue(int(i))
- return nil
-}
-
-func (ia *intValue) String() string {
- return fmt.Sprintf("%v", *ia)
-}
-
-/******************************************************************************/
-/* STRINGS */
-/******************************************************************************/
-
-// Strings describes a string slice argument
-type stringsValue []string
-
-var (
- _ flag.Value = newStringsValue(new([]string), nil)
- _ multiValued = newStringsValue(new([]string), nil)
- _ defaultValued = newStringsValue(new([]string), nil)
-)
-
-func newStringsValue(into *[]string, v []string) *stringsValue {
- *into = v
- return (*stringsValue)(into)
-}
-
-func (sa *stringsValue) Set(s string) error {
- *sa = append(*sa, s)
- return nil
-}
-
-func (sa *stringsValue) String() string {
- res := "["
- for idx, s := range *sa {
- if idx > 0 {
- res += ", "
- }
- res += fmt.Sprintf("%#v", s)
- }
- return res + "]"
-}
-
-func (sa *stringsValue) Clear() {
- *sa = nil
-}
-
-func (sa *stringsValue) IsDefault() bool {
- return len(*sa) == 0
-}
-
-/******************************************************************************/
-/* INTS */
-/******************************************************************************/
-
-type intsValue []int
-
-var (
- _ flag.Value = newIntsValue(new([]int), nil)
- _ multiValued = newIntsValue(new([]int), nil)
- _ defaultValued = newIntsValue(new([]int), nil)
-)
-
-func newIntsValue(into *[]int, v []int) *intsValue {
- *into = v
- return (*intsValue)(into)
-}
-
-func (ia *intsValue) Set(s string) error {
- i, err := strconv.ParseInt(s, 10, 64)
- if err != nil {
- return err
- }
- *ia = append(*ia, int(i))
- return nil
-}
-
-func (ia *intsValue) String() string {
- res := "["
- for idx, s := range *ia {
- if idx > 0 {
- res += ", "
- }
- res += fmt.Sprintf("%v", s)
- }
- return res + "]"
-}
-
-func (ia *intsValue) Clear() {
- *ia = nil
-}
-
-func (ia *intsValue) IsDefault() bool {
- return len(*ia) == 0
-}
diff --git a/vendor/github.com/jawher/mow.cli/values_test.go b/vendor/github.com/jawher/mow.cli/values_test.go
deleted file mode 100644
index be7f5fd..0000000
--- a/vendor/github.com/jawher/mow.cli/values_test.go
+++ /dev/null
@@ -1,137 +0,0 @@
-package cli
-
-import (
- "testing"
-
- "github.com/stretchr/testify/require"
-)
-
-func TestBoolParam(t *testing.T) {
- var into bool
-
- param := newBoolValue(&into, false)
-
- require.True(t, param.IsBoolFlag())
-
- cases := []struct {
- input string
- err bool
- result bool
- string string
- }{
- {"true", false, true, "true"},
- {"false", false, false, "false"},
- {"123", true, false, ""},
- {"", true, false, ""},
- }
-
- for _, cas := range cases {
- t.Logf("testing with %q", cas.input)
-
- err := param.Set(cas.input)
-
- if cas.err {
- require.Errorf(t, err, "value %q should have returned an error", cas.input)
- continue
- }
-
- require.Equal(t, cas.result, into)
- require.Equal(t, cas.string, param.String())
- }
-}
-
-func TestStringParam(t *testing.T) {
- var into string
-
- param := newStringValue(&into, "")
-
- cases := []struct {
- input string
- string string
- }{
- {"a", `"a"`},
- {"", `""`},
- }
-
- for _, cas := range cases {
- t.Logf("testing with %q", cas.input)
-
- err := param.Set(cas.input)
-
- require.NoError(t, err)
-
- require.Equal(t, cas.input, into)
- require.Equal(t, cas.string, param.String())
- }
-}
-
-func TestIntParam(t *testing.T) {
- var into int
-
- param := newIntValue(&into, 0)
-
- cases := []struct {
- input string
- err bool
- result int
- string string
- }{
- {"12", false, 12, "12"},
- {"0", false, 0, "0"},
- {"01", false, 1, "1"},
- {"", true, 0, ""},
- {"abc", true, 0, ""},
- }
-
- for _, cas := range cases {
- t.Logf("testing with %q", cas.input)
-
- err := param.Set(cas.input)
-
- if cas.err {
- require.Errorf(t, err, "value %q should have returned an error", cas.input)
- continue
- }
-
- require.Equal(t, cas.result, into)
- require.Equal(t, cas.string, param.String())
- }
-}
-
-func TestStringsParam(t *testing.T) {
- into := []string{}
- param := newStringsValue(&into, nil)
-
- param.Set("a")
- param.Set("b")
-
- require.Equal(t, []string{"a", "b"}, into)
- require.Equal(t, `["a", "b"]`, param.String())
-
- param.Clear()
-
- require.Empty(t, into)
-}
-
-func TestIntsParam(t *testing.T) {
- into := []int{}
- param := newIntsValue(&into, nil)
-
- err := param.Set("1")
- require.NoError(t, err)
-
- err = param.Set("2")
- require.NoError(t, err)
-
- require.Equal(t, []int{1, 2}, into)
-
- require.Equal(t, `[1, 2]`, param.String())
-
- err = param.Set("c")
- require.Error(t, err)
- require.Equal(t, []int{1, 2}, into)
-
- param.Clear()
-
- require.Empty(t, into)
-}
diff --git a/vendor/github.com/jawher/mow.cli/var_test.go b/vendor/github.com/jawher/mow.cli/var_test.go
deleted file mode 100644
index 3e2780f..0000000
--- a/vendor/github.com/jawher/mow.cli/var_test.go
+++ /dev/null
@@ -1,162 +0,0 @@
-package cli
-
-import (
- "fmt"
- "testing"
- "time"
-
- "os"
-
- "github.com/stretchr/testify/require"
-)
-
-// Counter
-type Counter int
-
-func (d *Counter) Set(v string) error {
- *d++
- return nil
-}
-
-func (d *Counter) String() string {
- return fmt.Sprintf("%d", *d)
-}
-
-func (d *Counter) IsBoolFlag() bool {
- return true
-}
-
-// Duration
-type Duration time.Duration
-
-func (d *Duration) Set(v string) error {
- parsed, err := time.ParseDuration(v)
- if err != nil {
- return err
- }
- *d = Duration(parsed)
- return nil
-}
-
-func (d *Duration) String() string {
- duration := time.Duration(*d)
- return duration.String()
-}
-
-type Percent []float64
-
-func parsePercent(v string) (float64, error) {
- var d int
- _, err := fmt.Sscanf(v, "%d%%", &d)
- if err != nil {
- return 0, err
- }
- return float64(d) / 100, nil
-}
-
-func (p *Percent) Set(v string) error {
- f, err := parsePercent(v)
- if err != nil {
- return err
- }
- *p = append(*p, f)
- return nil
-}
-
-func (p *Percent) Clear() {
- *p = nil
-}
-
-func (p *Percent) String() string {
- res := "["
- for idx, p := range *p {
- if idx > 0 {
- res += ", "
- }
- res += fmt.Sprintf("%.0f%%", p*100)
- }
- return res + "]"
-}
-
-func TestVar(t *testing.T) {
- value := Counter(0)
- duration := Duration(0)
- percents := Percent{}
-
- app := App("var", "")
- app.Spec = "-v... DURATION PERCENT..."
-
- app.VarOpt("v", &value, "")
- app.VarArg("DURATION", &duration, "")
- app.VarArg("PERCENT", &percents, "")
-
- ex := false
- app.Action = func() {
- ex = true
- }
- app.Run([]string{"cp", "-vvv", "1h", "10%", "5%"})
-
- require.Equal(t, Counter(3), value)
- require.Equal(t, Duration(1*time.Hour), duration)
- require.Equal(t, Percent([]float64{0.1, 0.05}), percents)
-
- require.True(t, ex, "Exec wasn't called")
-}
-
-func TestVarFromEnv(t *testing.T) {
- os.Setenv("MOWCLI_DURATION", "1h2m3s")
- os.Setenv("MOWCLI_ARG_PERCENTS", "25%, 1%")
- os.Setenv("MOWCLI_OPT_PERCENTS", "90%, 42%")
-
- duration := Duration(0)
- argPercents := Percent{}
- optPercents := Percent{}
-
- app := App("var", "")
- app.Spec = "-p... DURATION PERCENT..."
-
- app.Var(VarArg{
- Name: "DURATION",
- Value: &duration,
- EnvVar: "MOWCLI_DURATION",
- })
- app.Var(VarArg{
- Name: "PERCENT",
- Value: &argPercents,
- EnvVar: "MOWCLI_ARG_PERCENTS",
- })
- app.Var(VarOpt{
- Name: "p",
- Value: &optPercents,
- EnvVar: "MOWCLI_OPT_PERCENTS",
- })
-
- require.Equal(t, Duration(1*time.Hour+2*time.Minute+3*time.Second), duration)
-
- require.Equal(t, Percent([]float64{0.25, 0.01}), argPercents)
- require.Equal(t, Percent([]float64{0.9, 0.42}), optPercents)
-}
-
-func TestVarOverrideEnv(t *testing.T) {
- os.Setenv("MOWCLI_PERCENTS", "25%, 1%")
-
- percents := Percent{}
-
- app := App("var", "")
- app.Spec = "PERCENT..."
- app.Var(VarArg{
- Name: "PERCENT",
- Value: &percents,
- EnvVar: "MOWCLI_PERCENTS",
- })
-
- ex := false
- app.Action = func() {
- ex = true
- require.Equal(t, Percent([]float64{0, 0.99}), percents)
- }
-
- app.Run([]string{"var", "0%", "99%"})
-
- require.True(t, ex, "Action should have been called")
-}
diff --git a/vendor/github.com/maruel/panicparse/.travis.yml b/vendor/github.com/maruel/panicparse/.travis.yml
deleted file mode 100644
index 1174e42..0000000
--- a/vendor/github.com/maruel/panicparse/.travis.yml
+++ /dev/null
@@ -1,16 +0,0 @@
-# Copyright 2014 Marc-Antoine Ruel. All rights reserved.
-# Use of this source code is governed under the Apache License, Version 2.0
-# that can be found in the LICENSE file.
-
-sudo: false
-language: go
-
-go:
-- 1.8.x
-- 1.x
-
-before_install:
-- go get github.com/maruel/pre-commit-go/cmd/pcg
-
-script:
-- pcg
diff --git a/vendor/github.com/maruel/panicparse/Gopkg.lock b/vendor/github.com/maruel/panicparse/Gopkg.lock
deleted file mode 100644
index fac5700..0000000
--- a/vendor/github.com/maruel/panicparse/Gopkg.lock
+++ /dev/null
@@ -1,57 +0,0 @@
-# This file is autogenerated, do not edit; changes may be undone by the next 'dep ensure'.
-
-
-[[projects]]
- branch = "master"
- name = "github.com/kr/pretty"
- packages = ["."]
- revision = "cfb55aafdaf3ec08f0db22699ab822c50091b1c4"
-
-[[projects]]
- branch = "master"
- name = "github.com/kr/text"
- packages = ["."]
- revision = "7cafcd837844e784b526369c9bce262804aebc60"
-
-[[projects]]
- name = "github.com/maruel/ut"
- packages = ["."]
- revision = "a9c9f15ccfa6f8b90182a53df32f4745586fbae3"
- version = "v1.0.0"
-
-[[projects]]
- name = "github.com/mattn/go-colorable"
- packages = ["."]
- revision = "167de6bfdfba052fa6b2d3664c8f5272e23c9072"
- version = "v0.0.9"
-
-[[projects]]
- name = "github.com/mattn/go-isatty"
- packages = ["."]
- revision = "fc9e8d8ef48496124e79ae0df75490096eccf6fe"
- version = "v0.0.2"
-
-[[projects]]
- branch = "master"
- name = "github.com/mgutz/ansi"
- packages = ["."]
- revision = "9520e82c474b0a04dd04f8a40959027271bab992"
-
-[[projects]]
- name = "github.com/pmezard/go-difflib"
- packages = ["difflib"]
- revision = "792786c7400a136282c1664665ae0a8db921c6c2"
- version = "v1.0.0"
-
-[[projects]]
- branch = "master"
- name = "golang.org/x/sys"
- packages = ["unix"]
- revision = "e42485b6e20ae7d2304ec72e535b103ed350cc02"
-
-[solve-meta]
- analyzer-name = "dep"
- analyzer-version = 1
- inputs-digest = "64e1c923b988d687243b43f8168fc7a83ceb603bf1ce4126022d34625cada8d9"
- solver-name = "gps-cdcl"
- solver-version = 1
diff --git a/vendor/github.com/maruel/panicparse/Gopkg.toml b/vendor/github.com/maruel/panicparse/Gopkg.toml
deleted file mode 100644
index 1aa8264..0000000
--- a/vendor/github.com/maruel/panicparse/Gopkg.toml
+++ /dev/null
@@ -1,38 +0,0 @@
-
-# Gopkg.toml example
-#
-# Refer to https://github.com/golang/dep/blob/master/docs/Gopkg.toml.md
-# for detailed Gopkg.toml documentation.
-#
-# required = ["github.com/user/thing/cmd/thing"]
-# ignored = ["github.com/user/project/pkgX", "bitbucket.org/user/project/pkgA/pkgY"]
-#
-# [[constraint]]
-# name = "github.com/user/project"
-# version = "1.0.0"
-#
-# [[constraint]]
-# name = "github.com/user/project2"
-# branch = "dev"
-# source = "github.com/myfork/project2"
-#
-# [[override]]
-# name = "github.com/x/y"
-# version = "2.4.0"
-
-
-[[constraint]]
- name = "github.com/maruel/ut"
- version = "1.0.0"
-
-[[constraint]]
- name = "github.com/mattn/go-colorable"
- version = "0.0.9"
-
-[[constraint]]
- name = "github.com/mattn/go-isatty"
- version = "0.0.2"
-
-[[constraint]]
- branch = "master"
- name = "github.com/mgutz/ansi"
diff --git a/vendor/github.com/maruel/panicparse/LICENSE b/vendor/github.com/maruel/panicparse/LICENSE
deleted file mode 100644
index b76840c..0000000
--- a/vendor/github.com/maruel/panicparse/LICENSE
+++ /dev/null
@@ -1,201 +0,0 @@
- Apache License
- Version 2.0, January 2004
- http://www.apache.org/licenses/
-
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
- 1. Definitions.
-
- "License" shall mean the terms and conditions for use, reproduction,
- and distribution as defined by Sections 1 through 9 of this document.
-
- "Licensor" shall mean the copyright owner or entity authorized by
- the copyright owner that is granting the License.
-
- "Legal Entity" shall mean the union of the acting entity and all
- other entities that control, are controlled by, or are under common
- control with that entity. For the purposes of this definition,
- "control" means (i) the power, direct or indirect, to cause the
- direction or management of such entity, whether by contract or
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
- outstanding shares, or (iii) beneficial ownership of such entity.
-
- "You" (or "Your") shall mean an individual or Legal Entity
- exercising permissions granted by this License.
-
- "Source" form shall mean the preferred form for making modifications,
- including but not limited to software source code, documentation
- source, and configuration files.
-
- "Object" form shall mean any form resulting from mechanical
- transformation or translation of a Source form, including but
- not limited to compiled object code, generated documentation,
- and conversions to other media types.
-
- "Work" shall mean the work of authorship, whether in Source or
- Object form, made available under the License, as indicated by a
- copyright notice that is included in or attached to the work
- (an example is provided in the Appendix below).
-
- "Derivative Works" shall mean any work, whether in Source or Object
- form, that is based on (or derived from) the Work and for which the
- editorial revisions, annotations, elaborations, or other modifications
- represent, as a whole, an original work of authorship. For the purposes
- of this License, Derivative Works shall not include works that remain
- separable from, or merely link (or bind by name) to the interfaces of,
- the Work and Derivative Works thereof.
-
- "Contribution" shall mean any work of authorship, including
- the original version of the Work and any modifications or additions
- to that Work or Derivative Works thereof, that is intentionally
- submitted to Licensor for inclusion in the Work by the copyright owner
- or by an individual or Legal Entity authorized to submit on behalf of
- the copyright owner. For the purposes of this definition, "submitted"
- means any form of electronic, verbal, or written communication sent
- to the Licensor or its representatives, including but not limited to
- communication on electronic mailing lists, source code control systems,
- and issue tracking systems that are managed by, or on behalf of, the
- Licensor for the purpose of discussing and improving the Work, but
- excluding communication that is conspicuously marked or otherwise
- designated in writing by the copyright owner as "Not a Contribution."
-
- "Contributor" shall mean Licensor and any individual or Legal Entity
- on behalf of whom a Contribution has been received by Licensor and
- subsequently incorporated within the Work.
-
- 2. Grant of Copyright License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- copyright license to reproduce, prepare Derivative Works of,
- publicly display, publicly perform, sublicense, and distribute the
- Work and such Derivative Works in Source or Object form.
-
- 3. Grant of Patent License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- (except as stated in this section) patent license to make, have made,
- use, offer to sell, sell, import, and otherwise transfer the Work,
- where such license applies only to those patent claims licensable
- by such Contributor that are necessarily infringed by their
- Contribution(s) alone or by combination of their Contribution(s)
- with the Work to which such Contribution(s) was submitted. If You
- institute patent litigation against any entity (including a
- cross-claim or counterclaim in a lawsuit) alleging that the Work
- or a Contribution incorporated within the Work constitutes direct
- or contributory patent infringement, then any patent licenses
- granted to You under this License for that Work shall terminate
- as of the date such litigation is filed.
-
- 4. Redistribution. You may reproduce and distribute copies of the
- Work or Derivative Works thereof in any medium, with or without
- modifications, and in Source or Object form, provided that You
- meet the following conditions:
-
- (a) You must give any other recipients of the Work or
- Derivative Works a copy of this License; and
-
- (b) You must cause any modified files to carry prominent notices
- stating that You changed the files; and
-
- (c) You must retain, in the Source form of any Derivative Works
- that You distribute, all copyright, patent, trademark, and
- attribution notices from the Source form of the Work,
- excluding those notices that do not pertain to any part of
- the Derivative Works; and
-
- (d) If the Work includes a "NOTICE" text file as part of its
- distribution, then any Derivative Works that You distribute must
- include a readable copy of the attribution notices contained
- within such NOTICE file, excluding those notices that do not
- pertain to any part of the Derivative Works, in at least one
- of the following places: within a NOTICE text file distributed
- as part of the Derivative Works; within the Source form or
- documentation, if provided along with the Derivative Works; or,
- within a display generated by the Derivative Works, if and
- wherever such third-party notices normally appear. The contents
- of the NOTICE file are for informational purposes only and
- do not modify the License. You may add Your own attribution
- notices within Derivative Works that You distribute, alongside
- or as an addendum to the NOTICE text from the Work, provided
- that such additional attribution notices cannot be construed
- as modifying the License.
-
- You may add Your own copyright statement to Your modifications and
- may provide additional or different license terms and conditions
- for use, reproduction, or distribution of Your modifications, or
- for any such Derivative Works as a whole, provided Your use,
- reproduction, and distribution of the Work otherwise complies with
- the conditions stated in this License.
-
- 5. Submission of Contributions. Unless You explicitly state otherwise,
- any Contribution intentionally submitted for inclusion in the Work
- by You to the Licensor shall be under the terms and conditions of
- this License, without any additional terms or conditions.
- Notwithstanding the above, nothing herein shall supersede or modify
- the terms of any separate license agreement you may have executed
- with Licensor regarding such Contributions.
-
- 6. Trademarks. This License does not grant permission to use the trade
- names, trademarks, service marks, or product names of the Licensor,
- except as required for reasonable and customary use in describing the
- origin of the Work and reproducing the content of the NOTICE file.
-
- 7. Disclaimer of Warranty. Unless required by applicable law or
- agreed to in writing, Licensor provides the Work (and each
- Contributor provides its Contributions) on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- implied, including, without limitation, any warranties or conditions
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
- PARTICULAR PURPOSE. You are solely responsible for determining the
- appropriateness of using or redistributing the Work and assume any
- risks associated with Your exercise of permissions under this License.
-
- 8. Limitation of Liability. In no event and under no legal theory,
- whether in tort (including negligence), contract, or otherwise,
- unless required by applicable law (such as deliberate and grossly
- negligent acts) or agreed to in writing, shall any Contributor be
- liable to You for damages, including any direct, indirect, special,
- incidental, or consequential damages of any character arising as a
- result of this License or out of the use or inability to use the
- Work (including but not limited to damages for loss of goodwill,
- work stoppage, computer failure or malfunction, or any and all
- other commercial damages or losses), even if such Contributor
- has been advised of the possibility of such damages.
-
- 9. Accepting Warranty or Additional Liability. While redistributing
- the Work or Derivative Works thereof, You may choose to offer,
- and charge a fee for, acceptance of support, warranty, indemnity,
- or other liability obligations and/or rights consistent with this
- License. However, in accepting such obligations, You may act only
- on Your own behalf and on Your sole responsibility, not on behalf
- of any other Contributor, and only if You agree to indemnify,
- defend, and hold each Contributor harmless for any liability
- incurred by, or claims asserted against, such Contributor by reason
- of your accepting any such warranty or additional liability.
-
- END OF TERMS AND CONDITIONS
-
- APPENDIX: How to apply the Apache License to your work.
-
- To apply the Apache License to your work, attach the following
- boilerplate notice, with the fields enclosed by brackets "{}"
- replaced with your own identifying information. (Don't include
- the brackets!) The text should be enclosed in the appropriate
- comment syntax for the file format. We also recommend that a
- file or class name and description of purpose be included on the
- same "printed page" as the copyright notice for easier
- identification within third-party archives.
-
- Copyright 2015 Marc-Antoine Ruel
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
diff --git a/vendor/github.com/maruel/panicparse/README.md b/vendor/github.com/maruel/panicparse/README.md
deleted file mode 100644
index 0bcd133..0000000
--- a/vendor/github.com/maruel/panicparse/README.md
+++ /dev/null
@@ -1,139 +0,0 @@
-panicparse
-==========
-
-Parses panic stack traces, densifies and deduplicates goroutines with similar
-stack traces. Helps debugging crashes and deadlocks in heavily parallelized
-process.
-
-[![Build Status](https://travis-ci.org/maruel/panicparse.svg?branch=master)](https://travis-ci.org/maruel/panicparse)
-
-panicparse helps make sense of Go crash dumps:
-
-![Screencast](https://raw.githubusercontent.com/wiki/maruel/panicparse/parse.gif "Screencast")
-
-
-Features
---------
-
- * >50% more compact output than original stack dump yet more readable.
- * Exported symbols are bold, private symbols are darker.
- * Stdlib is green, main is yellow, rest is red.
- * Deduplicates redundant goroutine stacks. Useful for large server crashes.
- * Arguments as pointer IDs instead of raw pointer values.
- * Pushes stdlib-only stacks at the bottom to help focus on important code.
- * Usable as a library!
- [![GoDoc](https://godoc.org/github.com/maruel/panicparse/stack?status.svg)](https://godoc.org/github.com/maruel/panicparse/stack)
- * Warning: please pin the version (e.g. vendor it). Breaking changes are
- not planned but may happen.
- * Parses the source files if available to augment the output.
- * Works on Windows.
-
-
-Installation
-------------
-
- go get github.com/maruel/panicparse/cmd/pp
-
-
-Usage
------
-
-### Piping a stack trace from another process
-
-#### TL;DR
-
- * Ubuntu (bash v4 or zsh): `|&`
- * OSX, [install bash 4+](README.md#updating-bash-on-osx), then: `|&`
- * Windows _or_ OSX with stock bash v3: `2>&1 |`
- * [Fish](http://fishshell.com/) shell: `^|`
-
-
-#### Longer version
-
-`pp` streams its stdin to stdout as long as it doesn't detect any panic.
-`panic()` and Go's native deadlock detector [print to
-stderr](https://golang.org/src/runtime/panic1.go) via the native [`print()`
-function](https://golang.org/pkg/builtin/#print).
-
-
-**Bash v4** or **zsh**: `|&` tells the shell to redirect stderr to stdout,
-it's an alias for `2>&1 |` ([bash
-v4](https://www.gnu.org/software/bash/manual/bash.html#Pipelines),
-[zsh](http://zsh.sourceforge.net/Doc/Release/Shell-Grammar.html#Simple-Commands-_0026-Pipelines)):
-
- go test -v |&pp
-
-
-**Windows or OSX native bash** [(which is
-3.2.57)](http://meta.ath0.com/2012/02/05/apples-great-gpl-purge/): They don't
-have this shortcut, so use the long form:
-
- go test -v 2>&1 | pp
-
-
-**Fish**: It uses [^ for stderr
-redirection](http://fishshell.com/docs/current/tutorial.html#tut_pipes_and_redirections)
-so the shortcut is `^|`:
-
- go test -v ^|pp
-
-
-**PowerShell**: [It has broken `2>&1` redirection](https://connect.microsoft.com/PowerShell/feedback/details/765551/in-powershell-v3-you-cant-redirect-stderr-to-stdout-without-generating-error-records). The workaround is to shell out to cmd.exe. :(
-
-
-### Investigate deadlock
-
-On POSIX, use `Ctrl-\` to send SIGQUIT to your process, `pp` will ignore
-the signal and will parse the stack trace.
-
-
-### Parsing from a file
-
-To dump to a file then parse, pass the file path of a stack trace
-
- go test 2> stack.txt
- pp stack.txt
-
-
-Tips
-----
-
-### GOTRACEBACK
-
-Starting with Go 1.6, [`GOTRACEBACK`](https://golang.org/pkg/runtime/) defaults
-to `single` instead of `all` / `1` that was used in 1.5 and before. To get all
-goroutines trace and not just the crashing one, set the environment variable:
-
- export GOTRACEBACK=all
-
-or `set GOTRACEBACK=all` on Windows. Probably worth to put it in your `.bashrc`.
-
-
-### Updating bash on OSX
-
-Install bash v4+ on OSX via [homebrew](http://brew.sh) or
-[macports](https://www.macports.org/). Your future self will appreciate having
-done that.
-
-
-### If you have `/usr/bin/pp` installed
-
-If you try `pp` for the first time and you get:
-
- Creating tables and indexes...
- Done.
-
-and/or
-
- /usr/bin/pp5.18: No input files specified
-
-you may be running the _Perl PAR Packager_ instead of panicparse.
-
-You have two choices, either you put `$GOPATH/bin` at the begining of `$PATH` or
-use long name `panicparse` with:
-
- go get github.com/maruel/panicparse
-
-then using `panicparse` instead of `pp`:
-
- go test 2> panicparse
diff --git a/vendor/github.com/maruel/panicparse/cmd/pp/main.go b/vendor/github.com/maruel/panicparse/cmd/pp/main.go
deleted file mode 100644
index 67d8e1a..0000000
--- a/vendor/github.com/maruel/panicparse/cmd/pp/main.go
+++ /dev/null
@@ -1,31 +0,0 @@
-// Copyright 2015 Marc-Antoine Ruel. All rights reserved.
-// Use of this source code is governed under the Apache License, Version 2.0
-// that can be found in the LICENSE file.
-
-// panicparse: analyzes stack dump of Go processes and simplifies it.
-//
-// It is mostly useful on servers will large number of identical goroutines,
-// making the crash dump harder to read than strictly necesary.
-//
-// Colors:
-// - Magenta: first goroutine to be listed.
-// - Yellow: main package.
-// - Green: standard library.
-// - Red: other packages.
-//
-// Bright colors are used for exported symbols.
-package main
-
-import (
- "fmt"
- "os"
-
- "github.com/maruel/panicparse/internal"
-)
-
-func main() {
- if err := internal.Main(); err != nil {
- fmt.Fprintf(os.Stderr, "Failed: %s\n", err)
- os.Exit(1)
- }
-}
diff --git a/vendor/github.com/maruel/panicparse/internal/goversion1.6.go b/vendor/github.com/maruel/panicparse/internal/goversion1.6.go
deleted file mode 100644
index 3bd5e5d..0000000
--- a/vendor/github.com/maruel/panicparse/internal/goversion1.6.go
+++ /dev/null
@@ -1,11 +0,0 @@
-// Copyright 2016 Marc-Antoine Ruel. All rights reserved.
-// Use of this source code is governed under the Apache License, Version 2.0
-// that can be found in the LICENSE file.
-
-// +build go1.6
-
-package internal
-
-const (
- showGOTRACEBACKBanner = true
-)
diff --git a/vendor/github.com/maruel/panicparse/internal/goversion1.go b/vendor/github.com/maruel/panicparse/internal/goversion1.go
deleted file mode 100644
index 3ee33e1..0000000
--- a/vendor/github.com/maruel/panicparse/internal/goversion1.go
+++ /dev/null
@@ -1,12 +0,0 @@
-// Copyright 2016 Marc-Antoine Ruel. All rights reserved.
-// Use of this source code is governed under the Apache License, Version 2.0
-// that can be found in the LICENSE file.
-
-// +build go1.1
-// +build !go1.6
-
-package internal
-
-const (
- showGOTRACEBACKBanner = false
-)
diff --git a/vendor/github.com/maruel/panicparse/internal/main.go b/vendor/github.com/maruel/panicparse/internal/main.go
deleted file mode 100644
index b4750d8..0000000
--- a/vendor/github.com/maruel/panicparse/internal/main.go
+++ /dev/null
@@ -1,139 +0,0 @@
-// Copyright 2015 Marc-Antoine Ruel. All rights reserved.
-// Use of this source code is governed under the Apache License, Version 2.0
-// that can be found in the LICENSE file.
-
-// Package internal implements panicparse
-//
-// It is mostly useful on servers will large number of identical goroutines,
-// making the crash dump harder to read than strictly necesary.
-//
-// Colors:
-// - Magenta: first goroutine to be listed.
-// - Yellow: main package.
-// - Green: standard library.
-// - Red: other packages.
-//
-// Bright colors are used for exported symbols.
-package internal
-
-import (
- "errors"
- "flag"
- "fmt"
- "io"
- "io/ioutil"
- "log"
- "os"
- "os/signal"
- "syscall"
-
- "github.com/maruel/panicparse/stack"
- "github.com/mattn/go-colorable"
- "github.com/mattn/go-isatty"
- "github.com/mgutz/ansi"
-)
-
-// resetFG is similar to ansi.Reset except that it doesn't reset the
-// background color, only the foreground color and the style.
-//
-// That much for the "ansi" abstraction layer...
-const resetFG = ansi.DefaultFG + "\033[m"
-
-// defaultPalette is the default recommended palette.
-var defaultPalette = stack.Palette{
- EOLReset: resetFG,
- RoutineFirst: ansi.ColorCode("magenta+b"),
- CreatedBy: ansi.LightBlack,
- Package: ansi.ColorCode("default+b"),
- SourceFile: resetFG,
- FunctionStdLib: ansi.Green,
- FunctionStdLibExported: ansi.ColorCode("green+b"),
- FunctionMain: ansi.ColorCode("yellow+b"),
- FunctionOther: ansi.Red,
- FunctionOtherExported: ansi.ColorCode("red+b"),
- Arguments: resetFG,
-}
-
-// process copies stdin to stdout and processes any "panic: " line found.
-func process(in io.Reader, out io.Writer, p *stack.Palette, s stack.Similarity, fullPath, parse bool) error {
- goroutines, err := stack.ParseDump(in, out)
- if err != nil {
- return err
- }
- if len(goroutines) == 1 && showBanner() {
- _, _ = io.WriteString(out, "\nTo see all goroutines, visit https://github.com/maruel/panicparse#GOTRACEBACK\n\n")
- }
- if parse {
- stack.Augment(goroutines)
- }
- buckets := stack.SortBuckets(stack.Bucketize(goroutines, s))
- srcLen, pkgLen := stack.CalcLengths(buckets, fullPath)
- for _, bucket := range buckets {
- _, _ = io.WriteString(out, p.BucketHeader(&bucket, fullPath, len(buckets) > 1))
- _, _ = io.WriteString(out, p.StackLines(&bucket.Signature, srcLen, pkgLen, fullPath))
- }
- return err
-}
-
-func showBanner() bool {
- if !showGOTRACEBACKBanner {
- return false
- }
- gtb := os.Getenv("GOTRACEBACK")
- return gtb == "" || gtb == "single"
-}
-
-// Main is implemented here so both 'pp' and 'panicparse' executables can be
-// compiled. This is to work around the Perl Package manager 'pp' that is
-// preinstalled on some OSes.
-func Main() error {
- signals := make(chan os.Signal)
- go func() {
- for {
- <-signals
- }
- }()
- signal.Notify(signals, os.Interrupt, syscall.SIGQUIT)
- aggressive := flag.Bool("aggressive", false, "Aggressive deduplication including non pointers")
- fullPath := flag.Bool("full-path", false, "Print full sources path")
- noColor := flag.Bool("no-color", !isatty.IsTerminal(os.Stdout.Fd()) || os.Getenv("TERM") == "dumb", "Disable coloring")
- forceColor := flag.Bool("force-color", false, "Forcibly enable coloring when with stdout is redirected")
- parse := flag.Bool("parse", true, "Parses source files to deduct types; use -parse=false to work around bugs in source parser")
- verboseFlag := flag.Bool("v", false, "Enables verbose logging output")
- flag.Parse()
-
- log.SetFlags(log.Lmicroseconds)
- if !*verboseFlag {
- log.SetOutput(ioutil.Discard)
- }
-
- s := stack.AnyPointer
- if *aggressive {
- s = stack.AnyValue
- }
-
- var out io.Writer
- p := &defaultPalette
- if *noColor && !*forceColor {
- p = &stack.Palette{}
- out = os.Stdout
- } else {
- out = colorable.NewColorableStdout()
- }
-
- var in *os.File
- switch flag.NArg() {
- case 0:
- in = os.Stdin
- case 1:
- var err error
- name := flag.Arg(0)
- if in, err = os.Open(name); err != nil {
- return fmt.Errorf("did you mean to specify a valid stack dump file name? %s", err)
- }
- defer in.Close()
- default:
- return errors.New("pipe from stdin or specify a single file")
- }
- return process(in, out, p, s, *fullPath, *parse)
-}
diff --git a/vendor/github.com/maruel/panicparse/internal/main_test.go b/vendor/github.com/maruel/panicparse/internal/main_test.go
deleted file mode 100644
index d6e27f0..0000000
--- a/vendor/github.com/maruel/panicparse/internal/main_test.go
+++ /dev/null
@@ -1,122 +0,0 @@
-// Copyright 2015 Marc-Antoine Ruel. All rights reserved.
-// Use of this source code is governed under the Apache License, Version 2.0
-// that can be found in the LICENSE file.
-
-package internal
-
-import (
- "bytes"
- "strings"
- "testing"
-
- "github.com/maruel/panicparse/stack"
- "github.com/maruel/ut"
-)
-
-var data = []string{
- "panic: runtime error: index out of range",
- "",
- "goroutine 11 [running, 5 minutes, locked to thread]:",
- "github.com/luci/luci-go/client/archiver.(*archiver).PushFile(0xc208032410, 0xc20968a3c0, 0x5b, 0xc20988c280, 0x7d, 0x0, 0x0)",
- " /gopath/path/to/archiver.go:325 +0x2c4",
- "github.com/luci/luci-go/client/isolate.archive(0x7fbdab7a5218, 0xc208032410, 0xc20803b0b0, 0x22, 0xc208046370, 0xc20804666a, 0x17, 0x0, 0x0, 0x0, ...)",
- " /gopath/path/to/isolate.go:148 +0x12d2",
- "github.com/luci/luci-go/client/isolate.Archive(0x7fbdab7a5218, 0xc208032410, 0xc20803b0b0, 0x22, 0xc208046370, 0x0, 0x0)",
- " /gopath/path/to/isolate.go:102 +0xc9",
- "main.func·004(0x7fffc3b8f13a, 0x2c)",
- " /gopath/path/to/batch_archive.go:166 +0x7cd",
- "created by main.(*batchArchiveRun).main",
- " /gopath/path/to/batch_archive.go:167 +0x42c",
- "",
- "goroutine 1 [running]:",
- "gopkg.in/yaml%2ev2.handleErr(0xc208033b20)",
- " /gopath/src/gopkg.in/yaml.v2/yaml.go:153 +0xc6",
- "reflect.Value.assignTo(0x570860, 0xc20803f3e0, 0x15)",
- " c:/go/src/reflect/value.go:2125 +0x368",
- "main.main()",
- " /gopath/src/github.com/maruel/pre-commit-go/main.go:428 +0x27",
- "",
- "goroutine 2 [running, 1 minutes]:",
- "gopkg.in/yaml%2ev2.handleErr(0xc208033b20)",
- " /gopath/src/gopkg.in/yaml.v2/yaml.go:153 +0xc6",
- "reflect.Value.assignTo(0x570860, 0xc20803f3e0, 0x15)",
- " c:/go/src/reflect/value.go:2125 +0x368",
- "main.main()",
- " /gopath/src/github.com/maruel/pre-commit-go/main.go:428 +0x27",
- "",
-}
-
-func TestProcess(t *testing.T) {
- out := &bytes.Buffer{}
- err := process(bytes.NewBufferString(strings.Join(data, "\n")), out, &defaultPalette, stack.AnyPointer, false, false)
- ut.AssertEqual(t, nil, err)
- expected := []string{
- "panic: runtime error: index out of range",
- "",
- "\x1b[1;35m1: running [5 minutes] [locked]\x1b[90m [Created by main.(*batchArchiveRun).main @ batch_archive.go:167]\x1b[39m\x1b[m",
- " \x1b[1;39marchiver \x1b[39m\x1b[marchiver.go:325 \x1b[1;31m(*archiver).PushFile\x1b[39m\x1b[m(#1, 0xc20968a3c0, 0x5b, 0xc20988c280, 0x7d, 0, 0)\x1b[39m\x1b[m",
- " \x1b[1;39misolate \x1b[39m\x1b[misolate.go:148 \x1b[31marchive\x1b[39m\x1b[m(#4, #1, #2, 0x22, #3, 0xc20804666a, 0x17, 0, 0, 0, ...)\x1b[39m\x1b[m",
- " \x1b[1;39misolate \x1b[39m\x1b[misolate.go:102 \x1b[1;31mArchive\x1b[39m\x1b[m(#4, #1, #2, 0x22, #3, 0, 0)\x1b[39m\x1b[m",
- " \x1b[1;39mmain \x1b[39m\x1b[mbatch_archive.go:166 \x1b[1;33mfunc·004\x1b[39m\x1b[m(0x7fffc3b8f13a, 0x2c)\x1b[39m\x1b[m",
- "2: running [0~1 minutes]\x1b[39m\x1b[m",
- " \x1b[1;39myaml.v2 \x1b[39m\x1b[myaml.go:153 \x1b[31mhandleErr\x1b[39m\x1b[m(#5)\x1b[39m\x1b[m",
- " \x1b[1;39mreflect \x1b[39m\x1b[mvalue.go:2125 \x1b[32mValue.assignTo\x1b[39m\x1b[m(0x570860, #6, 0x15)\x1b[39m\x1b[m",
- " \x1b[1;39mmain \x1b[39m\x1b[mmain.go:428 \x1b[1;33mmain\x1b[39m\x1b[m()\x1b[39m\x1b[m",
- "",
- }
- actual := strings.Split(out.String(), "\n")
- for i := 0; i < len(actual) && i < len(expected); i++ {
- ut.AssertEqualIndex(t, i, expected[i], actual[i])
- }
- ut.AssertEqual(t, expected, actual)
-}
-
-func TestProcessFullPath(t *testing.T) {
- out := &bytes.Buffer{}
- err := process(bytes.NewBufferString(strings.Join(data, "\n")), out, &defaultPalette, stack.AnyValue, true, false)
- ut.AssertEqual(t, nil, err)
- expected := []string{
- "panic: runtime error: index out of range",
- "",
- "\x1b[1;35m1: running [5 minutes] [locked]\x1b[90m [Created by main.(*batchArchiveRun).main @ /gopath/path/to/batch_archive.go:167]\x1b[39m\x1b[m",
- " \x1b[1;39marchiver \x1b[39m\x1b[m/gopath/path/to/archiver.go:325 \x1b[1;31m(*archiver).PushFile\x1b[39m\x1b[m(#1, 0xc20968a3c0, 0x5b, 0xc20988c280, 0x7d, 0, 0)\x1b[39m\x1b[m",
- " \x1b[1;39misolate \x1b[39m\x1b[m/gopath/path/to/isolate.go:148 \x1b[31marchive\x1b[39m\x1b[m(#4, #1, #2, 0x22, #3, 0xc20804666a, 0x17, 0, 0, 0, ...)\x1b[39m\x1b[m",
- " \x1b[1;39misolate \x1b[39m\x1b[m/gopath/path/to/isolate.go:102 \x1b[1;31mArchive\x1b[39m\x1b[m(#4, #1, #2, 0x22, #3, 0, 0)\x1b[39m\x1b[m",
- " \x1b[1;39mmain \x1b[39m\x1b[m/gopath/path/to/batch_archive.go:166 \x1b[1;33mfunc·004\x1b[39m\x1b[m(0x7fffc3b8f13a, 0x2c)\x1b[39m\x1b[m",
- "2: running [0~1 minutes]\x1b[39m\x1b[m",
- " \x1b[1;39myaml.v2 \x1b[39m\x1b[m/gopath/src/gopkg.in/yaml.v2/yaml.go:153 \x1b[31mhandleErr\x1b[39m\x1b[m(#5)\x1b[39m\x1b[m",
- " \x1b[1;39mreflect \x1b[39m\x1b[mc:/go/src/reflect/value.go:2125 \x1b[32mValue.assignTo\x1b[39m\x1b[m(0x570860, #6, 0x15)\x1b[39m\x1b[m",
- " \x1b[1;39mmain \x1b[39m\x1b[m/gopath/src/github.com/maruel/pre-commit-go/main.go:428 \x1b[1;33mmain\x1b[39m\x1b[m()\x1b[39m\x1b[m",
- "",
- }
- actual := strings.Split(out.String(), "\n")
- for i := 0; i < len(actual) && i < len(expected); i++ {
- ut.AssertEqualIndex(t, i, expected[i], actual[i])
- }
- ut.AssertEqual(t, expected, actual)
-}
-
-func TestProcessNoColor(t *testing.T) {
- out := &bytes.Buffer{}
- err := process(bytes.NewBufferString(strings.Join(data, "\n")), out, &stack.Palette{}, stack.AnyPointer, false, false)
- ut.AssertEqual(t, nil, err)
- expected := []string{
- "panic: runtime error: index out of range",
- "",
- "1: running [5 minutes] [locked] [Created by main.(*batchArchiveRun).main @ batch_archive.go:167]",
- " archiver archiver.go:325 (*archiver).PushFile(#1, 0xc20968a3c0, 0x5b, 0xc20988c280, 0x7d, 0, 0)",
- " isolate isolate.go:148 archive(#4, #1, #2, 0x22, #3, 0xc20804666a, 0x17, 0, 0, 0, ...)",
- " isolate isolate.go:102 Archive(#4, #1, #2, 0x22, #3, 0, 0)",
- " main batch_archive.go:166 func·004(0x7fffc3b8f13a, 0x2c)",
- "2: running [0~1 minutes]",
- " yaml.v2 yaml.go:153 handleErr(#5)",
- " reflect value.go:2125 Value.assignTo(0x570860, #6, 0x15)",
- " main main.go:428 main()",
- "",
- }
- actual := strings.Split(out.String(), "\n")
- for i := 0; i < len(actual) && i < len(expected); i++ {
- ut.AssertEqualIndex(t, i, expected[i], actual[i])
- }
- ut.AssertEqual(t, expected, actual)
-}
diff --git a/vendor/github.com/maruel/panicparse/internal/panic/main.go b/vendor/github.com/maruel/panicparse/internal/panic/main.go
deleted file mode 100644
index 8273c2e..0000000
--- a/vendor/github.com/maruel/panicparse/internal/panic/main.go
+++ /dev/null
@@ -1,152 +0,0 @@
-// Copyright 2017 Marc-Antoine Ruel. All rights reserved.
-// Use of this source code is governed under the Apache License, Version 2.0
-// that can be found in the LICENSE file.
-
-// Panic crashes in various ways.
-//
-// It is a tool to help test panicparse.
-package main
-
-// To install, run:
-// go install github.com/maruel/panicparse/internal/panic
-// panic -help
-//
-// You can also run directly:
-// go run ./internal/panic/main.go str |& pp
-//
-// To add a new panic stack signature, add it to types type below, keeping the
-// list ordered by name. If you need utility functions, add it in the section
-// below. That's it!
-
-import (
- "fmt"
- "io"
- "os"
- "sort"
- "sync"
- "time"
-)
-
-// Utility functions.
-
-func panicint(i int) {
- panic(i)
-}
-
-func panicstr(a string) {
- panic(a)
-}
-
-func panicslicestr(a []string) {
- panic(a)
-}
-
-//
-
-// types is all the supported types of panics.
-//
-// Keep the list sorted.
-var types = map[string]struct {
- desc string
- f func()
-}{
- "goroutine_1": {
- "panic in one goroutine",
- func() {
- go func() {
- panicint(42)
- }()
- time.Sleep(time.Minute)
- },
- },
-
- "goroutine_100": {
- "start 100 goroutines before panicking",
- func() {
- var wg sync.WaitGroup
- for i := 0; i < 100; i++ {
- wg.Add(1)
- go func() {
- wg.Done()
- time.Sleep(time.Minute)
- }()
- }
- wg.Wait()
- panicint(42)
- },
- },
-
- "int": {
- "panic(42)",
- func() {
- panicint(42)
- },
- },
-
- "simple": {
- // This is not used for real, here for documentation.
- "skip the map for a shorter stack trace",
- func() {},
- },
-
- "slice_str": {
- "panic([]string{\"allo\"}) with cap=2",
- func() {
- a := make([]string, 1, 2)
- a[0] = "allo"
- panicslicestr(a)
- },
- },
-
- "str": {
- "panic(\"allo\")",
- func() {
- panicstr("allo")
- },
- },
-}
-
-//
-
-func main() {
- fmt.Printf("GOTRACEBACK=%s\n", os.Getenv("GOTRACEBACK"))
- if len(os.Args) == 2 {
- n := os.Args[1]
- if n == "simple" {
- // Since the map lookup creates another call stack entry, add a one-off
- // "simple" to test the very minimal case.
- panic("simple")
- }
- if f, ok := types[n]; ok {
- f.f()
- }
- }
- usage()
-}
-
-func usage() {
- t := `usage: panic
-
-This tool is meant to be used with panicparse to test different parsing
-scenarios and ensure output on different version of the Go toolchain can be
-successfully parsed.
-
-Set GOTRACEBACK before running this tool to see how it affects the panic output.
-
-Select the way to panic:
-`
- io.WriteString(os.Stderr, t)
- names := make([]string, 0, len(types))
- m := 0
- for n := range types {
- names = append(names, n)
- if i := len(n); i > m {
- m = i
- }
- }
- sort.Strings(names)
- for _, n := range names {
- fmt.Fprintf(os.Stderr, "- %-*s %s\n", m, n, types[n].desc)
- }
- os.Exit(2)
-}
diff --git a/vendor/github.com/maruel/panicparse/main.go b/vendor/github.com/maruel/panicparse/main.go
deleted file mode 100644
index 67d8e1a..0000000
--- a/vendor/github.com/maruel/panicparse/main.go
+++ /dev/null
@@ -1,31 +0,0 @@
-// Copyright 2015 Marc-Antoine Ruel. All rights reserved.
-// Use of this source code is governed under the Apache License, Version 2.0
-// that can be found in the LICENSE file.
-
-// panicparse: analyzes stack dump of Go processes and simplifies it.
-//
-// It is mostly useful on servers will large number of identical goroutines,
-// making the crash dump harder to read than strictly necesary.
-//
-// Colors:
-// - Magenta: first goroutine to be listed.
-// - Yellow: main package.
-// - Green: standard library.
-// - Red: other packages.
-//
-// Bright colors are used for exported symbols.
-package main
-
-import (
- "fmt"
- "os"
-
- "github.com/maruel/panicparse/internal"
-)
-
-func main() {
- if err := internal.Main(); err != nil {
- fmt.Fprintf(os.Stderr, "Failed: %s\n", err)
- os.Exit(1)
- }
-}
diff --git a/vendor/github.com/maruel/panicparse/stack/source.go b/vendor/github.com/maruel/panicparse/stack/source.go
deleted file mode 100644
index a747250..0000000
--- a/vendor/github.com/maruel/panicparse/stack/source.go
+++ /dev/null
@@ -1,302 +0,0 @@
-// Copyright 2015 Marc-Antoine Ruel. All rights reserved.
-// Use of this source code is governed under the Apache License, Version 2.0
-// that can be found in the LICENSE file.
-
-// This file contains the code to process sources, to be able to deduct the
-// original types.
-
-package stack
-
-import (
- "bytes"
- "fmt"
- "go/ast"
- "go/parser"
- "go/token"
- "io/ioutil"
- "log"
- "math"
- "strings"
-)
-
-// cache is a cache of sources on the file system.
-type cache struct {
- files map[string][]byte
- parsed map[string]*parsedFile
-}
-
-// Augment processes source files to improve calls to be more descriptive.
-//
-// It modifies goroutines in place.
-func Augment(goroutines []Goroutine) {
- c := &cache{}
- for i := range goroutines {
- c.augmentGoroutine(&goroutines[i])
- }
-}
-
-// augmentGoroutine processes source files to improve call to be more
-// descriptive.
-//
-// It modifies the routine.
-func (c *cache) augmentGoroutine(goroutine *Goroutine) {
- if c.files == nil {
- c.files = map[string][]byte{}
- }
- if c.parsed == nil {
- c.parsed = map[string]*parsedFile{}
- }
- // For each call site, look at the next call and populate it. Then we can
- // walk back and reformat things.
- for i := range goroutine.Stack.Calls {
- c.load(goroutine.Stack.Calls[i].SourcePath)
- }
-
- // Once all loaded, we can look at the next call when available.
- for i := 0; i < len(goroutine.Stack.Calls)-1; i++ {
- // Get the AST from the previous call and process the call line with it.
- if f := c.getFuncAST(&goroutine.Stack.Calls[i]); f != nil {
- processCall(&goroutine.Stack.Calls[i], f)
- }
- }
-}
-
-// Private stuff.
-
-// load loads a source file and parses the AST tree. Failures are ignored.
-func (c *cache) load(fileName string) {
- if _, ok := c.parsed[fileName]; ok {
- return
- }
- c.parsed[fileName] = nil
- if !strings.HasSuffix(fileName, ".go") {
- // Ignore C and assembly.
- c.files[fileName] = nil
- return
- }
- log.Printf("load(%s)", fileName)
- if _, ok := c.files[fileName]; !ok {
- var err error
- if c.files[fileName], err = ioutil.ReadFile(fileName); err != nil {
- log.Printf("Failed to read %s: %s", fileName, err)
- c.files[fileName] = nil
- return
- }
- }
- fset := token.NewFileSet()
- src := c.files[fileName]
- parsed, err := parser.ParseFile(fset, fileName, src, 0)
- if err != nil {
- log.Printf("Failed to parse %s: %s", fileName, err)
- return
- }
- // Convert the line number into raw file offset.
- offsets := []int{0, 0}
- start := 0
- for l := 1; start < len(src); l++ {
- start += bytes.IndexByte(src[start:], '\n') + 1
- offsets = append(offsets, start)
- }
- c.parsed[fileName] = &parsedFile{offsets, parsed}
-}
-
-func (c *cache) getFuncAST(call *Call) *ast.FuncDecl {
- if p := c.parsed[call.SourcePath]; p != nil {
- return p.getFuncAST(call.Func.Name(), call.Line)
- }
- return nil
-}
-
-type parsedFile struct {
- lineToByteOffset []int
- parsed *ast.File
-}
-
-// getFuncAST gets the callee site function AST representation for the code
-// inside the function f at line l.
-func (p *parsedFile) getFuncAST(f string, l int) (d *ast.FuncDecl) {
- if len(p.lineToByteOffset) <= l {
- // The line number in the stack trace line does not exist in the file. That
- // can only mean that the sources on disk do not match the sources used to
- // build the binary.
- // TODO(maruel): This should be surfaced, so that source parsing is
- // completely ignored.
- return
- }
-
- // Walk the AST to find the lineToByteOffset that fits the line number.
- var lastFunc *ast.FuncDecl
- var found ast.Node
- // Inspect() goes depth first. This means for example that a function like:
- // func a() {
- // b := func() {}
- // c()
- // }
- //
- // Were we are looking at the c() call can return confused values. It is
- // important to look at the actual ast.Node hierarchy.
- ast.Inspect(p.parsed, func(n ast.Node) bool {
- if d != nil {
- return false
- }
- if n == nil {
- return true
- }
- if found != nil {
- // We are walking up.
- }
- if int(n.Pos()) >= p.lineToByteOffset[l] {
- // We are expecting a ast.CallExpr node. It can be harder to figure out
- // when there are multiple calls on a single line, as the stack trace
- // doesn't have file byte offset information, only line based.
- // gofmt will always format to one function call per line but there can
- // be edge cases, like:
- // a = A{Foo(), Bar()}
- d = lastFunc
- //p.processNode(call, n)
- return false
- } else if f, ok := n.(*ast.FuncDecl); ok {
- lastFunc = f
- }
- return true
- })
- return
-}
-
-func name(n ast.Node) string {
- switch t := n.(type) {
- case *ast.InterfaceType:
- return "interface{}"
- case *ast.Ident:
- return t.Name
- case *ast.SelectorExpr:
- return t.Sel.Name
- case *ast.StarExpr:
- return "*" + name(t.X)
- default:
- return ""
- }
-}
-
-// fieldToType returns the type name and whether if it's an ellipsis.
-func fieldToType(f *ast.Field) (string, bool) {
- switch arg := f.Type.(type) {
- case *ast.ArrayType:
- return "[]" + name(arg.Elt), false
- case *ast.Ellipsis:
- return name(arg.Elt), true
- case *ast.FuncType:
- // Do not print the function signature to not overload the trace.
- return "func", false
- case *ast.Ident:
- return arg.Name, false
- case *ast.InterfaceType:
- return "interface{}", false
- case *ast.SelectorExpr:
- return arg.Sel.Name, false
- case *ast.StarExpr:
- return "*" + name(arg.X), false
- case *ast.MapType:
- return fmt.Sprintf("map[%s]%s", name(arg.Key), name(arg.Value)), false
- case *ast.ChanType:
- return fmt.Sprintf("chan %s", name(arg.Value)), false
- default:
- // TODO(maruel): Implement anything missing.
- return "", false
- }
-}
-
-// extractArgumentsType returns the name of the type of each input argument.
-func extractArgumentsType(f *ast.FuncDecl) ([]string, bool) {
- var fields []*ast.Field
- if f.Recv != nil {
- if len(f.Recv.List) != 1 {
- panic("Expect only one receiver; please fix panicparse's code")
- }
- // If it is an object receiver (vs a pointer receiver), its address is not
- // printed in the stack trace so it needs to be ignored.
- if _, ok := f.Recv.List[0].Type.(*ast.StarExpr); ok {
- fields = append(fields, f.Recv.List[0])
- }
- }
- var types []string
- extra := false
- for _, arg := range append(fields, f.Type.Params.List...) {
- // Assert that extra is only set on the last item of fields?
- var t string
- t, extra = fieldToType(arg)
- mult := len(arg.Names)
- if mult == 0 {
- mult = 1
- }
- for i := 0; i < mult; i++ {
- types = append(types, t)
- }
- }
- return types, extra
-}
-
-// processCall walks the function and populate call accordingly.
-func processCall(call *Call, f *ast.FuncDecl) {
- values := make([]uint64, len(call.Args.Values))
- for i := range call.Args.Values {
- values[i] = call.Args.Values[i].Value
- }
- index := 0
- pop := func() uint64 {
- if len(values) != 0 {
- x := values[0]
- values = values[1:]
- index++
- return x
- }
- return 0
- }
- popName := func() string {
- n := call.Args.Values[index].Name
- v := pop()
- if len(n) == 0 {
- return fmt.Sprintf("0x%x", v)
- }
- return n
- }
-
- types, extra := extractArgumentsType(f)
- for i := 0; len(values) != 0; i++ {
- var t string
- if i >= len(types) {
- if !extra {
- // These are unexpected value! Print them as hex.
- call.Args.Processed = append(call.Args.Processed, popName())
- continue
- }
- t = types[len(types)-1]
- } else {
- t = types[i]
- }
- switch t {
- case "float32":
- call.Args.Processed = append(call.Args.Processed, fmt.Sprintf("%g", math.Float32frombits(uint32(pop()))))
- case "float64":
- call.Args.Processed = append(call.Args.Processed, fmt.Sprintf("%g", math.Float64frombits(pop())))
- case "int", "int8", "int16", "int32", "int64", "uint", "uint8", "uint16", "uint32", "uint64":
- call.Args.Processed = append(call.Args.Processed, fmt.Sprintf("%d", pop()))
- case "string":
- call.Args.Processed = append(call.Args.Processed, fmt.Sprintf("%s(%s, len=%d)", t, popName(), pop()))
- default:
- if strings.HasPrefix(t, "*") {
- call.Args.Processed = append(call.Args.Processed, fmt.Sprintf("%s(%s)", t, popName()))
- } else if strings.HasPrefix(t, "[]") {
- call.Args.Processed = append(call.Args.Processed, fmt.Sprintf("%s(%s len=%d cap=%d)", t, popName(), pop(), pop()))
- } else {
- // Assumes it's an interface. For now, discard the object value, which
- // is probably not a good idea.
- call.Args.Processed = append(call.Args.Processed, fmt.Sprintf("%s(%s)", t, popName()))
- pop()
- }
- }
- if len(values) == 0 && call.Args.Elided {
- return
- }
- }
-}
diff --git a/vendor/github.com/maruel/panicparse/stack/source_test.go b/vendor/github.com/maruel/panicparse/stack/source_test.go
deleted file mode 100644
index 1c5d194..0000000
--- a/vendor/github.com/maruel/panicparse/stack/source_test.go
+++ /dev/null
@@ -1,563 +0,0 @@
-// Copyright 2015 Marc-Antoine Ruel. All rights reserved.
-// Use of this source code is governed under the Apache License, Version 2.0
-// that can be found in the LICENSE file.
-
-package stack
-
-import (
- "bytes"
- "fmt"
- "io/ioutil"
- "os"
- "os/exec"
- "path/filepath"
- "strings"
- "testing"
-
- "github.com/maruel/ut"
-)
-
-func TestAugment(t *testing.T) {
- data := []struct {
- name string
- input string
- expected Stack
- }{
- {
- "Local function doesn't interfere",
- `package main
- func f(s string) {
- a := func(i int) int {
- return 1 + i
- }
- _ = a(3)
- panic("ooh")
- }
- func main() {
- f("yo")
- }`,
- Stack{
- Calls: []Call{
- {
- SourcePath: "main.go", Line: 7, Func: Function{"main.f"},
- Args: Args{
- Values: []Arg{{Value: pointer, Name: ""}, {Value: 0x2}},
- },
- },
- {SourcePath: "main.go", Line: 10, Func: Function{"main.main"}},
- },
- },
- },
- {
- "func",
- `package main
- func f(a func() string) {
- panic(a())
- }
- func main() {
- f(func() string { return "ooh" })
- }`,
- Stack{
- Calls: []Call{
- {
- SourcePath: "main.go", Line: 3, Func: Function{Raw: "main.f"},
- Args: Args{Values: []Arg{{Value: pointer}}},
- },
- {SourcePath: "main.go", Line: 6, Func: Function{Raw: "main.main"}},
- },
- },
- },
- {
- "func ellipsis",
- `package main
- func f(a ...func() string) {
- panic(a[0]())
- }
- func main() {
- f(func() string { return "ooh" })
- }`,
- Stack{
- Calls: []Call{
- {
- SourcePath: "main.go", Line: 3, Func: Function{Raw: "main.f"},
- Args: Args{
- Values: []Arg{{Value: pointer}, {Value: 0x1}, {Value: 0x1}},
- },
- },
- {SourcePath: "main.go", Line: 6, Func: Function{Raw: "main.main"}},
- },
- },
- },
- {
- "interface{}",
- `package main
- func f(a []interface{}) {
- panic("ooh")
- }
- func main() {
- f(make([]interface{}, 5, 7))
- }`,
- Stack{
- Calls: []Call{
- {
- SourcePath: "main.go", Line: 3, Func: Function{Raw: "main.f"},
- Args: Args{
- Values: []Arg{{Value: pointer}, {Value: 0x5}, {Value: 0x7}},
- },
- },
- {SourcePath: "main.go", Line: 6, Func: Function{Raw: "main.main"}},
- },
- },
- },
- {
- "[]int",
- `package main
- func f(a []int) {
- panic("ooh")
- }
- func main() {
- f(make([]int, 5, 7))
- }`,
- Stack{
- Calls: []Call{
- {
- SourcePath: "main.go", Line: 3, Func: Function{Raw: "main.f"},
- Args: Args{
- Values: []Arg{{Value: pointer}, {Value: 5}, {Value: 7}},
- },
- },
- {SourcePath: "main.go", Line: 6, Func: Function{Raw: "main.main"}},
- },
- },
- },
- {
- "[]interface{}",
- `package main
- func f(a []interface{}) {
- panic(a[0].(string))
- }
- func main() {
- f([]interface{}{"ooh"})
- }`,
- Stack{
- Calls: []Call{
- {
- SourcePath: "main.go", Line: 3, Func: Function{Raw: "main.f"},
- Args: Args{
- Values: []Arg{{Value: pointer}, {Value: 1}, {Value: 1}},
- },
- },
- {SourcePath: "main.go", Line: 6, Func: Function{Raw: "main.main"}},
- },
- },
- },
- {
- "map[int]int",
- `package main
- func f(a map[int]int) {
- panic("ooh")
- }
- func main() {
- f(map[int]int{1: 2})
- }`,
- Stack{
- Calls: []Call{
- {
- SourcePath: "main.go", Line: 3, Func: Function{Raw: "main.f"},
- Args: Args{
- Values: []Arg{{Value: pointer}},
- },
- },
- {SourcePath: "main.go", Line: 6, Func: Function{Raw: "main.main"}},
- },
- },
- },
- {
- "map[interface{}]interface{}",
- `package main
- func f(a map[interface{}]interface{}) {
- panic("ooh")
- }
- func main() {
- f(make(map[interface{}]interface{}))
- }`,
- Stack{
- Calls: []Call{
- {
- SourcePath: "main.go", Line: 3, Func: Function{Raw: "main.f"},
- Args: Args{
- Values: []Arg{{Value: pointer}},
- },
- },
- {SourcePath: "main.go", Line: 6, Func: Function{Raw: "main.main"}},
- },
- },
- },
- {
- "chan int",
- `package main
- func f(a chan int) {
- panic("ooh")
- }
- func main() {
- f(make(chan int))
- }`,
- Stack{
- Calls: []Call{
- {
- SourcePath: "main.go", Line: 3, Func: Function{Raw: "main.f"},
- Args: Args{
- Values: []Arg{{Value: pointer}},
- },
- },
- {SourcePath: "main.go", Line: 6, Func: Function{Raw: "main.main"}},
- },
- },
- },
- {
- "chan interface{}",
- `package main
- func f(a chan interface{}) {
- panic("ooh")
- }
- func main() {
- f(make(chan interface{}))
- }`,
- Stack{
- Calls: []Call{
- {
- SourcePath: "main.go", Line: 3, Func: Function{Raw: "main.f"},
- Args: Args{
- Values: []Arg{{Value: pointer}},
- },
- },
- {SourcePath: "main.go", Line: 6, Func: Function{Raw: "main.main"}},
- },
- },
- },
- {
- "non-pointer method",
- `package main
- type S struct {
- }
- func (s S) f() {
- panic("ooh")
- }
- func main() {
- var s S
- s.f()
- }`,
- Stack{
- Calls: []Call{
- {SourcePath: "main.go", Line: 5, Func: Function{Raw: "main.S.f"}},
- {SourcePath: "main.go", Line: 9, Func: Function{Raw: "main.main"}},
- },
- },
- },
- {
- "pointer method",
- `package main
- type S struct {
- }
- func (s *S) f() {
- panic("ooh")
- }
- func main() {
- var s S
- s.f()
- }`,
- Stack{
- Calls: []Call{
- {
- SourcePath: "main.go", Line: 5, Func: Function{Raw: "main.(*S).f"},
- Args: Args{Values: []Arg{{Value: pointer}}},
- },
- {SourcePath: "main.go", Line: 9, Func: Function{Raw: "main.main"}},
- },
- },
- },
- {
- "string",
- `package main
- func f(s string) {
- panic(s)
- }
- func main() {
- f("ooh")
- }`,
- Stack{
- Calls: []Call{
- {
- SourcePath: "main.go", Line: 3, Func: Function{Raw: "main.f"},
- Args: Args{Values: []Arg{{Value: pointer}, {Value: 0x3}}},
- },
- {SourcePath: "main.go", Line: 6, Func: Function{Raw: "main.main"}},
- },
- },
- },
- {
- "string and int",
- `package main
- func f(s string, i int) {
- panic(s)
- }
- func main() {
- f("ooh", 42)
- }`,
- Stack{
- Calls: []Call{
- {
- SourcePath: "main.go", Line: 3, Func: Function{Raw: "main.f"},
- Args: Args{Values: []Arg{{Value: pointer}, {Value: 0x3}, {Value: 42}}},
- },
- {SourcePath: "main.go", Line: 6, Func: Function{Raw: "main.main"}},
- },
- },
- },
- {
- "values are elided",
- `package main
- func f(s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11, s12 int, s13 interface{}) {
- panic("ooh")
- }
- func main() {
- f(0, 0, 0, 0, 0, 0, 0, 0, 42, 43, 44, 45, nil)
- }`,
- Stack{
- Calls: []Call{
- {
- SourcePath: "main.go", Line: 3, Func: Function{Raw: "main.f"},
- Args: Args{
- Values: []Arg{{}, {}, {}, {}, {}, {}, {}, {}, {Value: 42}, {Value: 43}},
- Elided: true,
- },
- },
- {SourcePath: "main.go", Line: 6, Func: Function{Raw: "main.main"}},
- },
- },
- },
- {
- "error",
- `package main
- import "errors"
- func f(err error) {
- panic(err.Error())
- }
- func main() {
- f(errors.New("ooh"))
- }`,
- Stack{
- Calls: []Call{
- {
- SourcePath: "main.go", Line: 4, Func: Function{Raw: "main.f"},
- Args: Args{
- Values: []Arg{{Value: pointer}, {Value: pointer}},
- },
- },
- {SourcePath: "main.go", Line: 7, Func: Function{Raw: "main.main"}},
- },
- },
- },
- {
- "error unnamed",
- `package main
- import "errors"
- func f(error) {
- panic("ooh")
- }
- func main() {
- f(errors.New("ooh"))
- }`,
- Stack{
- Calls: []Call{
- {
- SourcePath: "main.go", Line: 4, Func: Function{Raw: "main.f"},
- Args: Args{
- Values: []Arg{{Value: pointer}, {Value: pointer}},
- },
- },
- {SourcePath: "main.go", Line: 7, Func: Function{Raw: "main.main"}},
- },
- },
- },
- {
- "float32",
- `package main
- func f(v float32) {
- panic("ooh")
- }
- func main() {
- f(0.5)
- }`,
- Stack{
- Calls: []Call{
- {
- SourcePath: "main.go", Line: 3, Func: Function{Raw: "main.f"},
- Args: Args{
- // The value is NOT a pointer but floating point encoding is not
- // deterministic.
- Values: []Arg{{Value: pointer}},
- },
- },
- {SourcePath: "main.go", Line: 6, Func: Function{Raw: "main.main"}},
- },
- },
- },
- {
- "float64",
- `package main
- func f(v float64) {
- panic("ooh")
- }
- func main() {
- f(0.5)
- }`,
- Stack{
- Calls: []Call{
- {
- SourcePath: "main.go", Line: 3, Func: Function{Raw: "main.f"},
- Args: Args{
- // The value is NOT a pointer but floating point encoding is not
- // deterministic.
- Values: []Arg{{Value: pointer}},
- },
- },
- {SourcePath: "main.go", Line: 6, Func: Function{Raw: "main.main"}},
- },
- },
- },
- }
-
- for i, line := range data {
- extra := bytes.Buffer{}
- _, content := getCrash(t, line.input)
- goroutines, err := ParseDump(bytes.NewBuffer(content), &extra)
- if err != nil {
- t.Fatalf("failed to parse input for test %s: %v", line.name, err)
- }
- // On go1.4, there's one less space.
- actual := extra.String()
- if actual != "panic: ooh\n\nexit status 2\n" && actual != "panic: ooh\nexit status 2\n" {
- t.Fatalf("Unexpected panic output:\n%#v", actual)
- }
- s := goroutines[0].Signature.Stack
- t.Logf("Test: %v", line.name)
- zapPointers(t, line.name, &line.expected, &s)
- zapPaths(&s)
- ut.AssertEqualIndex(t, i, line.expected, s)
- }
-}
-
-func TestAugmentDummy(t *testing.T) {
- goroutines := []Goroutine{
- {
- Signature: Signature{
- Stack: Stack{
- Calls: []Call{{SourcePath: "missing.go"}},
- },
- },
- },
- }
- Augment(goroutines)
-}
-
-func TestLoad(t *testing.T) {
- c := &cache{
- files: map[string][]byte{"bad.go": []byte("bad content")},
- parsed: map[string]*parsedFile{},
- }
- c.load("foo.asm")
- c.load("bad.go")
- c.load("doesnt_exist.go")
- if l := len(c.parsed); l != 3 {
- t.Fatalf("expected 3, got %d", l)
- }
- if c.parsed["foo.asm"] != nil {
- t.Fatalf("foo.asm is not present; should not have been loaded")
- }
- if c.parsed["bad.go"] != nil {
- t.Fatalf("bad.go is not valid code; should not have been loaded")
- }
- if c.parsed["doesnt_exist.go"] != nil {
- t.Fatalf("doesnt_exist.go is not present; should not have been loaded")
- }
- if c.getFuncAST(&Call{SourcePath: "other"}) != nil {
- t.Fatalf("there's no 'other'")
- }
-}
-
-//
-
-const pointer = uint64(0xfffffffff)
-const pointerStr = "0xfffffffff"
-
-func overrideEnv(env []string, key, value string) []string {
- prefix := key + "="
- for i, e := range env {
- if strings.HasPrefix(e, prefix) {
- env[i] = prefix + value
- return env
- }
- }
- return append(env, prefix+value)
-}
-
-func getCrash(t *testing.T, content string) (string, []byte) {
- name, err := ioutil.TempDir("", "panicparse")
- if err != nil {
- t.Fatalf("failed to create temporary directory: %v", err)
- }
- defer func() {
- if err := os.RemoveAll(name); err != nil {
- t.Fatalf("failed to remove temporary directory %q: %v", name, err)
- }
- }()
- main := filepath.Join(name, "main.go")
- if err := ioutil.WriteFile(main, []byte(content), 0500); err != nil {
- t.Fatalf("failed to write %q: %v", main, err)
- }
- cmd := exec.Command("go", "run", main)
- // Use the Go 1.4 compatible format.
- cmd.Env = overrideEnv(os.Environ(), "GOTRACEBACK", "1")
- out, err := cmd.CombinedOutput()
- if err == nil {
- t.Fatal("expected error since this is supposed to crash")
- }
- return main, out
-}
-
-// zapPointers zaps out pointers.
-func zapPointers(t *testing.T, name string, expected, s *Stack) {
- for i := range s.Calls {
- if i >= len(expected.Calls) {
- // When using GOTRACEBACK=2, it'll include runtime.main() and
- // runtime.goexit(). Ignore these since they could be changed in a future
- // version.
- s.Calls = s.Calls[:len(expected.Calls)]
- break
- }
- for j := range s.Calls[i].Args.Values {
- if j >= len(expected.Calls[i].Args.Values) {
- break
- }
- if expected.Calls[i].Args.Values[j].Value == pointer {
- // Replace the pointer value.
- if s.Calls[i].Args.Values[j].Value == 0 {
- t.Fatalf("%s: Call %d, value %d, expected pointer, got 0", name, i, j)
- }
- old := fmt.Sprintf("0x%x", s.Calls[i].Args.Values[j].Value)
- s.Calls[i].Args.Values[j].Value = pointer
- for k := range s.Calls[i].Args.Processed {
- s.Calls[i].Args.Processed[k] = strings.Replace(s.Calls[i].Args.Processed[k], old, pointerStr, -1)
- }
- }
- }
- }
-}
-
-// zapPaths removes the directory part and only keep the base file name.
-func zapPaths(s *Stack) {
- for j := range s.Calls {
- s.Calls[j].SourcePath = filepath.Base(s.Calls[j].SourcePath)
- }
-}
diff --git a/vendor/github.com/maruel/panicparse/stack/stack.go b/vendor/github.com/maruel/panicparse/stack/stack.go
deleted file mode 100644
index a9917ed..0000000
--- a/vendor/github.com/maruel/panicparse/stack/stack.go
+++ /dev/null
@@ -1,832 +0,0 @@
-// Copyright 2015 Marc-Antoine Ruel. All rights reserved.
-// Use of this source code is governed under the Apache License, Version 2.0
-// that can be found in the LICENSE file.
-
-// Package stack analyzes stack dump of Go processes and simplifies it.
-//
-// It is mostly useful on servers will large number of identical goroutines,
-// making the crash dump harder to read than strictly necesary.
-package stack
-
-import (
- "bufio"
- "bytes"
- "errors"
- "fmt"
- "io"
- "math"
- "net/url"
- "os"
- "path/filepath"
- "regexp"
- "runtime"
- "sort"
- "strconv"
- "strings"
- "unicode"
- "unicode/utf8"
-)
-
-const lockedToThread = "locked to thread"
-
-var (
- // TODO(maruel): Handle corrupted stack cases:
- // - missed stack barrier
- // - found next stack barrier at 0x123; expected
- // - runtime: unexpected return pc for FUNC_NAME called from 0x123
-
- reRoutineHeader = regexp.MustCompile("^goroutine (\\d+) \\[([^\\]]+)\\]\\:\r?\n$")
- reMinutes = regexp.MustCompile("^(\\d+) minutes$")
- reUnavail = regexp.MustCompile("^(?:\t| +)goroutine running on other thread; stack unavailable")
- // See gentraceback() in src/runtime/traceback.go for more information.
- // - Sometimes the source file comes up as "". It is the
- // compiler than generated these, not the runtime.
- // - The tab may be replaced with spaces when a user copy-paste it, handle
- // this transparently.
- // - "runtime.gopanic" is explicitly replaced with "panic" by gentraceback().
- // - The +0x123 byte offset is printed when frame.pc > _func.entry. _func is
- // generated by the linker.
- // - The +0x123 byte offset is not included with generated code, e.g. unnamed
- // functions "func·006()" which is generally go func() { ... }()
- // statements. Since the _func is generated at runtime, it's probably why
- // _func.entry is not set.
- // - C calls may have fp=0x123 sp=0x123 appended. I think it normally happens
- // when a signal is not correctly handled. It is printed with m.throwing>0.
- // These are discarded.
- // - For cgo, the source file may be "??".
- reFile = regexp.MustCompile("^(?:\t| +)(\\?\\?|\\|.+\\.(?:c|go|s))\\:(\\d+)(?:| \\+0x[0-9a-f]+)(?:| fp=0x[0-9a-f]+ sp=0x[0-9a-f]+)\r?\n$")
- // Sadly, it doesn't note the goroutine number so we could cascade them per
- // parenthood.
- reCreated = regexp.MustCompile("^created by (.+)\r?\n$")
- reFunc = regexp.MustCompile("^(.+)\\((.*)\\)\r?\n$")
- reElided = regexp.MustCompile("^\\.\\.\\.additional frames elided\\.\\.\\.\r?\n$")
- // Include frequent GOROOT value on Windows, distro provided and user
- // installed path. This simplifies the user's life when processing a trace
- // generated on another VM.
- // TODO(maruel): Guess the path automatically via traces containing the
- // 'runtime' package, which is very frequent. This would be "less bad" than
- // throwing up random values at the parser.
- goroots = []string{runtime.GOROOT(), "c:/go", "/usr/lib/go", "/usr/local/go"}
-)
-
-// Similarity is the level at which two call lines arguments must match to be
-// considered similar enough to coalesce them.
-type Similarity int
-
-const (
- // ExactFlags requires same bits (e.g. Locked).
- ExactFlags Similarity = iota
- // ExactLines requests the exact same arguments on the call line.
- ExactLines
- // AnyPointer considers different pointers a similar call line.
- AnyPointer
- // AnyValue accepts any value as similar call line.
- AnyValue
-)
-
-// Function is a function call.
-//
-// Go stack traces print a mangled function call, this wrapper unmangle the
-// string before printing and adds other filtering methods.
-type Function struct {
- Raw string
-}
-
-// String is the fully qualified function name.
-//
-// Sadly Go is a bit confused when the package name doesn't match the directory
-// containing the source file and will use the directory name instead of the
-// real package name.
-func (f Function) String() string {
- s, _ := url.QueryUnescape(f.Raw)
- return s
-}
-
-// Name is the naked function name.
-func (f Function) Name() string {
- parts := strings.SplitN(filepath.Base(f.Raw), ".", 2)
- if len(parts) == 1 {
- return parts[0]
- }
- return parts[1]
-}
-
-// PkgName is the package name for this function reference.
-func (f Function) PkgName() string {
- parts := strings.SplitN(filepath.Base(f.Raw), ".", 2)
- if len(parts) == 1 {
- return ""
- }
- s, _ := url.QueryUnescape(parts[0])
- return s
-}
-
-// PkgDotName returns "." format.
-func (f Function) PkgDotName() string {
- parts := strings.SplitN(filepath.Base(f.Raw), ".", 2)
- s, _ := url.QueryUnescape(parts[0])
- if len(parts) == 1 {
- return parts[0]
- }
- if s != "" || parts[1] != "" {
- return s + "." + parts[1]
- }
- return ""
-}
-
-// IsExported returns true if the function is exported.
-func (f Function) IsExported() bool {
- name := f.Name()
- parts := strings.Split(name, ".")
- r, _ := utf8.DecodeRuneInString(parts[len(parts)-1])
- if unicode.ToUpper(r) == r {
- return true
- }
- return f.PkgName() == "main" && name == "main"
-}
-
-// Arg is an argument on a Call.
-type Arg struct {
- Value uint64 // Value is the raw value as found in the stack trace
- Name string // Name is a pseudo name given to the argument
-}
-
-// IsPtr returns true if we guess it's a pointer. It's only a guess, it can be
-// easily be confused by a bitmask.
-func (a *Arg) IsPtr() bool {
- // Assumes all pointers are above 16Mb and positive.
- return a.Value > 16*1024*1024 && a.Value < math.MaxInt64
-}
-
-func (a Arg) String() string {
- if a.Name != "" {
- return a.Name
- }
- if a.Value == 0 {
- return "0"
- }
- return fmt.Sprintf("0x%x", a.Value)
-}
-
-// Args is a series of function call arguments.
-type Args struct {
- Values []Arg // Values is the arguments as shown on the stack trace. They are mangled via simplification.
- Processed []string // Processed is the arguments generated from processing the source files. It can have a length lower than Values.
- Elided bool // If set, it means there was a trailing ", ..."
-}
-
-func (a Args) String() string {
- var v []string
- if len(a.Processed) != 0 {
- v = make([]string, 0, len(a.Processed))
- for _, item := range a.Processed {
- v = append(v, item)
- }
- } else {
- v = make([]string, 0, len(a.Values))
- for _, item := range a.Values {
- v = append(v, item.String())
- }
- }
- if a.Elided {
- v = append(v, "...")
- }
- return strings.Join(v, ", ")
-}
-
-// Equal returns true only if both arguments are exactly equal.
-func (a *Args) Equal(r *Args) bool {
- if a.Elided != r.Elided || len(a.Values) != len(r.Values) {
- return false
- }
- for i, l := range a.Values {
- if l != r.Values[i] {
- return false
- }
- }
- return true
-}
-
-// Similar returns true if the two Args are equal or almost but not quite
-// equal.
-func (a *Args) Similar(r *Args, similar Similarity) bool {
- if a.Elided != r.Elided || len(a.Values) != len(r.Values) {
- return false
- }
- if similar == AnyValue {
- return true
- }
- for i, l := range a.Values {
- switch similar {
- case ExactFlags, ExactLines:
- if l != r.Values[i] {
- return false
- }
- default:
- if l.IsPtr() != r.Values[i].IsPtr() || (!l.IsPtr() && l != r.Values[i]) {
- return false
- }
- }
- }
- return true
-}
-
-// Merge merges two similar Args, zapping out differences.
-func (a *Args) Merge(r *Args) Args {
- out := Args{
- Values: make([]Arg, len(a.Values)),
- Elided: a.Elided,
- }
- for i, l := range a.Values {
- if l != r.Values[i] {
- out.Values[i].Name = "*"
- out.Values[i].Value = l.Value
- } else {
- out.Values[i] = l
- }
- }
- return out
-}
-
-// Call is an item in the stack trace.
-type Call struct {
- SourcePath string // Full path name of the source file
- Line int // Line number
- Func Function // Fully qualified function name (encoded).
- Args Args // Call arguments
-}
-
-// Equal returns true only if both calls are exactly equal.
-func (c *Call) Equal(r *Call) bool {
- return c.SourcePath == r.SourcePath && c.Line == r.Line && c.Func == r.Func && c.Args.Equal(&r.Args)
-}
-
-// Similar returns true if the two Call are equal or almost but not quite
-// equal.
-func (c *Call) Similar(r *Call, similar Similarity) bool {
- return c.SourcePath == r.SourcePath && c.Line == r.Line && c.Func == r.Func && c.Args.Similar(&r.Args, similar)
-}
-
-// Merge merges two similar Call, zapping out differences.
-func (c *Call) Merge(r *Call) Call {
- return Call{
- SourcePath: c.SourcePath,
- Line: c.Line,
- Func: c.Func,
- Args: c.Args.Merge(&r.Args),
- }
-}
-
-// SourceName returns the base file name of the source file.
-func (c *Call) SourceName() string {
- return filepath.Base(c.SourcePath)
-}
-
-// SourceLine returns "source.go:line", including only the base file name.
-func (c *Call) SourceLine() string {
- return fmt.Sprintf("%s:%d", c.SourceName(), c.Line)
-}
-
-// FullSourceLine returns "/path/to/source.go:line".
-func (c *Call) FullSourceLine() string {
- return fmt.Sprintf("%s:%d", c.SourcePath, c.Line)
-}
-
-// PkgSource is one directory plus the file name of the source file.
-func (c *Call) PkgSource() string {
- return filepath.Join(filepath.Base(filepath.Dir(c.SourcePath)), c.SourceName())
-}
-
-const testMainSource = "_test" + string(os.PathSeparator) + "_testmain.go"
-
-// IsStdlib returns true if it is a Go standard library function. This includes
-// the 'go test' generated main executable.
-func (c *Call) IsStdlib() bool {
- for _, goroot := range goroots {
- if strings.HasPrefix(c.SourcePath, goroot) {
- return true
- }
- }
- // Consider _test/_testmain.go as stdlib since it's injected by "go test".
- return c.PkgSource() == testMainSource
-}
-
-// IsPkgMain returns true if it is in the main package.
-func (c *Call) IsPkgMain() bool {
- return c.Func.PkgName() == "main"
-}
-
-// Stack is a call stack.
-type Stack struct {
- Calls []Call // Call stack. First is original function, last is leaf function.
- Elided bool // Happens when there's >100 items in Stack, currently hardcoded in package runtime.
-}
-
-// Equal returns true on if both call stacks are exactly equal.
-func (s *Stack) Equal(r *Stack) bool {
- if len(s.Calls) != len(r.Calls) || s.Elided != r.Elided {
- return false
- }
- for i := range s.Calls {
- if !s.Calls[i].Equal(&r.Calls[i]) {
- return false
- }
- }
- return true
-}
-
-// Similar returns true if the two Stack are equal or almost but not quite
-// equal.
-func (s *Stack) Similar(r *Stack, similar Similarity) bool {
- if len(s.Calls) != len(r.Calls) || s.Elided != r.Elided {
- return false
- }
- for i := range s.Calls {
- if !s.Calls[i].Similar(&r.Calls[i], similar) {
- return false
- }
- }
- return true
-}
-
-// Merge merges two similar Stack, zapping out differences.
-func (s *Stack) Merge(r *Stack) *Stack {
- // Assumes similar stacks have the same length.
- out := &Stack{
- Calls: make([]Call, len(s.Calls)),
- Elided: s.Elided,
- }
- for i := range s.Calls {
- out.Calls[i] = s.Calls[i].Merge(&r.Calls[i])
- }
- return out
-}
-
-// Less compares two Stack, where the ones that are less are more
-// important, so they come up front. A Stack with more private functions is
-// 'less' so it is at the top. Inversely, a Stack with only public
-// functions is 'more' so it is at the bottom.
-func (s *Stack) Less(r *Stack) bool {
- lStdlib := 0
- lPrivate := 0
- for _, c := range s.Calls {
- if c.IsStdlib() {
- lStdlib++
- } else {
- lPrivate++
- }
- }
- rStdlib := 0
- rPrivate := 0
- for _, s := range r.Calls {
- if s.IsStdlib() {
- rStdlib++
- } else {
- rPrivate++
- }
- }
- if lPrivate > rPrivate {
- return true
- }
- if lPrivate < rPrivate {
- return false
- }
- if lStdlib > rStdlib {
- return false
- }
- if lStdlib < rStdlib {
- return true
- }
-
- // Stack lengths are the same.
- for x := range s.Calls {
- if s.Calls[x].Func.Raw < r.Calls[x].Func.Raw {
- return true
- }
- if s.Calls[x].Func.Raw > r.Calls[x].Func.Raw {
- return true
- }
- if s.Calls[x].PkgSource() < r.Calls[x].PkgSource() {
- return true
- }
- if s.Calls[x].PkgSource() > r.Calls[x].PkgSource() {
- return true
- }
- if s.Calls[x].Line < r.Calls[x].Line {
- return true
- }
- if s.Calls[x].Line > r.Calls[x].Line {
- return true
- }
- }
- return false
-}
-
-// Signature represents the signature of one or multiple goroutines.
-//
-// It is effectively the stack trace plus the goroutine internal bits, like
-// it's state, if it is thread locked, which call site created this goroutine,
-// etc.
-type Signature struct {
- // Use git grep 'gopark(|unlock)\(' to find them all plus everything listed
- // in runtime/traceback.go. Valid values includes:
- // - chan send, chan receive, select
- // - finalizer wait, mark wait (idle),
- // - Concurrent GC wait, GC sweep wait, force gc (idle)
- // - IO wait, panicwait
- // - semacquire, semarelease
- // - sleep, timer goroutine (idle)
- // - trace reader (blocked)
- // Stuck cases:
- // - chan send (nil chan), chan receive (nil chan), select (no cases)
- // Runnable states:
- // - idle, runnable, running, syscall, waiting, dead, enqueue, copystack,
- // Scan states:
- // - scan, scanrunnable, scanrunning, scansyscall, scanwaiting, scandead,
- // scanenqueue
- State string
- CreatedBy Call // Which other goroutine which created this one.
- SleepMin int // Wait time in minutes, if applicable.
- SleepMax int // Wait time in minutes, if applicable.
- Stack Stack
- Locked bool // Locked to an OS thread.
-}
-
-// Equal returns true only if both signatures are exactly equal.
-func (s *Signature) Equal(r *Signature) bool {
- if s.State != r.State || !s.CreatedBy.Equal(&r.CreatedBy) || s.Locked != r.Locked || s.SleepMin != r.SleepMin || s.SleepMax != r.SleepMax {
- return false
- }
- return s.Stack.Equal(&r.Stack)
-}
-
-// Similar returns true if the two Signature are equal or almost but not quite
-// equal.
-func (s *Signature) Similar(r *Signature, similar Similarity) bool {
- if s.State != r.State || !s.CreatedBy.Similar(&r.CreatedBy, similar) {
- return false
- }
- if similar == ExactFlags && s.Locked != r.Locked {
- return false
- }
- return s.Stack.Similar(&r.Stack, similar)
-}
-
-// Merge merges two similar Signature, zapping out differences.
-func (s *Signature) Merge(r *Signature) *Signature {
- min := s.SleepMin
- if r.SleepMin < min {
- min = r.SleepMin
- }
- max := s.SleepMax
- if r.SleepMax > max {
- max = r.SleepMax
- }
- return &Signature{
- State: s.State, // Drop right side.
- CreatedBy: s.CreatedBy, // Drop right side.
- SleepMin: min,
- SleepMax: max,
- Stack: *s.Stack.Merge(&r.Stack),
- Locked: s.Locked || r.Locked, // TODO(maruel): This is weirdo.
- }
-}
-
-// Less compares two Signature, where the ones that are less are more
-// important, so they come up front. A Signature with more private functions is
-// 'less' so it is at the top. Inversely, a Signature with only public
-// functions is 'more' so it is at the bottom.
-func (s *Signature) Less(r *Signature) bool {
- if s.Stack.Less(&r.Stack) {
- return true
- }
- if r.Stack.Less(&s.Stack) {
- return false
- }
- if s.Locked && !r.Locked {
- return true
- }
- if r.Locked && !s.Locked {
- return false
- }
- if s.State < r.State {
- return true
- }
- if s.State > r.State {
- return false
- }
- return false
-}
-
-// Goroutine represents the state of one goroutine, including the stack trace.
-type Goroutine struct {
- Signature // It's stack trace, internal bits, state, which call site created it, etc.
- ID int // Goroutine ID.
- First bool // First is the goroutine first printed, normally the one that crashed.
-}
-
-// Bucketize returns the number of similar goroutines.
-func Bucketize(goroutines []Goroutine, similar Similarity) map[*Signature][]Goroutine {
- out := map[*Signature][]Goroutine{}
- // O(n²). Fix eventually.
- for _, routine := range goroutines {
- found := false
- for key := range out {
- // When a match is found, this effectively drops the other goroutine ID.
- if key.Similar(&routine.Signature, similar) {
- found = true
- if !key.Equal(&routine.Signature) {
- // Almost but not quite equal. There's different pointers passed
- // around but the same values. Zap out the different values.
- newKey := key.Merge(&routine.Signature)
- out[newKey] = append(out[key], routine)
- delete(out, key)
- } else {
- out[key] = append(out[key], routine)
- }
- break
- }
- }
- if !found {
- key := &Signature{}
- *key = routine.Signature
- out[key] = []Goroutine{routine}
- }
- }
- return out
-}
-
-// Bucket is a stack trace signature and the list of goroutines that fits this
-// signature.
-type Bucket struct {
- Signature
- Routines []Goroutine
-}
-
-// First returns true if it contains the first goroutine, e.g. the ones that
-// likely generated the panic() call, if any.
-func (b *Bucket) First() bool {
- for _, r := range b.Routines {
- if r.First {
- return true
- }
- }
- return false
-}
-
-// Less does reverse sort.
-func (b *Bucket) Less(r *Bucket) bool {
- if b.First() {
- return true
- }
- if r.First() {
- return false
- }
- return b.Signature.Less(&r.Signature)
-}
-
-// Buckets is a list of Bucket sorted by repeation count.
-type Buckets []Bucket
-
-func (b Buckets) Len() int {
- return len(b)
-}
-
-func (b Buckets) Less(i, j int) bool {
- return b[i].Less(&b[j])
-}
-
-func (b Buckets) Swap(i, j int) {
- b[j], b[i] = b[i], b[j]
-}
-
-// SortBuckets creates a list of Bucket from each goroutine stack trace count.
-func SortBuckets(buckets map[*Signature][]Goroutine) Buckets {
- out := make(Buckets, 0, len(buckets))
- for signature, count := range buckets {
- out = append(out, Bucket{*signature, count})
- }
- sort.Sort(out)
- return out
-}
-
-// scanLines is similar to bufio.ScanLines except that it:
-// - doesn't drop '\n'
-// - doesn't strip '\r'
-// - returns when the data is bufio.MaxScanTokenSize bytes
-func scanLines(data []byte, atEOF bool) (advance int, token []byte, err error) {
- if atEOF && len(data) == 0 {
- return 0, nil, nil
- }
- if i := bytes.IndexByte(data, '\n'); i >= 0 {
- return i + 1, data[0 : i+1], nil
- }
- if atEOF {
- return len(data), data, nil
- }
- if len(data) >= bufio.MaxScanTokenSize {
- // Returns the line even if it is not at EOF nor has a '\n', otherwise the
- // scanner will return bufio.ErrTooLong which is definitely not what we
- // want.
- return len(data), data, nil
- }
- return 0, nil, nil
-}
-
-// ParseDump processes the output from runtime.Stack().
-//
-// It supports piping from another command and assumes there is junk before the
-// actual stack trace. The junk is streamed to out.
-func ParseDump(r io.Reader, out io.Writer) ([]Goroutine, error) {
- goroutines := make([]Goroutine, 0, 16)
- var goroutine *Goroutine
- scanner := bufio.NewScanner(r)
- scanner.Split(scanLines)
- // TODO(maruel): Use a formal state machine. Patterns follows:
- // - reRoutineHeader
- // Either:
- // - reUnavail
- // - reFunc + reFile in a loop
- // - reElided
- // Optionally ends with:
- // - reCreated + reFile
- // Between each goroutine stack dump: an empty line
- created := false
- // firstLine is the first line after the reRoutineHeader header line.
- firstLine := false
- for scanner.Scan() {
- line := scanner.Text()
- if line == "\n" || line == "\r\n" {
- if goroutine != nil {
- goroutine = nil
- continue
- }
- } else if line[len(line)-1] == '\n' {
- if goroutine == nil {
- if match := reRoutineHeader.FindStringSubmatch(line); match != nil {
- if id, err := strconv.Atoi(match[1]); err == nil {
- // See runtime/traceback.go.
- // ", \d+ minutes, locked to thread"
- items := strings.Split(match[2], ", ")
- sleep := 0
- locked := false
- for i := 1; i < len(items); i++ {
- if items[i] == lockedToThread {
- locked = true
- continue
- }
- // Look for duration, if any.
- if match2 := reMinutes.FindStringSubmatch(items[i]); match2 != nil {
- sleep, _ = strconv.Atoi(match2[1])
- }
- }
- goroutines = append(goroutines, Goroutine{
- Signature: Signature{
- State: items[0],
- SleepMin: sleep,
- SleepMax: sleep,
- Locked: locked,
- },
- ID: id,
- First: len(goroutines) == 0,
- })
- goroutine = &goroutines[len(goroutines)-1]
- firstLine = true
- continue
- }
- }
- } else {
- if firstLine {
- firstLine = false
- if match := reUnavail.FindStringSubmatch(line); match != nil {
- // Generate a fake stack entry.
- goroutine.Stack.Calls = []Call{{SourcePath: ""}}
- continue
- }
- }
-
- if match := reFile.FindStringSubmatch(line); match != nil {
- // Triggers after a reFunc or a reCreated.
- num, err := strconv.Atoi(match[2])
- if err != nil {
- return goroutines, fmt.Errorf("failed to parse int on line: \"%s\"", line)
- }
- if created {
- created = false
- goroutine.CreatedBy.SourcePath = match[1]
- goroutine.CreatedBy.Line = num
- } else {
- i := len(goroutine.Stack.Calls) - 1
- if i < 0 {
- return goroutines, errors.New("unexpected order")
- }
- goroutine.Stack.Calls[i].SourcePath = match[1]
- goroutine.Stack.Calls[i].Line = num
- }
- continue
- }
-
- if match := reCreated.FindStringSubmatch(line); match != nil {
- created = true
- goroutine.CreatedBy.Func.Raw = match[1]
- continue
- }
-
- if match := reFunc.FindStringSubmatch(line); match != nil {
- args := Args{}
- for _, a := range strings.Split(match[2], ", ") {
- if a == "..." {
- args.Elided = true
- continue
- }
- if a == "" {
- // Remaining values were dropped.
- break
- }
- v, err := strconv.ParseUint(a, 0, 64)
- if err != nil {
- return goroutines, fmt.Errorf("failed to parse int on line: \"%s\"", line)
- }
- args.Values = append(args.Values, Arg{Value: v})
- }
- goroutine.Stack.Calls = append(goroutine.Stack.Calls, Call{Func: Function{match[1]}, Args: args})
- continue
- }
-
- if match := reElided.FindStringSubmatch(line); match != nil {
- goroutine.Stack.Elided = true
- continue
- }
- }
- }
- _, _ = io.WriteString(out, line)
- goroutine = nil
- }
- nameArguments(goroutines)
- return goroutines, scanner.Err()
-}
-
-// Private stuff.
-
-func nameArguments(goroutines []Goroutine) {
- // Set a name for any pointer occuring more than once.
- type object struct {
- args []*Arg
- inPrimary bool
- id int
- }
- objects := map[uint64]object{}
- // Enumerate all the arguments.
- for i := range goroutines {
- for j := range goroutines[i].Stack.Calls {
- for k := range goroutines[i].Stack.Calls[j].Args.Values {
- arg := goroutines[i].Stack.Calls[j].Args.Values[k]
- if arg.IsPtr() {
- objects[arg.Value] = object{
- args: append(objects[arg.Value].args, &goroutines[i].Stack.Calls[j].Args.Values[k]),
- inPrimary: objects[arg.Value].inPrimary || i == 0,
- }
- }
- }
- }
- // CreatedBy.Args is never set.
- }
- order := uint64Slice{}
- for k, obj := range objects {
- if len(obj.args) > 1 && obj.inPrimary {
- order = append(order, k)
- }
- }
- sort.Sort(order)
- nextID := 1
- for _, k := range order {
- for _, arg := range objects[k].args {
- arg.Name = fmt.Sprintf("#%d", nextID)
- }
- nextID++
- }
-
- // Now do the rest. This is done so the output is deterministic.
- order = uint64Slice{}
- for k := range objects {
- order = append(order, k)
- }
- sort.Sort(order)
- for _, k := range order {
- // Process the remaining pointers, they were not referenced by primary
- // thread so will have higher IDs.
- if objects[k].inPrimary {
- continue
- }
- for _, arg := range objects[k].args {
- arg.Name = fmt.Sprintf("#%d", nextID)
- }
- nextID++
- }
-}
-
-type uint64Slice []uint64
-
-func (a uint64Slice) Len() int { return len(a) }
-func (a uint64Slice) Swap(i, j int) { a[i], a[j] = a[j], a[i] }
-func (a uint64Slice) Less(i, j int) bool { return a[i] < a[j] }
diff --git a/vendor/github.com/maruel/panicparse/stack/stack_test.go b/vendor/github.com/maruel/panicparse/stack/stack_test.go
deleted file mode 100644
index 883025b..0000000
--- a/vendor/github.com/maruel/panicparse/stack/stack_test.go
+++ /dev/null
@@ -1,1018 +0,0 @@
-// Copyright 2015 Marc-Antoine Ruel. All rights reserved.
-// Use of this source code is governed under the Apache License, Version 2.0
-// that can be found in the LICENSE file.
-
-package stack
-
-import (
- "bufio"
- "bytes"
- "errors"
- "io"
- "io/ioutil"
- "os"
- "path/filepath"
- "strings"
- "testing"
-
- "github.com/maruel/ut"
-)
-
-var goroot = goroots[0]
-
-const crash = `panic: oh no!
-
-goroutine 1 [running]:
-panic(0x0, 0x0)
- /home/user/src/golang/src/runtime/panic.go:464 +0x3e6
-main.crash2(0x7fe50b49d028, 0xc82000a1e0)
- /home/user/src/foo.go:45 +0x23
-main.main()
- /home/user/src/foo.go:50 +0xa6
-`
-
-func Example() {
- in := bytes.NewBufferString(crash)
- goroutines, err := ParseDump(in, os.Stdout)
- if err != nil {
- return
- }
-
- // Optional: Check for GOTRACEBACK being set, in particular if there is only
- // one goroutine returned.
-
- // Use a color palette based on ANSI code.
- p := &Palette{}
- buckets := SortBuckets(Bucketize(goroutines, AnyValue))
- srcLen, pkgLen := CalcLengths(buckets, false)
- for _, bucket := range buckets {
- io.WriteString(os.Stdout, p.BucketHeader(&bucket, false, len(buckets) > 1))
- io.WriteString(os.Stdout, p.StackLines(&bucket.Signature, srcLen, pkgLen, false))
- }
- // Output:
- // panic: oh no!
- //
- // 1: running
- // panic.go:464 panic(0, 0)
- // main foo.go:45 crash2(0x7fe50b49d028, 0xc82000a1e0)
- // main foo.go:50 main()
-}
-
-func TestParseDump1(t *testing.T) {
- // One call from main, one from stdlib, one from third party.
- // Create a long first line that will be ignored. It is to guard against
- // https://github.com/maruel/panicparse/issues/17.
- long := strings.Repeat("a", bufio.MaxScanTokenSize+1)
- data := []string{
- long,
- "panic: reflect.Set: value of type",
- "",
- "goroutine 1 [running]:",
- "github.com/cockroachdb/cockroach/storage/engine._Cfunc_DBIterSeek()",
- " ??:0 +0x6d",
- "gopkg.in/yaml%2ev2.handleErr(0xc208033b20)",
- " /gopath/src/gopkg.in/yaml.v2/yaml.go:153 +0xc6",
- "reflect.Value.assignTo(0x570860, 0xc20803f3e0, 0x15)",
- " " + goroot + "/src/reflect/value.go:2125 +0x368",
- "main.main()",
- " /gopath/src/github.com/foo/bar/baz.go:428 +0x27",
- "",
- }
- extra := &bytes.Buffer{}
- goroutines, err := ParseDump(bytes.NewBufferString(strings.Join(data, "\n")), extra)
- ut.AssertEqual(t, nil, err)
- ut.AssertEqual(t, long+"\npanic: reflect.Set: value of type\n\n", extra.String())
- expected := []Goroutine{
- {
- Signature: Signature{
- State: "running",
- Stack: Stack{
- Calls: []Call{
- {
- SourcePath: "??",
- Func: Function{"github.com/cockroachdb/cockroach/storage/engine._Cfunc_DBIterSeek"},
- },
- {
- SourcePath: "/gopath/src/gopkg.in/yaml.v2/yaml.go",
- Line: 153,
- Func: Function{"gopkg.in/yaml%2ev2.handleErr"},
- Args: Args{Values: []Arg{{Value: 0xc208033b20}}},
- },
- {
- SourcePath: goroot + "/src/reflect/value.go",
- Line: 2125,
- Func: Function{"reflect.Value.assignTo"},
- Args: Args{Values: []Arg{{Value: 0x570860}, {Value: 0xc20803f3e0}, {Value: 0x15}}},
- },
- {
- SourcePath: "/gopath/src/github.com/foo/bar/baz.go",
- Line: 428,
- Func: Function{"main.main"},
- },
- },
- },
- },
- ID: 1,
- First: true,
- },
- }
- ut.AssertEqual(t, expected, goroutines)
-}
-
-func TestParseDumpLongWait(t *testing.T) {
- // One call from main, one from stdlib, one from third party.
- data := []string{
- "panic: bleh",
- "",
- "goroutine 1 [chan send, 100 minutes]:",
- "gopkg.in/yaml%2ev2.handleErr(0xc208033b20)",
- " /gopath/src/gopkg.in/yaml.v2/yaml.go:153 +0xc6",
- "",
- "goroutine 2 [chan send, locked to thread]:",
- "gopkg.in/yaml%2ev2.handleErr(0xc208033b21)",
- " /gopath/src/gopkg.in/yaml.v2/yaml.go:153 +0xc6",
- "",
- "goroutine 3 [chan send, 101 minutes, locked to thread]:",
- "gopkg.in/yaml%2ev2.handleErr(0xc208033b22)",
- " /gopath/src/gopkg.in/yaml.v2/yaml.go:153 +0xc6",
- "",
- }
- extra := &bytes.Buffer{}
- goroutines, err := ParseDump(bytes.NewBufferString(strings.Join(data, "\n")), extra)
- ut.AssertEqual(t, nil, err)
- ut.AssertEqual(t, "panic: bleh\n\n", extra.String())
- expected := []Goroutine{
- {
- Signature: Signature{
- State: "chan send",
- SleepMin: 100,
- SleepMax: 100,
- Stack: Stack{
- Calls: []Call{
- {
- SourcePath: "/gopath/src/gopkg.in/yaml.v2/yaml.go",
- Line: 153,
- Func: Function{"gopkg.in/yaml%2ev2.handleErr"},
- Args: Args{Values: []Arg{{Value: 0xc208033b20}}},
- },
- },
- },
- },
- ID: 1,
- First: true,
- },
- {
- Signature: Signature{
- State: "chan send",
- Locked: true,
- Stack: Stack{
- Calls: []Call{
- {
- SourcePath: "/gopath/src/gopkg.in/yaml.v2/yaml.go",
- Line: 153,
- Func: Function{"gopkg.in/yaml%2ev2.handleErr"},
- Args: Args{Values: []Arg{{Value: 0xc208033b21, Name: "#1"}}},
- },
- },
- },
- },
- ID: 2,
- },
- {
- Signature: Signature{
- State: "chan send",
- SleepMin: 101,
- SleepMax: 101,
- Stack: Stack{
- Calls: []Call{
- {
- SourcePath: "/gopath/src/gopkg.in/yaml.v2/yaml.go",
- Line: 153,
- Func: Function{"gopkg.in/yaml%2ev2.handleErr"},
- Args: Args{Values: []Arg{{Value: 0xc208033b22, Name: "#2"}}},
- },
- },
- },
- Locked: true,
- },
- ID: 3,
- },
- }
- ut.AssertEqual(t, expected, goroutines)
-}
-
-func TestParseDumpAsm(t *testing.T) {
- data := []string{
- "panic: reflect.Set: value of type",
- "",
- "goroutine 16 [garbage collection]:",
- "runtime.switchtoM()",
- "\t" + goroot + "/src/runtime/asm_amd64.s:198 fp=0xc20cfb80d8 sp=0xc20cfb80d0",
- "",
- }
- extra := &bytes.Buffer{}
- goroutines, err := ParseDump(bytes.NewBufferString(strings.Join(data, "\n")), extra)
- ut.AssertEqual(t, nil, err)
- expected := []Goroutine{
- {
- Signature: Signature{
- State: "garbage collection",
- Stack: Stack{
- Calls: []Call{
- {
- SourcePath: goroot + "/src/runtime/asm_amd64.s",
- Line: 198,
- Func: Function{Raw: "runtime.switchtoM"},
- },
- },
- },
- },
- ID: 16,
- First: true,
- },
- }
- ut.AssertEqual(t, expected, goroutines)
- ut.AssertEqual(t, "panic: reflect.Set: value of type\n\n", extra.String())
-}
-
-func TestParseDumpLineErr(t *testing.T) {
- data := []string{
- "panic: reflect.Set: value of type",
- "",
- "goroutine 1 [running]:",
- "github.com/foo/bar.recurseType()",
- "\t/gopath/src/github.com/foo/bar/baz.go:12345678901234567890",
- "",
- }
- extra := &bytes.Buffer{}
- goroutines, err := ParseDump(bytes.NewBufferString(strings.Join(data, "\n")), extra)
- ut.AssertEqual(t, errors.New("failed to parse int on line: \"\t/gopath/src/github.com/foo/bar/baz.go:12345678901234567890\n\""), err)
- expected := []Goroutine{
- {
- Signature: Signature{
- State: "running",
- Stack: Stack{Calls: []Call{{Func: Function{Raw: "github.com/foo/bar.recurseType"}}}},
- },
- ID: 1,
- First: true,
- },
- }
-
- ut.AssertEqual(t, expected, goroutines)
-}
-
-func TestParseDumpValueErr(t *testing.T) {
- data := []string{
- "panic: reflect.Set: value of type",
- "",
- "goroutine 1 [running]:",
- "github.com/foo/bar.recurseType(123456789012345678901)",
- "\t/gopath/src/github.com/foo/bar/baz.go:9",
- "",
- }
- extra := &bytes.Buffer{}
- goroutines, err := ParseDump(bytes.NewBufferString(strings.Join(data, "\n")), extra)
- ut.AssertEqual(t, errors.New("failed to parse int on line: \"github.com/foo/bar.recurseType(123456789012345678901)\n\""), err)
- expected := []Goroutine{
- {
- Signature: Signature{State: "running"},
- ID: 1,
- First: true,
- },
- }
-
- ut.AssertEqual(t, expected, goroutines)
-}
-
-func TestParseDumpOrderErr(t *testing.T) {
- data := []string{
- "panic: reflect.Set: value of type",
- "",
- "goroutine 16 [garbage collection]:",
- " /gopath/src/gopkg.in/yaml.v2/yaml.go:153 +0xc6",
- "runtime.switchtoM()",
- "\t" + goroot + "/src/runtime/asm_amd64.s:198 fp=0xc20cfb80d8 sp=0xc20cfb80d0",
- "",
- }
- extra := &bytes.Buffer{}
- goroutines, err := ParseDump(bytes.NewBufferString(strings.Join(data, "\n")), extra)
- ut.AssertEqual(t, errors.New("unexpected order"), err)
- expected := []Goroutine{
- {
- Signature: Signature{State: "garbage collection"},
- ID: 16,
- First: true,
- },
- }
- ut.AssertEqual(t, expected, goroutines)
- ut.AssertEqual(t, "panic: reflect.Set: value of type\n\n", extra.String())
-}
-
-func TestParseDumpElided(t *testing.T) {
- data := []string{
- "panic: reflect.Set: value of type",
- "",
- "goroutine 16 [garbage collection]:",
- "github.com/foo/bar.recurseType(0x7f4fa9a3ec70, 0xc208062580, 0x7f4fa9a3e818, 0x50a820, 0xc20803a8a0)",
- "\t/gopath/src/github.com/foo/bar/baz.go:53 +0x845 fp=0xc20cfc66d8 sp=0xc20cfc6470",
- "...additional frames elided...",
- "created by testing.RunTests",
- "\t" + goroot + "/src/testing/testing.go:555 +0xa8b",
- "",
- }
- extra := &bytes.Buffer{}
- goroutines, err := ParseDump(bytes.NewBufferString(strings.Join(data, "\n")), extra)
- ut.AssertEqual(t, nil, err)
- expected := []Goroutine{
- {
- Signature: Signature{
- State: "garbage collection",
- Stack: Stack{
- Calls: []Call{
- {
- SourcePath: "/gopath/src/github.com/foo/bar/baz.go",
- Line: 53,
- Func: Function{Raw: "github.com/foo/bar.recurseType"},
- Args: Args{
- Values: []Arg{
- {Value: 0x7f4fa9a3ec70},
- {Value: 0xc208062580},
- {Value: 0x7f4fa9a3e818},
- {Value: 0x50a820},
- {Value: 0xc20803a8a0},
- },
- },
- },
- },
- Elided: true,
- },
- CreatedBy: Call{
- SourcePath: goroot + "/src/testing/testing.go",
- Line: 555,
- Func: Function{Raw: "testing.RunTests"},
- },
- },
- ID: 16,
- First: true,
- },
- }
- ut.AssertEqual(t, expected, goroutines)
- ut.AssertEqual(t, "panic: reflect.Set: value of type\n\n", extra.String())
-}
-
-func TestParseDumpSysCall(t *testing.T) {
- data := []string{
- "panic: reflect.Set: value of type",
- "",
- "goroutine 5 [syscall]:",
- "runtime.notetsleepg(0x918100, 0xffffffffffffffff, 0x1)",
- "\t" + goroot + "/src/runtime/lock_futex.go:201 +0x52 fp=0xc208018f68 sp=0xc208018f40",
- "runtime.signal_recv(0x0)",
- "\t" + goroot + "/src/runtime/sigqueue.go:109 +0x135 fp=0xc208018fa0 sp=0xc208018f68",
- "os/signal.loop()",
- "\t" + goroot + "/src/os/signal/signal_unix.go:21 +0x1f fp=0xc208018fe0 sp=0xc208018fa0",
- "runtime.goexit()",
- "\t" + goroot + "/src/runtime/asm_amd64.s:2232 +0x1 fp=0xc208018fe8 sp=0xc208018fe0",
- "created by os/signal.init·1",
- "\t" + goroot + "/src/os/signal/signal_unix.go:27 +0x35",
- "",
- }
- extra := &bytes.Buffer{}
- goroutines, err := ParseDump(bytes.NewBufferString(strings.Join(data, "\n")), extra)
- ut.AssertEqual(t, nil, err)
- expected := []Goroutine{
- {
- Signature: Signature{
- State: "syscall",
- Stack: Stack{
- Calls: []Call{
- {
- SourcePath: goroot + "/src/runtime/lock_futex.go",
- Line: 201,
- Func: Function{Raw: "runtime.notetsleepg"},
- Args: Args{
- Values: []Arg{
- {Value: 0x918100},
- {Value: 0xffffffffffffffff},
- {Value: 0x1},
- },
- },
- },
- {
- SourcePath: goroot + "/src/runtime/sigqueue.go",
- Line: 109,
- Func: Function{Raw: "runtime.signal_recv"},
- Args: Args{
- Values: []Arg{{}},
- },
- },
- {
- SourcePath: goroot + "/src/os/signal/signal_unix.go",
- Line: 21,
- Func: Function{Raw: "os/signal.loop"},
- },
- {
- SourcePath: goroot + "/src/runtime/asm_amd64.s",
- Line: 2232,
- Func: Function{Raw: "runtime.goexit"},
- },
- },
- },
- CreatedBy: Call{
- SourcePath: goroot + "/src/os/signal/signal_unix.go",
- Line: 27,
- Func: Function{Raw: "os/signal.init·1"},
- },
- },
- ID: 5,
- First: true,
- },
- }
- ut.AssertEqual(t, expected, goroutines)
- ut.AssertEqual(t, "panic: reflect.Set: value of type\n\n", extra.String())
-}
-
-func TestParseDumpUnavail(t *testing.T) {
- data := []string{
- "panic: reflect.Set: value of type",
- "",
- "goroutine 24 [running]:",
- "\tgoroutine running on other thread; stack unavailable",
- "created by github.com/foo.New",
- "\t/gopath/src/github.com/foo/bar.go:131 +0x381",
- "",
- }
- extra := &bytes.Buffer{}
- goroutines, err := ParseDump(bytes.NewBufferString(strings.Join(data, "\n")), extra)
- ut.AssertEqual(t, nil, err)
- expected := []Goroutine{
- {
- Signature: Signature{
- State: "running",
- Stack: Stack{
- Calls: []Call{{SourcePath: ""}},
- },
- CreatedBy: Call{
- SourcePath: "/gopath/src/github.com/foo/bar.go",
- Line: 131,
- Func: Function{Raw: "github.com/foo.New"},
- },
- },
- ID: 24,
- First: true,
- },
- }
- ut.AssertEqual(t, expected, goroutines)
- ut.AssertEqual(t, "panic: reflect.Set: value of type\n\n", extra.String())
-}
-
-func TestParseDumpSameBucket(t *testing.T) {
- // 2 goroutines with the same signature
- data := []string{
- "panic: runtime error: index out of range",
- "",
- "goroutine 6 [chan receive]:",
- "main.func·001()",
- " /gopath/src/github.com/foo/bar/baz.go:72 +0x49",
- "created by main.mainImpl",
- " /gopath/src/github.com/foo/bar/baz.go:74 +0xeb",
- "",
- "goroutine 7 [chan receive]:",
- "main.func·001()",
- " /gopath/src/github.com/foo/bar/baz.go:72 +0x49",
- "created by main.mainImpl",
- " /gopath/src/github.com/foo/bar/baz.go:74 +0xeb",
- "",
- }
- goroutines, err := ParseDump(bytes.NewBufferString(strings.Join(data, "\n")), &bytes.Buffer{})
- ut.AssertEqual(t, nil, err)
- expectedGR := []Goroutine{
- {
- Signature: Signature{
- State: "chan receive",
- Stack: Stack{
- Calls: []Call{
- {
- SourcePath: "/gopath/src/github.com/foo/bar/baz.go",
- Line: 72,
- Func: Function{"main.func·001"},
- },
- },
- },
- CreatedBy: Call{
- SourcePath: "/gopath/src/github.com/foo/bar/baz.go",
- Line: 74,
- Func: Function{"main.mainImpl"},
- },
- },
- ID: 6,
- First: true,
- },
- {
- Signature: Signature{
- State: "chan receive",
- Stack: Stack{
- Calls: []Call{
- {
- SourcePath: "/gopath/src/github.com/foo/bar/baz.go",
- Line: 72,
- Func: Function{"main.func·001"},
- },
- },
- },
- CreatedBy: Call{
- SourcePath: "/gopath/src/github.com/foo/bar/baz.go",
- Line: 74,
- Func: Function{"main.mainImpl"},
- },
- },
- ID: 7,
- },
- }
- ut.AssertEqual(t, expectedGR, goroutines)
- expectedBuckets := Buckets{{expectedGR[0].Signature, []Goroutine{expectedGR[0], expectedGR[1]}}}
- ut.AssertEqual(t, expectedBuckets, SortBuckets(Bucketize(goroutines, ExactLines)))
-}
-
-func TestBucketizeNotAggressive(t *testing.T) {
- // 2 goroutines with the same signature
- data := []string{
- "panic: runtime error: index out of range",
- "",
- "goroutine 6 [chan receive]:",
- "main.func·001(0x11000000, 2)",
- " /gopath/src/github.com/foo/bar/baz.go:72 +0x49",
- "",
- "goroutine 7 [chan receive]:",
- "main.func·001(0x21000000, 2)",
- " /gopath/src/github.com/foo/bar/baz.go:72 +0x49",
- "",
- }
- goroutines, err := ParseDump(bytes.NewBufferString(strings.Join(data, "\n")), &bytes.Buffer{})
- ut.AssertEqual(t, nil, err)
- expectedGR := []Goroutine{
- {
- Signature: Signature{
- State: "chan receive",
- Stack: Stack{
- Calls: []Call{
- {
- SourcePath: "/gopath/src/github.com/foo/bar/baz.go",
- Line: 72,
- Func: Function{"main.func·001"},
- Args: Args{Values: []Arg{{0x11000000, ""}, {Value: 2}}},
- },
- },
- },
- },
- ID: 6,
- First: true,
- },
- {
- Signature: Signature{
- State: "chan receive",
- Stack: Stack{
- Calls: []Call{
- {
- SourcePath: "/gopath/src/github.com/foo/bar/baz.go",
- Line: 72,
- Func: Function{"main.func·001"},
- Args: Args{Values: []Arg{{0x21000000, "#1"}, {Value: 2}}},
- },
- },
- },
- },
- ID: 7,
- },
- }
- ut.AssertEqual(t, expectedGR, goroutines)
- expectedBuckets := Buckets{
- {expectedGR[0].Signature, []Goroutine{expectedGR[0]}},
- {expectedGR[1].Signature, []Goroutine{expectedGR[1]}},
- }
- ut.AssertEqual(t, expectedBuckets, SortBuckets(Bucketize(goroutines, ExactLines)))
-}
-
-func TestBucketizeAggressive(t *testing.T) {
- // 2 goroutines with the same signature
- data := []string{
- "panic: runtime error: index out of range",
- "",
- "goroutine 6 [chan receive, 10 minutes]:",
- "main.func·001(0x11000000, 2)",
- " /gopath/src/github.com/foo/bar/baz.go:72 +0x49",
- "",
- "goroutine 7 [chan receive, 50 minutes]:",
- "main.func·001(0x21000000, 2)",
- " /gopath/src/github.com/foo/bar/baz.go:72 +0x49",
- "",
- "goroutine 8 [chan receive, 100 minutes]:",
- "main.func·001(0x21000000, 2)",
- " /gopath/src/github.com/foo/bar/baz.go:72 +0x49",
- "",
- }
- goroutines, err := ParseDump(bytes.NewBufferString(strings.Join(data, "\n")), &bytes.Buffer{})
- ut.AssertEqual(t, nil, err)
- expectedGR := []Goroutine{
- {
- Signature: Signature{
- State: "chan receive",
- SleepMin: 10,
- SleepMax: 10,
- Stack: Stack{
- Calls: []Call{
- {
- SourcePath: "/gopath/src/github.com/foo/bar/baz.go",
- Line: 72,
- Func: Function{"main.func·001"},
- Args: Args{Values: []Arg{{0x11000000, ""}, {Value: 2}}},
- },
- },
- },
- },
- ID: 6,
- First: true,
- },
- {
- Signature: Signature{
- State: "chan receive",
- SleepMin: 50,
- SleepMax: 50,
- Stack: Stack{
- Calls: []Call{
- {
- SourcePath: "/gopath/src/github.com/foo/bar/baz.go",
- Line: 72,
- Func: Function{"main.func·001"},
- Args: Args{Values: []Arg{{0x21000000, "#1"}, {Value: 2}}},
- },
- },
- },
- },
- ID: 7,
- },
- {
- Signature: Signature{
- State: "chan receive",
- SleepMin: 100,
- SleepMax: 100,
- Stack: Stack{
- Calls: []Call{
- {
- SourcePath: "/gopath/src/github.com/foo/bar/baz.go",
- Line: 72,
- Func: Function{"main.func·001"},
- Args: Args{Values: []Arg{{0x21000000, "#1"}, {Value: 2}}},
- },
- },
- },
- },
- ID: 8,
- },
- }
- ut.AssertEqual(t, expectedGR, goroutines)
- signature := Signature{
- State: "chan receive",
- SleepMin: 10,
- SleepMax: 100,
- Stack: Stack{
- Calls: []Call{
- {
- SourcePath: "/gopath/src/github.com/foo/bar/baz.go",
- Line: 72,
- Func: Function{"main.func·001"},
- Args: Args{Values: []Arg{{0x11000000, "*"}, {Value: 2}}},
- },
- },
- },
- }
- expectedBuckets := Buckets{{signature, []Goroutine{expectedGR[0], expectedGR[1], expectedGR[2]}}}
- ut.AssertEqual(t, expectedBuckets, SortBuckets(Bucketize(goroutines, AnyPointer)))
-}
-
-func TestParseDumpNoOffset(t *testing.T) {
- data := []string{
- "panic: runtime error: index out of range",
- "",
- "goroutine 37 [runnable]:",
- "github.com/foo.func·002()",
- " /gopath/src/github.com/foo/bar.go:110",
- "created by github.com/foo.New",
- " /gopath/src/github.com/foo/bar.go:113 +0x43b",
- "",
- }
- goroutines, err := ParseDump(bytes.NewBufferString(strings.Join(data, "\n")), &bytes.Buffer{})
- ut.AssertEqual(t, nil, err)
- expectedGR := []Goroutine{
- {
- Signature: Signature{
- State: "runnable",
- Stack: Stack{
- Calls: []Call{
- {
- SourcePath: "/gopath/src/github.com/foo/bar.go",
- Line: 110,
- Func: Function{"github.com/foo.func·002"},
- },
- },
- },
- CreatedBy: Call{
- SourcePath: "/gopath/src/github.com/foo/bar.go",
- Line: 113,
- Func: Function{"github.com/foo.New"},
- },
- },
- ID: 37,
- First: true,
- },
- }
- ut.AssertEqual(t, expectedGR, goroutines)
-}
-
-func TestParseDumpJunk(t *testing.T) {
- // For coverage of scanLines.
- data := []string{
- "panic: reflect.Set: value of type",
- "",
- "goroutine 1 [running]:",
- "junk",
- }
- goroutines, err := ParseDump(bytes.NewBufferString(strings.Join(data, "\n")), &bytes.Buffer{})
- ut.AssertEqual(t, nil, err)
- expectedGR := []Goroutine{
- {
- Signature: Signature{State: "running"},
- ID: 1,
- First: true,
- },
- }
- ut.AssertEqual(t, expectedGR, goroutines)
-}
-
-func TestParseCCode(t *testing.T) {
- data := []string{
- "SIGQUIT: quit",
- "PC=0x43f349",
- "",
- "goroutine 0 [idle]:",
- "runtime.epollwait(0x4, 0x7fff671c7118, 0xffffffff00000080, 0x0, 0xffffffff0028c1be, 0x0, 0x0, 0x0, 0x0, 0x0, ...)",
- " " + goroot + "/src/runtime/sys_linux_amd64.s:400 +0x19",
- "runtime.netpoll(0x901b01, 0x0)",
- " " + goroot + "/src/runtime/netpoll_epoll.go:68 +0xa3",
- "findrunnable(0xc208012000)",
- " " + goroot + "/src/runtime/proc.c:1472 +0x485",
- "schedule()",
- " " + goroot + "/src/runtime/proc.c:1575 +0x151",
- "runtime.park_m(0xc2080017a0)",
- " " + goroot + "/src/runtime/proc.c:1654 +0x113",
- "runtime.mcall(0x432684)",
- " " + goroot + "/src/runtime/asm_amd64.s:186 +0x5a",
- "",
- }
- goroutines, err := ParseDump(bytes.NewBufferString(strings.Join(data, "\n")), &bytes.Buffer{})
- ut.AssertEqual(t, nil, err)
- expectedGR := []Goroutine{
- {
- Signature: Signature{
- State: "idle",
- Stack: Stack{
- Calls: []Call{
- {
- SourcePath: goroot + "/src/runtime/sys_linux_amd64.s",
- Line: 400,
- Func: Function{"runtime.epollwait"},
- Args: Args{
- Values: []Arg{
- {Value: 0x4},
- {Value: 0x7fff671c7118},
- {Value: 0xffffffff00000080},
- {},
- {Value: 0xffffffff0028c1be},
- {},
- {},
- {},
- {},
- {},
- },
- Elided: true,
- },
- },
- {
- SourcePath: goroot + "/src/runtime/netpoll_epoll.go",
- Line: 68,
- Func: Function{"runtime.netpoll"},
- Args: Args{Values: []Arg{{Value: 0x901b01}, {}}},
- },
- {
- SourcePath: goroot + "/src/runtime/proc.c",
- Line: 1472,
- Func: Function{"findrunnable"},
- Args: Args{Values: []Arg{{Value: 0xc208012000}}},
- },
- {
- SourcePath: goroot + "/src/runtime/proc.c",
- Line: 1575,
- Func: Function{"schedule"},
- },
- {
- SourcePath: goroot + "/src/runtime/proc.c",
- Line: 1654,
- Func: Function{"runtime.park_m"},
- Args: Args{Values: []Arg{{Value: 0xc2080017a0}}},
- },
- {
- SourcePath: goroot + "/src/runtime/asm_amd64.s",
- Line: 186,
- Func: Function{"runtime.mcall"},
- Args: Args{Values: []Arg{{Value: 0x432684}}},
- },
- },
- },
- },
- ID: 0,
- First: true,
- },
- }
- ut.AssertEqual(t, expectedGR, goroutines)
-}
-
-func TestParseWithCarriageReturn(t *testing.T) {
- data := []string{
- "goroutine 1 [running]:",
- "github.com/cockroachdb/cockroach/storage/engine._Cfunc_DBIterSeek()",
- " ??:0 +0x6d",
- "gopkg.in/yaml%2ev2.handleErr(0xc208033b20)",
- " /gopath/src/gopkg.in/yaml.v2/yaml.go:153 +0xc6",
- "reflect.Value.assignTo(0x570860, 0xc20803f3e0, 0x15)",
- " " + goroot + "/src/reflect/value.go:2125 +0x368",
- "main.main()",
- " /gopath/src/github.com/foo/bar/baz.go:428 +0x27",
- "",
- }
-
- goroutines, err := ParseDump(bytes.NewBufferString(strings.Join(data, "\r\n")), ioutil.Discard)
- ut.AssertEqual(t, nil, err)
- expected := []Goroutine{
- {
- Signature: Signature{
- State: "running",
- Stack: Stack{
- Calls: []Call{
- {
- SourcePath: "??",
- Func: Function{"github.com/cockroachdb/cockroach/storage/engine._Cfunc_DBIterSeek"},
- },
- {
- SourcePath: "/gopath/src/gopkg.in/yaml.v2/yaml.go",
- Line: 153,
- Func: Function{"gopkg.in/yaml%2ev2.handleErr"},
- Args: Args{Values: []Arg{{Value: 0xc208033b20}}},
- },
- {
- SourcePath: goroot + "/src/reflect/value.go",
- Line: 2125,
- Func: Function{"reflect.Value.assignTo"},
- Args: Args{Values: []Arg{{Value: 0x570860}, {Value: 0xc20803f3e0}, {Value: 0x15}}},
- },
- {
- SourcePath: "/gopath/src/github.com/foo/bar/baz.go",
- Line: 428,
- Func: Function{"main.main"},
- },
- },
- },
- },
- ID: 1,
- First: true,
- },
- }
- ut.AssertEqual(t, expected, goroutines)
-}
-
-func TestCallPkg1(t *testing.T) {
- c := Call{
- SourcePath: "/gopath/src/gopkg.in/yaml.v2/yaml.go",
- Line: 153,
- Func: Function{"gopkg.in/yaml%2ev2.handleErr"},
- Args: Args{Values: []Arg{{Value: 0xc208033b20}}},
- }
- ut.AssertEqual(t, "yaml.go", c.SourceName())
- ut.AssertEqual(t, filepath.Join("yaml.v2", "yaml.go"), c.PkgSource())
- ut.AssertEqual(t, "gopkg.in/yaml.v2.handleErr", c.Func.String())
- ut.AssertEqual(t, "handleErr", c.Func.Name())
- // This is due to directory name not matching the package name.
- ut.AssertEqual(t, "yaml.v2", c.Func.PkgName())
- ut.AssertEqual(t, false, c.Func.IsExported())
- ut.AssertEqual(t, false, c.IsStdlib())
- ut.AssertEqual(t, false, c.IsPkgMain())
-}
-
-func TestCallPkg2(t *testing.T) {
- c := Call{
- SourcePath: "/gopath/src/gopkg.in/yaml.v2/yaml.go",
- Line: 153,
- Func: Function{"gopkg.in/yaml%2ev2.(*decoder).unmarshal"},
- Args: Args{Values: []Arg{{Value: 0xc208033b20}}},
- }
- ut.AssertEqual(t, "yaml.go", c.SourceName())
- ut.AssertEqual(t, filepath.Join("yaml.v2", "yaml.go"), c.PkgSource())
- // TODO(maruel): Using '/' for this function is inconsistent on Windows
- // w.r.t. other functions.
- ut.AssertEqual(t, "gopkg.in/yaml.v2.(*decoder).unmarshal", c.Func.String())
- ut.AssertEqual(t, "(*decoder).unmarshal", c.Func.Name())
- // This is due to directory name not matching the package name.
- ut.AssertEqual(t, "yaml.v2", c.Func.PkgName())
- ut.AssertEqual(t, false, c.Func.IsExported())
- ut.AssertEqual(t, false, c.IsStdlib())
- ut.AssertEqual(t, false, c.IsPkgMain())
-}
-
-func TestCallStdlib(t *testing.T) {
- c := Call{
- SourcePath: goroot + "/src/reflect/value.go",
- Line: 2125,
- Func: Function{"reflect.Value.assignTo"},
- Args: Args{Values: []Arg{{Value: 0x570860}, {Value: 0xc20803f3e0}, {Value: 0x15}}},
- }
- ut.AssertEqual(t, "value.go", c.SourceName())
- ut.AssertEqual(t, "value.go:2125", c.SourceLine())
- ut.AssertEqual(t, filepath.Join("reflect", "value.go"), c.PkgSource())
- ut.AssertEqual(t, "reflect.Value.assignTo", c.Func.String())
- ut.AssertEqual(t, "Value.assignTo", c.Func.Name())
- ut.AssertEqual(t, "reflect", c.Func.PkgName())
- ut.AssertEqual(t, false, c.Func.IsExported())
- ut.AssertEqual(t, true, c.IsStdlib())
- ut.AssertEqual(t, false, c.IsPkgMain())
-}
-
-func TestCallMain(t *testing.T) {
- c := Call{
- SourcePath: "/gopath/src/github.com/foo/bar/main.go",
- Line: 428,
- Func: Function{"main.main"},
- }
- ut.AssertEqual(t, "main.go", c.SourceName())
- ut.AssertEqual(t, "main.go:428", c.SourceLine())
- ut.AssertEqual(t, filepath.Join("bar", "main.go"), c.PkgSource())
- ut.AssertEqual(t, "main.main", c.Func.String())
- ut.AssertEqual(t, "main", c.Func.Name())
- ut.AssertEqual(t, "main", c.Func.PkgName())
- ut.AssertEqual(t, true, c.Func.IsExported())
- ut.AssertEqual(t, false, c.IsStdlib())
- ut.AssertEqual(t, true, c.IsPkgMain())
-}
-
-func TestCallC(t *testing.T) {
- c := Call{
- SourcePath: goroot + "/src/runtime/proc.c",
- Line: 1472,
- Func: Function{"findrunnable"},
- Args: Args{Values: []Arg{{Value: 0xc208012000}}},
- }
- ut.AssertEqual(t, "proc.c", c.SourceName())
- ut.AssertEqual(t, "proc.c:1472", c.SourceLine())
- ut.AssertEqual(t, filepath.Join("runtime", "proc.c"), c.PkgSource())
- ut.AssertEqual(t, "findrunnable", c.Func.String())
- ut.AssertEqual(t, "findrunnable", c.Func.Name())
- ut.AssertEqual(t, "", c.Func.PkgName())
- ut.AssertEqual(t, false, c.Func.IsExported())
- ut.AssertEqual(t, true, c.IsStdlib())
- ut.AssertEqual(t, false, c.IsPkgMain())
-}
-
-func TestArgs(t *testing.T) {
- a := Args{
- Values: []Arg{
- {Value: 0x4},
- {Value: 0x7fff671c7118},
- {Value: 0xffffffff00000080},
- {},
- {Value: 0xffffffff0028c1be},
- {},
- {},
- {},
- {},
- {},
- },
- Elided: true,
- }
- ut.AssertEqual(t, "0x4, 0x7fff671c7118, 0xffffffff00000080, 0, 0xffffffff0028c1be, 0, 0, 0, 0, 0, ...", a.String())
-}
-
-func TestFunctionAnonymous(t *testing.T) {
- f := Function{"main.func·001"}
- ut.AssertEqual(t, "main.func·001", f.String())
- ut.AssertEqual(t, "main.func·001", f.PkgDotName())
- ut.AssertEqual(t, "func·001", f.Name())
- ut.AssertEqual(t, "main", f.PkgName())
- ut.AssertEqual(t, false, f.IsExported())
-}
-
-func TestFunctionGC(t *testing.T) {
- f := Function{"gc"}
- ut.AssertEqual(t, "gc", f.String())
- ut.AssertEqual(t, "gc", f.PkgDotName())
- ut.AssertEqual(t, "gc", f.Name())
- ut.AssertEqual(t, "", f.PkgName())
- ut.AssertEqual(t, false, f.IsExported())
-}
diff --git a/vendor/github.com/maruel/panicparse/stack/ui.go b/vendor/github.com/maruel/panicparse/stack/ui.go
deleted file mode 100644
index b125fc9..0000000
--- a/vendor/github.com/maruel/panicparse/stack/ui.go
+++ /dev/null
@@ -1,139 +0,0 @@
-// Copyright 2016 Marc-Antoine Ruel. All rights reserved.
-// Use of this source code is governed under the Apache License, Version 2.0
-// that can be found in the LICENSE file.
-
-package stack
-
-import (
- "fmt"
- "strings"
-)
-
-// Palette defines the color used.
-//
-// An empty object Palette{} can be used to disable coloring.
-type Palette struct {
- EOLReset string
-
- // Routine header.
- RoutineFirst string // The first routine printed.
- Routine string // Following routines.
- CreatedBy string
-
- // Call line.
- Package string
- SourceFile string
- FunctionStdLib string
- FunctionStdLibExported string
- FunctionMain string
- FunctionOther string
- FunctionOtherExported string
- Arguments string
-}
-
-// CalcLengths returns the maximum length of the source lines and package names.
-func CalcLengths(buckets Buckets, fullPath bool) (int, int) {
- srcLen := 0
- pkgLen := 0
- for _, bucket := range buckets {
- for _, line := range bucket.Signature.Stack.Calls {
- l := 0
- if fullPath {
- l = len(line.FullSourceLine())
- } else {
- l = len(line.SourceLine())
- }
- if l > srcLen {
- srcLen = l
- }
- l = len(line.Func.PkgName())
- if l > pkgLen {
- pkgLen = l
- }
- }
- }
- return srcLen, pkgLen
-}
-
-// functionColor returns the color to be used for the function name based on
-// the type of package the function is in.
-func (p *Palette) functionColor(line *Call) string {
- if line.IsStdlib() {
- if line.Func.IsExported() {
- return p.FunctionStdLibExported
- }
- return p.FunctionStdLib
- } else if line.IsPkgMain() {
- return p.FunctionMain
- } else if line.Func.IsExported() {
- return p.FunctionOtherExported
- }
- return p.FunctionOther
-}
-
-// routineColor returns the color for the header of the goroutines bucket.
-func (p *Palette) routineColor(bucket *Bucket, multipleBuckets bool) string {
- if bucket.First() && multipleBuckets {
- return p.RoutineFirst
- }
- return p.Routine
-}
-
-// BucketHeader prints the header of a goroutine signature.
-func (p *Palette) BucketHeader(bucket *Bucket, fullPath, multipleBuckets bool) string {
- extra := ""
- if bucket.SleepMax != 0 {
- if bucket.SleepMin != bucket.SleepMax {
- extra += fmt.Sprintf(" [%d~%d minutes]", bucket.SleepMin, bucket.SleepMax)
- } else {
- extra += fmt.Sprintf(" [%d minutes]", bucket.SleepMax)
- }
- }
- if bucket.Locked {
- extra += " [locked]"
- }
- created := bucket.CreatedBy.Func.PkgDotName()
- if created != "" {
- created += " @ "
- if fullPath {
- created += bucket.CreatedBy.FullSourceLine()
- } else {
- created += bucket.CreatedBy.SourceLine()
- }
- extra += p.CreatedBy + " [Created by " + created + "]"
- }
- return fmt.Sprintf(
- "%s%d: %s%s%s\n",
- p.routineColor(bucket, multipleBuckets), len(bucket.Routines),
- bucket.State, extra,
- p.EOLReset)
-}
-
-// callLine prints one stack line.
-func (p *Palette) callLine(line *Call, srcLen, pkgLen int, fullPath bool) string {
- src := ""
- if fullPath {
- src = line.FullSourceLine()
- } else {
- src = line.SourceLine()
- }
- return fmt.Sprintf(
- " %s%-*s %s%-*s %s%s%s(%s)%s",
- p.Package, pkgLen, line.Func.PkgName(),
- p.SourceFile, srcLen, src,
- p.functionColor(line), line.Func.Name(),
- p.Arguments, line.Args,
- p.EOLReset)
-}
-
-// StackLines prints one complete stack trace, without the header.
-func (p *Palette) StackLines(signature *Signature, srcLen, pkgLen int, fullPath bool) string {
- out := make([]string, len(signature.Stack.Calls))
- for i := range signature.Stack.Calls {
- out[i] = p.callLine(&signature.Stack.Calls[i], srcLen, pkgLen, fullPath)
- }
- if signature.Stack.Elided {
- out = append(out, " (...)")
- }
- return strings.Join(out, "\n") + "\n"
-}
diff --git a/vendor/github.com/maruel/panicparse/stack/ui_test.go b/vendor/github.com/maruel/panicparse/stack/ui_test.go
deleted file mode 100644
index d50c588..0000000
--- a/vendor/github.com/maruel/panicparse/stack/ui_test.go
+++ /dev/null
@@ -1,149 +0,0 @@
-// Copyright 2016 Marc-Antoine Ruel. All rights reserved.
-// Use of this source code is governed under the Apache License, Version 2.0
-// that can be found in the LICENSE file.
-
-package stack
-
-import (
- "testing"
-
- "github.com/maruel/ut"
-)
-
-var p = &Palette{
- EOLReset: "A",
- RoutineFirst: "B",
- Routine: "C",
- CreatedBy: "D",
- Package: "E",
- SourceFile: "F",
- FunctionStdLib: "G",
- FunctionStdLibExported: "H",
- FunctionMain: "I",
- FunctionOther: "J",
- FunctionOtherExported: "K",
- Arguments: "L",
-}
-
-func TestCalcLengths(t *testing.T) {
- t.Parallel()
- b := Buckets{
- {
- Signature{Stack: Stack{Calls: []Call{{SourcePath: "/gopath/baz.go", Func: Function{"main.func·001"}}}}},
- nil,
- },
- }
- srcLen, pkgLen := CalcLengths(b, true)
- ut.AssertEqual(t, 16, srcLen)
- ut.AssertEqual(t, 4, pkgLen)
- srcLen, pkgLen = CalcLengths(b, false)
- ut.AssertEqual(t, 8, srcLen)
- ut.AssertEqual(t, 4, pkgLen)
-}
-
-func TestBucketHeader(t *testing.T) {
- t.Parallel()
- b := &Bucket{
- Signature{
- State: "chan receive",
- CreatedBy: Call{
- SourcePath: "/gopath/src/github.com/foo/bar/baz.go",
- Line: 74,
- Func: Function{"main.mainImpl"},
- },
- SleepMax: 6,
- SleepMin: 2,
- },
- []Goroutine{
- {
- First: true,
- },
- {},
- },
- }
- ut.AssertEqual(t, "B2: chan receive [2~6 minutes]D [Created by main.mainImpl @ /gopath/src/github.com/foo/bar/baz.go:74]A\n", p.BucketHeader(b, true, true))
- ut.AssertEqual(t, "C2: chan receive [2~6 minutes]D [Created by main.mainImpl @ /gopath/src/github.com/foo/bar/baz.go:74]A\n", p.BucketHeader(b, true, false))
- ut.AssertEqual(t, "B2: chan receive [2~6 minutes]D [Created by main.mainImpl @ baz.go:74]A\n", p.BucketHeader(b, false, true))
- ut.AssertEqual(t, "C2: chan receive [2~6 minutes]D [Created by main.mainImpl @ baz.go:74]A\n", p.BucketHeader(b, false, false))
-
- b = &Bucket{
- Signature{
- State: "b0rked",
- SleepMax: 6,
- SleepMin: 6,
- Locked: true,
- },
- nil,
- }
- ut.AssertEqual(t, "C0: b0rked [6 minutes] [locked]A\n", p.BucketHeader(b, false, false))
-}
-
-func TestStackLines(t *testing.T) {
- t.Parallel()
- s := &Signature{
- State: "idle",
- Stack: Stack{
- Calls: []Call{
- {
- SourcePath: goroot + "/src/runtime/sys_linux_amd64.s",
- Line: 400,
- Func: Function{"runtime.Epollwait"},
- Args: Args{
- Values: []Arg{
- {Value: 0x4},
- {Value: 0x7fff671c7118},
- {Value: 0xffffffff00000080},
- {},
- {Value: 0xffffffff0028c1be},
- {},
- {},
- {},
- {},
- {},
- },
- Elided: true,
- },
- },
- {
- SourcePath: goroot + "/src/runtime/netpoll_epoll.go",
- Line: 68,
- Func: Function{"runtime.netpoll"},
- Args: Args{Values: []Arg{{Value: 0x901b01}, {}}},
- },
- {
- SourcePath: "/src/main.go",
- Line: 1472,
- Func: Function{"main.Main"},
- Args: Args{Values: []Arg{{Value: 0xc208012000}}},
- },
- {
- SourcePath: "/src/foo/bar.go",
- Line: 1575,
- Func: Function{"foo.OtherExported"},
- },
- {
- SourcePath: "/src/foo/bar.go",
- Line: 10,
- Func: Function{"foo.otherPrivate"},
- },
- },
- Elided: true,
- },
- }
- expected := "" +
- " Eruntime F" + goroot + "/src/runtime/sys_linux_amd64.s:400 HEpollwaitL(0x4, 0x7fff671c7118, 0xffffffff00000080, 0, 0xffffffff0028c1be, 0, 0, 0, 0, 0, ...)A\n" +
- " Eruntime F" + goroot + "/src/runtime/netpoll_epoll.go:68 GnetpollL(0x901b01, 0)A\n" +
- " Emain F/src/main.go:1472 IMainL(0xc208012000)A\n" +
- " Efoo F/src/foo/bar.go:1575 KOtherExportedL()A\n" +
- " Efoo F/src/foo/bar.go:10 JotherPrivateL()A\n" +
- " (...)\n"
- ut.AssertEqual(t, expected, p.StackLines(s, 10, 10, true))
- expected = "" +
- " Eruntime Fsys_linux_amd64.s:400 HEpollwaitL(0x4, 0x7fff671c7118, 0xffffffff00000080, 0, 0xffffffff0028c1be, 0, 0, 0, 0, 0, ...)A\n" +
- " Eruntime Fnetpoll_epoll.go:68 GnetpollL(0x901b01, 0)A\n" +
- " Emain Fmain.go:1472 IMainL(0xc208012000)A\n" +
- " Efoo Fbar.go:1575 KOtherExportedL()A\n" +
- " Efoo Fbar.go:10 JotherPrivateL()A\n" +
- " (...)\n"
- ut.AssertEqual(t, expected, p.StackLines(s, 10, 10, false))
-}
diff --git a/vendor/github.com/mattn/go-colorable/.travis.yml b/vendor/github.com/mattn/go-colorable/.travis.yml
deleted file mode 100644
index 98db8f0..0000000
--- a/vendor/github.com/mattn/go-colorable/.travis.yml
+++ /dev/null
@@ -1,9 +0,0 @@
-language: go
-go:
- - tip
-
-before_install:
- - go get github.com/mattn/goveralls
- - go get golang.org/x/tools/cmd/cover
-script:
- - $HOME/gopath/bin/goveralls -repotoken xnXqRGwgW3SXIguzxf90ZSK1GPYZPaGrw
diff --git a/vendor/github.com/mattn/go-colorable/LICENSE b/vendor/github.com/mattn/go-colorable/LICENSE
deleted file mode 100644
index 91b5cef..0000000
--- a/vendor/github.com/mattn/go-colorable/LICENSE
+++ /dev/null
@@ -1,21 +0,0 @@
-The MIT License (MIT)
-
-Copyright (c) 2016 Yasuhiro Matsumoto
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all
-copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-SOFTWARE.
diff --git a/vendor/github.com/mattn/go-colorable/README.md b/vendor/github.com/mattn/go-colorable/README.md
deleted file mode 100644
index 56729a9..0000000
--- a/vendor/github.com/mattn/go-colorable/README.md
+++ /dev/null
@@ -1,48 +0,0 @@
-# go-colorable
-
-[![Godoc Reference](https://godoc.org/github.com/mattn/go-colorable?status.svg)](http://godoc.org/github.com/mattn/go-colorable)
-[![Build Status](https://travis-ci.org/mattn/go-colorable.svg?branch=master)](https://travis-ci.org/mattn/go-colorable)
-[![Coverage Status](https://coveralls.io/repos/github/mattn/go-colorable/badge.svg?branch=master)](https://coveralls.io/github/mattn/go-colorable?branch=master)
-[![Go Report Card](https://goreportcard.com/badge/mattn/go-colorable)](https://goreportcard.com/report/mattn/go-colorable)
-
-Colorable writer for windows.
-
-For example, most of logger packages doesn't show colors on windows. (I know we can do it with ansicon. But I don't want.)
-This package is possible to handle escape sequence for ansi color on windows.
-
-## Too Bad!
-
-![](https://raw.githubusercontent.com/mattn/go-colorable/gh-pages/bad.png)
-
-
-## So Good!
-
-![](https://raw.githubusercontent.com/mattn/go-colorable/gh-pages/good.png)
-
-## Usage
-
-```go
-logrus.SetFormatter(&logrus.TextFormatter{ForceColors: true})
-logrus.SetOutput(colorable.NewColorableStdout())
-
-logrus.Info("succeeded")
-logrus.Warn("not correct")
-logrus.Error("something error")
-logrus.Fatal("panic")
-```
-
-You can compile above code on non-windows OSs.
-
-## Installation
-
-```
-$ go get github.com/mattn/go-colorable
-```
-
-# License
-
-MIT
-
-# Author
-
-Yasuhiro Matsumoto (a.k.a mattn)
diff --git a/vendor/github.com/mattn/go-colorable/_example/escape-seq/main.go b/vendor/github.com/mattn/go-colorable/_example/escape-seq/main.go
deleted file mode 100644
index 8cbcb90..0000000
--- a/vendor/github.com/mattn/go-colorable/_example/escape-seq/main.go
+++ /dev/null
@@ -1,16 +0,0 @@
-package main
-
-import (
- "bufio"
- "fmt"
-
- "github.com/mattn/go-colorable"
-)
-
-func main() {
- stdOut := bufio.NewWriter(colorable.NewColorableStdout())
-
- fmt.Fprint(stdOut, "\x1B[3GMove to 3rd Column\n")
- fmt.Fprint(stdOut, "\x1B[1;2HMove to 2nd Column on 1st Line\n")
- stdOut.Flush()
-}
diff --git a/vendor/github.com/mattn/go-colorable/_example/logrus/main.go b/vendor/github.com/mattn/go-colorable/_example/logrus/main.go
deleted file mode 100644
index c569164..0000000
--- a/vendor/github.com/mattn/go-colorable/_example/logrus/main.go
+++ /dev/null
@@ -1,16 +0,0 @@
-package main
-
-import (
- "github.com/mattn/go-colorable"
- "github.com/sirupsen/logrus"
-)
-
-func main() {
- logrus.SetFormatter(&logrus.TextFormatter{ForceColors: true})
- logrus.SetOutput(colorable.NewColorableStdout())
-
- logrus.Info("succeeded")
- logrus.Warn("not correct")
- logrus.Error("something error")
- logrus.Fatal("panic")
-}
diff --git a/vendor/github.com/mattn/go-colorable/_example/title/main.go b/vendor/github.com/mattn/go-colorable/_example/title/main.go
deleted file mode 100644
index e208870..0000000
--- a/vendor/github.com/mattn/go-colorable/_example/title/main.go
+++ /dev/null
@@ -1,14 +0,0 @@
-package main
-
-import (
- "fmt"
- "os"
- . "github.com/mattn/go-colorable"
-)
-
-func main() {
- out := NewColorableStdout()
- fmt.Fprint(out, "\x1B]0;TITLE Changed\007(See title and hit any key)")
- var c [1]byte
- os.Stdin.Read(c[:])
-}
diff --git a/vendor/github.com/mattn/go-colorable/colorable_appengine.go b/vendor/github.com/mattn/go-colorable/colorable_appengine.go
deleted file mode 100644
index 1f28d77..0000000
--- a/vendor/github.com/mattn/go-colorable/colorable_appengine.go
+++ /dev/null
@@ -1,29 +0,0 @@
-// +build appengine
-
-package colorable
-
-import (
- "io"
- "os"
-
- _ "github.com/mattn/go-isatty"
-)
-
-// NewColorable return new instance of Writer which handle escape sequence.
-func NewColorable(file *os.File) io.Writer {
- if file == nil {
- panic("nil passed instead of *os.File to NewColorable()")
- }
-
- return file
-}
-
-// NewColorableStdout return new instance of Writer which handle escape sequence for stdout.
-func NewColorableStdout() io.Writer {
- return os.Stdout
-}
-
-// NewColorableStderr return new instance of Writer which handle escape sequence for stderr.
-func NewColorableStderr() io.Writer {
- return os.Stderr
-}
diff --git a/vendor/github.com/mattn/go-colorable/colorable_others.go b/vendor/github.com/mattn/go-colorable/colorable_others.go
deleted file mode 100644
index 887f203..0000000
--- a/vendor/github.com/mattn/go-colorable/colorable_others.go
+++ /dev/null
@@ -1,30 +0,0 @@
-// +build !windows
-// +build !appengine
-
-package colorable
-
-import (
- "io"
- "os"
-
- _ "github.com/mattn/go-isatty"
-)
-
-// NewColorable return new instance of Writer which handle escape sequence.
-func NewColorable(file *os.File) io.Writer {
- if file == nil {
- panic("nil passed instead of *os.File to NewColorable()")
- }
-
- return file
-}
-
-// NewColorableStdout return new instance of Writer which handle escape sequence for stdout.
-func NewColorableStdout() io.Writer {
- return os.Stdout
-}
-
-// NewColorableStderr return new instance of Writer which handle escape sequence for stderr.
-func NewColorableStderr() io.Writer {
- return os.Stderr
-}
diff --git a/vendor/github.com/mattn/go-colorable/colorable_test.go b/vendor/github.com/mattn/go-colorable/colorable_test.go
deleted file mode 100644
index 3069869..0000000
--- a/vendor/github.com/mattn/go-colorable/colorable_test.go
+++ /dev/null
@@ -1,83 +0,0 @@
-package colorable
-
-import (
- "bytes"
- "os"
- "runtime"
- "testing"
-)
-
-// checkEncoding checks that colorable is output encoding agnostic as long as
-// the encoding is a superset of ASCII. This implies that one byte not part of
-// an ANSI sequence must give exactly one byte in output
-func checkEncoding(t *testing.T, data []byte) {
- // Send non-UTF8 data to colorable
- b := bytes.NewBuffer(make([]byte, 0, 10))
- if b.Len() != 0 {
- t.FailNow()
- }
- // TODO move colorable wrapping outside the test
- c := NewNonColorable(b)
- c.Write(data)
- if b.Len() != len(data) {
- t.Fatalf("%d bytes expected, got %d", len(data), b.Len())
- }
-}
-
-func TestEncoding(t *testing.T) {
- checkEncoding(t, []byte{}) // Empty
- checkEncoding(t, []byte(`abc`)) // "abc"
- checkEncoding(t, []byte(`é`)) // "é" in UTF-8
- checkEncoding(t, []byte{233}) // 'é' in Latin-1
-}
-
-func TestNonColorable(t *testing.T) {
- var buf bytes.Buffer
- want := "hello"
- NewNonColorable(&buf).Write([]byte("\x1b[0m" + want + "\x1b[2J"))
- got := buf.String()
- if got != "hello" {
- t.Fatalf("want %q but %q", want, got)
- }
-
- buf.Reset()
- NewNonColorable(&buf).Write([]byte("\x1b["))
- got = buf.String()
- if got != "" {
- t.Fatalf("want %q but %q", "", got)
- }
-}
-
-func TestNonColorableNil(t *testing.T) {
- paniced := false
- func() {
- defer func() {
- recover()
- paniced = true
- }()
- NewNonColorable(nil)
- NewColorable(nil)
- }()
-
- if !paniced {
- t.Fatalf("should panic")
- }
-}
-
-func TestColorable(t *testing.T) {
- if runtime.GOOS == "windows" {
- t.Skipf("skip this test on windows")
- }
- _, ok := NewColorableStdout().(*os.File)
- if !ok {
- t.Fatalf("should os.Stdout on UNIX")
- }
- _, ok = NewColorableStderr().(*os.File)
- if !ok {
- t.Fatalf("should os.Stdout on UNIX")
- }
- _, ok = NewColorable(os.Stdout).(*os.File)
- if !ok {
- t.Fatalf("should os.Stdout on UNIX")
- }
-}
diff --git a/vendor/github.com/mattn/go-colorable/colorable_windows.go b/vendor/github.com/mattn/go-colorable/colorable_windows.go
deleted file mode 100644
index e17a547..0000000
--- a/vendor/github.com/mattn/go-colorable/colorable_windows.go
+++ /dev/null
@@ -1,884 +0,0 @@
-// +build windows
-// +build !appengine
-
-package colorable
-
-import (
- "bytes"
- "io"
- "math"
- "os"
- "strconv"
- "strings"
- "syscall"
- "unsafe"
-
- "github.com/mattn/go-isatty"
-)
-
-const (
- foregroundBlue = 0x1
- foregroundGreen = 0x2
- foregroundRed = 0x4
- foregroundIntensity = 0x8
- foregroundMask = (foregroundRed | foregroundBlue | foregroundGreen | foregroundIntensity)
- backgroundBlue = 0x10
- backgroundGreen = 0x20
- backgroundRed = 0x40
- backgroundIntensity = 0x80
- backgroundMask = (backgroundRed | backgroundBlue | backgroundGreen | backgroundIntensity)
-)
-
-type wchar uint16
-type short int16
-type dword uint32
-type word uint16
-
-type coord struct {
- x short
- y short
-}
-
-type smallRect struct {
- left short
- top short
- right short
- bottom short
-}
-
-type consoleScreenBufferInfo struct {
- size coord
- cursorPosition coord
- attributes word
- window smallRect
- maximumWindowSize coord
-}
-
-type consoleCursorInfo struct {
- size dword
- visible int32
-}
-
-var (
- kernel32 = syscall.NewLazyDLL("kernel32.dll")
- procGetConsoleScreenBufferInfo = kernel32.NewProc("GetConsoleScreenBufferInfo")
- procSetConsoleTextAttribute = kernel32.NewProc("SetConsoleTextAttribute")
- procSetConsoleCursorPosition = kernel32.NewProc("SetConsoleCursorPosition")
- procFillConsoleOutputCharacter = kernel32.NewProc("FillConsoleOutputCharacterW")
- procFillConsoleOutputAttribute = kernel32.NewProc("FillConsoleOutputAttribute")
- procGetConsoleCursorInfo = kernel32.NewProc("GetConsoleCursorInfo")
- procSetConsoleCursorInfo = kernel32.NewProc("SetConsoleCursorInfo")
- procSetConsoleTitle = kernel32.NewProc("SetConsoleTitleW")
-)
-
-// Writer provide colorable Writer to the console
-type Writer struct {
- out io.Writer
- handle syscall.Handle
- oldattr word
- oldpos coord
-}
-
-// NewColorable return new instance of Writer which handle escape sequence from File.
-func NewColorable(file *os.File) io.Writer {
- if file == nil {
- panic("nil passed instead of *os.File to NewColorable()")
- }
-
- if isatty.IsTerminal(file.Fd()) {
- var csbi consoleScreenBufferInfo
- handle := syscall.Handle(file.Fd())
- procGetConsoleScreenBufferInfo.Call(uintptr(handle), uintptr(unsafe.Pointer(&csbi)))
- return &Writer{out: file, handle: handle, oldattr: csbi.attributes, oldpos: coord{0, 0}}
- }
- return file
-}
-
-// NewColorableStdout return new instance of Writer which handle escape sequence for stdout.
-func NewColorableStdout() io.Writer {
- return NewColorable(os.Stdout)
-}
-
-// NewColorableStderr return new instance of Writer which handle escape sequence for stderr.
-func NewColorableStderr() io.Writer {
- return NewColorable(os.Stderr)
-}
-
-var color256 = map[int]int{
- 0: 0x000000,
- 1: 0x800000,
- 2: 0x008000,
- 3: 0x808000,
- 4: 0x000080,
- 5: 0x800080,
- 6: 0x008080,
- 7: 0xc0c0c0,
- 8: 0x808080,
- 9: 0xff0000,
- 10: 0x00ff00,
- 11: 0xffff00,
- 12: 0x0000ff,
- 13: 0xff00ff,
- 14: 0x00ffff,
- 15: 0xffffff,
- 16: 0x000000,
- 17: 0x00005f,
- 18: 0x000087,
- 19: 0x0000af,
- 20: 0x0000d7,
- 21: 0x0000ff,
- 22: 0x005f00,
- 23: 0x005f5f,
- 24: 0x005f87,
- 25: 0x005faf,
- 26: 0x005fd7,
- 27: 0x005fff,
- 28: 0x008700,
- 29: 0x00875f,
- 30: 0x008787,
- 31: 0x0087af,
- 32: 0x0087d7,
- 33: 0x0087ff,
- 34: 0x00af00,
- 35: 0x00af5f,
- 36: 0x00af87,
- 37: 0x00afaf,
- 38: 0x00afd7,
- 39: 0x00afff,
- 40: 0x00d700,
- 41: 0x00d75f,
- 42: 0x00d787,
- 43: 0x00d7af,
- 44: 0x00d7d7,
- 45: 0x00d7ff,
- 46: 0x00ff00,
- 47: 0x00ff5f,
- 48: 0x00ff87,
- 49: 0x00ffaf,
- 50: 0x00ffd7,
- 51: 0x00ffff,
- 52: 0x5f0000,
- 53: 0x5f005f,
- 54: 0x5f0087,
- 55: 0x5f00af,
- 56: 0x5f00d7,
- 57: 0x5f00ff,
- 58: 0x5f5f00,
- 59: 0x5f5f5f,
- 60: 0x5f5f87,
- 61: 0x5f5faf,
- 62: 0x5f5fd7,
- 63: 0x5f5fff,
- 64: 0x5f8700,
- 65: 0x5f875f,
- 66: 0x5f8787,
- 67: 0x5f87af,
- 68: 0x5f87d7,
- 69: 0x5f87ff,
- 70: 0x5faf00,
- 71: 0x5faf5f,
- 72: 0x5faf87,
- 73: 0x5fafaf,
- 74: 0x5fafd7,
- 75: 0x5fafff,
- 76: 0x5fd700,
- 77: 0x5fd75f,
- 78: 0x5fd787,
- 79: 0x5fd7af,
- 80: 0x5fd7d7,
- 81: 0x5fd7ff,
- 82: 0x5fff00,
- 83: 0x5fff5f,
- 84: 0x5fff87,
- 85: 0x5fffaf,
- 86: 0x5fffd7,
- 87: 0x5fffff,
- 88: 0x870000,
- 89: 0x87005f,
- 90: 0x870087,
- 91: 0x8700af,
- 92: 0x8700d7,
- 93: 0x8700ff,
- 94: 0x875f00,
- 95: 0x875f5f,
- 96: 0x875f87,
- 97: 0x875faf,
- 98: 0x875fd7,
- 99: 0x875fff,
- 100: 0x878700,
- 101: 0x87875f,
- 102: 0x878787,
- 103: 0x8787af,
- 104: 0x8787d7,
- 105: 0x8787ff,
- 106: 0x87af00,
- 107: 0x87af5f,
- 108: 0x87af87,
- 109: 0x87afaf,
- 110: 0x87afd7,
- 111: 0x87afff,
- 112: 0x87d700,
- 113: 0x87d75f,
- 114: 0x87d787,
- 115: 0x87d7af,
- 116: 0x87d7d7,
- 117: 0x87d7ff,
- 118: 0x87ff00,
- 119: 0x87ff5f,
- 120: 0x87ff87,
- 121: 0x87ffaf,
- 122: 0x87ffd7,
- 123: 0x87ffff,
- 124: 0xaf0000,
- 125: 0xaf005f,
- 126: 0xaf0087,
- 127: 0xaf00af,
- 128: 0xaf00d7,
- 129: 0xaf00ff,
- 130: 0xaf5f00,
- 131: 0xaf5f5f,
- 132: 0xaf5f87,
- 133: 0xaf5faf,
- 134: 0xaf5fd7,
- 135: 0xaf5fff,
- 136: 0xaf8700,
- 137: 0xaf875f,
- 138: 0xaf8787,
- 139: 0xaf87af,
- 140: 0xaf87d7,
- 141: 0xaf87ff,
- 142: 0xafaf00,
- 143: 0xafaf5f,
- 144: 0xafaf87,
- 145: 0xafafaf,
- 146: 0xafafd7,
- 147: 0xafafff,
- 148: 0xafd700,
- 149: 0xafd75f,
- 150: 0xafd787,
- 151: 0xafd7af,
- 152: 0xafd7d7,
- 153: 0xafd7ff,
- 154: 0xafff00,
- 155: 0xafff5f,
- 156: 0xafff87,
- 157: 0xafffaf,
- 158: 0xafffd7,
- 159: 0xafffff,
- 160: 0xd70000,
- 161: 0xd7005f,
- 162: 0xd70087,
- 163: 0xd700af,
- 164: 0xd700d7,
- 165: 0xd700ff,
- 166: 0xd75f00,
- 167: 0xd75f5f,
- 168: 0xd75f87,
- 169: 0xd75faf,
- 170: 0xd75fd7,
- 171: 0xd75fff,
- 172: 0xd78700,
- 173: 0xd7875f,
- 174: 0xd78787,
- 175: 0xd787af,
- 176: 0xd787d7,
- 177: 0xd787ff,
- 178: 0xd7af00,
- 179: 0xd7af5f,
- 180: 0xd7af87,
- 181: 0xd7afaf,
- 182: 0xd7afd7,
- 183: 0xd7afff,
- 184: 0xd7d700,
- 185: 0xd7d75f,
- 186: 0xd7d787,
- 187: 0xd7d7af,
- 188: 0xd7d7d7,
- 189: 0xd7d7ff,
- 190: 0xd7ff00,
- 191: 0xd7ff5f,
- 192: 0xd7ff87,
- 193: 0xd7ffaf,
- 194: 0xd7ffd7,
- 195: 0xd7ffff,
- 196: 0xff0000,
- 197: 0xff005f,
- 198: 0xff0087,
- 199: 0xff00af,
- 200: 0xff00d7,
- 201: 0xff00ff,
- 202: 0xff5f00,
- 203: 0xff5f5f,
- 204: 0xff5f87,
- 205: 0xff5faf,
- 206: 0xff5fd7,
- 207: 0xff5fff,
- 208: 0xff8700,
- 209: 0xff875f,
- 210: 0xff8787,
- 211: 0xff87af,
- 212: 0xff87d7,
- 213: 0xff87ff,
- 214: 0xffaf00,
- 215: 0xffaf5f,
- 216: 0xffaf87,
- 217: 0xffafaf,
- 218: 0xffafd7,
- 219: 0xffafff,
- 220: 0xffd700,
- 221: 0xffd75f,
- 222: 0xffd787,
- 223: 0xffd7af,
- 224: 0xffd7d7,
- 225: 0xffd7ff,
- 226: 0xffff00,
- 227: 0xffff5f,
- 228: 0xffff87,
- 229: 0xffffaf,
- 230: 0xffffd7,
- 231: 0xffffff,
- 232: 0x080808,
- 233: 0x121212,
- 234: 0x1c1c1c,
- 235: 0x262626,
- 236: 0x303030,
- 237: 0x3a3a3a,
- 238: 0x444444,
- 239: 0x4e4e4e,
- 240: 0x585858,
- 241: 0x626262,
- 242: 0x6c6c6c,
- 243: 0x767676,
- 244: 0x808080,
- 245: 0x8a8a8a,
- 246: 0x949494,
- 247: 0x9e9e9e,
- 248: 0xa8a8a8,
- 249: 0xb2b2b2,
- 250: 0xbcbcbc,
- 251: 0xc6c6c6,
- 252: 0xd0d0d0,
- 253: 0xdadada,
- 254: 0xe4e4e4,
- 255: 0xeeeeee,
-}
-
-// `\033]0;TITLESTR\007`
-func doTitleSequence(er *bytes.Reader) error {
- var c byte
- var err error
-
- c, err = er.ReadByte()
- if err != nil {
- return err
- }
- if c != '0' && c != '2' {
- return nil
- }
- c, err = er.ReadByte()
- if err != nil {
- return err
- }
- if c != ';' {
- return nil
- }
- title := make([]byte, 0, 80)
- for {
- c, err = er.ReadByte()
- if err != nil {
- return err
- }
- if c == 0x07 || c == '\n' {
- break
- }
- title = append(title, c)
- }
- if len(title) > 0 {
- title8, err := syscall.UTF16PtrFromString(string(title))
- if err == nil {
- procSetConsoleTitle.Call(uintptr(unsafe.Pointer(title8)))
- }
- }
- return nil
-}
-
-// Write write data on console
-func (w *Writer) Write(data []byte) (n int, err error) {
- var csbi consoleScreenBufferInfo
- procGetConsoleScreenBufferInfo.Call(uintptr(w.handle), uintptr(unsafe.Pointer(&csbi)))
-
- er := bytes.NewReader(data)
- var bw [1]byte
-loop:
- for {
- c1, err := er.ReadByte()
- if err != nil {
- break loop
- }
- if c1 != 0x1b {
- bw[0] = c1
- w.out.Write(bw[:])
- continue
- }
- c2, err := er.ReadByte()
- if err != nil {
- break loop
- }
-
- if c2 == ']' {
- if err := doTitleSequence(er); err != nil {
- break loop
- }
- continue
- }
- if c2 != 0x5b {
- continue
- }
-
- var buf bytes.Buffer
- var m byte
- for {
- c, err := er.ReadByte()
- if err != nil {
- break loop
- }
- if ('a' <= c && c <= 'z') || ('A' <= c && c <= 'Z') || c == '@' {
- m = c
- break
- }
- buf.Write([]byte(string(c)))
- }
-
- switch m {
- case 'A':
- n, err = strconv.Atoi(buf.String())
- if err != nil {
- continue
- }
- procGetConsoleScreenBufferInfo.Call(uintptr(w.handle), uintptr(unsafe.Pointer(&csbi)))
- csbi.cursorPosition.y -= short(n)
- procSetConsoleCursorPosition.Call(uintptr(w.handle), *(*uintptr)(unsafe.Pointer(&csbi.cursorPosition)))
- case 'B':
- n, err = strconv.Atoi(buf.String())
- if err != nil {
- continue
- }
- procGetConsoleScreenBufferInfo.Call(uintptr(w.handle), uintptr(unsafe.Pointer(&csbi)))
- csbi.cursorPosition.y += short(n)
- procSetConsoleCursorPosition.Call(uintptr(w.handle), *(*uintptr)(unsafe.Pointer(&csbi.cursorPosition)))
- case 'C':
- n, err = strconv.Atoi(buf.String())
- if err != nil {
- continue
- }
- procGetConsoleScreenBufferInfo.Call(uintptr(w.handle), uintptr(unsafe.Pointer(&csbi)))
- csbi.cursorPosition.x += short(n)
- procSetConsoleCursorPosition.Call(uintptr(w.handle), *(*uintptr)(unsafe.Pointer(&csbi.cursorPosition)))
- case 'D':
- n, err = strconv.Atoi(buf.String())
- if err != nil {
- continue
- }
- procGetConsoleScreenBufferInfo.Call(uintptr(w.handle), uintptr(unsafe.Pointer(&csbi)))
- csbi.cursorPosition.x -= short(n)
- procSetConsoleCursorPosition.Call(uintptr(w.handle), *(*uintptr)(unsafe.Pointer(&csbi.cursorPosition)))
- case 'E':
- n, err = strconv.Atoi(buf.String())
- if err != nil {
- continue
- }
- procGetConsoleScreenBufferInfo.Call(uintptr(w.handle), uintptr(unsafe.Pointer(&csbi)))
- csbi.cursorPosition.x = 0
- csbi.cursorPosition.y += short(n)
- procSetConsoleCursorPosition.Call(uintptr(w.handle), *(*uintptr)(unsafe.Pointer(&csbi.cursorPosition)))
- case 'F':
- n, err = strconv.Atoi(buf.String())
- if err != nil {
- continue
- }
- procGetConsoleScreenBufferInfo.Call(uintptr(w.handle), uintptr(unsafe.Pointer(&csbi)))
- csbi.cursorPosition.x = 0
- csbi.cursorPosition.y -= short(n)
- procSetConsoleCursorPosition.Call(uintptr(w.handle), *(*uintptr)(unsafe.Pointer(&csbi.cursorPosition)))
- case 'G':
- n, err = strconv.Atoi(buf.String())
- if err != nil {
- continue
- }
- procGetConsoleScreenBufferInfo.Call(uintptr(w.handle), uintptr(unsafe.Pointer(&csbi)))
- csbi.cursorPosition.x = short(n - 1)
- procSetConsoleCursorPosition.Call(uintptr(w.handle), *(*uintptr)(unsafe.Pointer(&csbi.cursorPosition)))
- case 'H', 'f':
- procGetConsoleScreenBufferInfo.Call(uintptr(w.handle), uintptr(unsafe.Pointer(&csbi)))
- if buf.Len() > 0 {
- token := strings.Split(buf.String(), ";")
- switch len(token) {
- case 1:
- n1, err := strconv.Atoi(token[0])
- if err != nil {
- continue
- }
- csbi.cursorPosition.y = short(n1 - 1)
- case 2:
- n1, err := strconv.Atoi(token[0])
- if err != nil {
- continue
- }
- n2, err := strconv.Atoi(token[1])
- if err != nil {
- continue
- }
- csbi.cursorPosition.x = short(n2 - 1)
- csbi.cursorPosition.y = short(n1 - 1)
- }
- } else {
- csbi.cursorPosition.y = 0
- }
- procSetConsoleCursorPosition.Call(uintptr(w.handle), *(*uintptr)(unsafe.Pointer(&csbi.cursorPosition)))
- case 'J':
- n := 0
- if buf.Len() > 0 {
- n, err = strconv.Atoi(buf.String())
- if err != nil {
- continue
- }
- }
- var count, written dword
- var cursor coord
- procGetConsoleScreenBufferInfo.Call(uintptr(w.handle), uintptr(unsafe.Pointer(&csbi)))
- switch n {
- case 0:
- cursor = coord{x: csbi.cursorPosition.x, y: csbi.cursorPosition.y}
- count = dword(csbi.size.x - csbi.cursorPosition.x + (csbi.size.y-csbi.cursorPosition.y)*csbi.size.x)
- case 1:
- cursor = coord{x: csbi.window.left, y: csbi.window.top}
- count = dword(csbi.size.x - csbi.cursorPosition.x + (csbi.window.top-csbi.cursorPosition.y)*csbi.size.x)
- case 2:
- cursor = coord{x: csbi.window.left, y: csbi.window.top}
- count = dword(csbi.size.x - csbi.cursorPosition.x + (csbi.size.y-csbi.cursorPosition.y)*csbi.size.x)
- }
- procFillConsoleOutputCharacter.Call(uintptr(w.handle), uintptr(' '), uintptr(count), *(*uintptr)(unsafe.Pointer(&cursor)), uintptr(unsafe.Pointer(&written)))
- procFillConsoleOutputAttribute.Call(uintptr(w.handle), uintptr(csbi.attributes), uintptr(count), *(*uintptr)(unsafe.Pointer(&cursor)), uintptr(unsafe.Pointer(&written)))
- case 'K':
- n := 0
- if buf.Len() > 0 {
- n, err = strconv.Atoi(buf.String())
- if err != nil {
- continue
- }
- }
- procGetConsoleScreenBufferInfo.Call(uintptr(w.handle), uintptr(unsafe.Pointer(&csbi)))
- var cursor coord
- var count, written dword
- switch n {
- case 0:
- cursor = coord{x: csbi.cursorPosition.x + 1, y: csbi.cursorPosition.y}
- count = dword(csbi.size.x - csbi.cursorPosition.x - 1)
- case 1:
- cursor = coord{x: csbi.window.left, y: csbi.window.top + csbi.cursorPosition.y}
- count = dword(csbi.size.x - csbi.cursorPosition.x)
- case 2:
- cursor = coord{x: csbi.window.left, y: csbi.window.top + csbi.cursorPosition.y}
- count = dword(csbi.size.x)
- }
- procFillConsoleOutputCharacter.Call(uintptr(w.handle), uintptr(' '), uintptr(count), *(*uintptr)(unsafe.Pointer(&cursor)), uintptr(unsafe.Pointer(&written)))
- procFillConsoleOutputAttribute.Call(uintptr(w.handle), uintptr(csbi.attributes), uintptr(count), *(*uintptr)(unsafe.Pointer(&cursor)), uintptr(unsafe.Pointer(&written)))
- case 'm':
- procGetConsoleScreenBufferInfo.Call(uintptr(w.handle), uintptr(unsafe.Pointer(&csbi)))
- attr := csbi.attributes
- cs := buf.String()
- if cs == "" {
- procSetConsoleTextAttribute.Call(uintptr(w.handle), uintptr(w.oldattr))
- continue
- }
- token := strings.Split(cs, ";")
- for i := 0; i < len(token); i++ {
- ns := token[i]
- if n, err = strconv.Atoi(ns); err == nil {
- switch {
- case n == 0 || n == 100:
- attr = w.oldattr
- case 1 <= n && n <= 5:
- attr |= foregroundIntensity
- case n == 7:
- attr = ((attr & foregroundMask) << 4) | ((attr & backgroundMask) >> 4)
- case n == 22 || n == 25:
- attr |= foregroundIntensity
- case n == 27:
- attr = ((attr & foregroundMask) << 4) | ((attr & backgroundMask) >> 4)
- case 30 <= n && n <= 37:
- attr &= backgroundMask
- if (n-30)&1 != 0 {
- attr |= foregroundRed
- }
- if (n-30)&2 != 0 {
- attr |= foregroundGreen
- }
- if (n-30)&4 != 0 {
- attr |= foregroundBlue
- }
- case n == 38: // set foreground color.
- if i < len(token)-2 && (token[i+1] == "5" || token[i+1] == "05") {
- if n256, err := strconv.Atoi(token[i+2]); err == nil {
- if n256foreAttr == nil {
- n256setup()
- }
- attr &= backgroundMask
- attr |= n256foreAttr[n256]
- i += 2
- }
- } else {
- attr = attr & (w.oldattr & backgroundMask)
- }
- case n == 39: // reset foreground color.
- attr &= backgroundMask
- attr |= w.oldattr & foregroundMask
- case 40 <= n && n <= 47:
- attr &= foregroundMask
- if (n-40)&1 != 0 {
- attr |= backgroundRed
- }
- if (n-40)&2 != 0 {
- attr |= backgroundGreen
- }
- if (n-40)&4 != 0 {
- attr |= backgroundBlue
- }
- case n == 48: // set background color.
- if i < len(token)-2 && token[i+1] == "5" {
- if n256, err := strconv.Atoi(token[i+2]); err == nil {
- if n256backAttr == nil {
- n256setup()
- }
- attr &= foregroundMask
- attr |= n256backAttr[n256]
- i += 2
- }
- } else {
- attr = attr & (w.oldattr & foregroundMask)
- }
- case n == 49: // reset foreground color.
- attr &= foregroundMask
- attr |= w.oldattr & backgroundMask
- case 90 <= n && n <= 97:
- attr = (attr & backgroundMask)
- attr |= foregroundIntensity
- if (n-90)&1 != 0 {
- attr |= foregroundRed
- }
- if (n-90)&2 != 0 {
- attr |= foregroundGreen
- }
- if (n-90)&4 != 0 {
- attr |= foregroundBlue
- }
- case 100 <= n && n <= 107:
- attr = (attr & foregroundMask)
- attr |= backgroundIntensity
- if (n-100)&1 != 0 {
- attr |= backgroundRed
- }
- if (n-100)&2 != 0 {
- attr |= backgroundGreen
- }
- if (n-100)&4 != 0 {
- attr |= backgroundBlue
- }
- }
- procSetConsoleTextAttribute.Call(uintptr(w.handle), uintptr(attr))
- }
- }
- case 'h':
- var ci consoleCursorInfo
- cs := buf.String()
- if cs == "5>" {
- procGetConsoleCursorInfo.Call(uintptr(w.handle), uintptr(unsafe.Pointer(&ci)))
- ci.visible = 0
- procSetConsoleCursorInfo.Call(uintptr(w.handle), uintptr(unsafe.Pointer(&ci)))
- } else if cs == "?25" {
- procGetConsoleCursorInfo.Call(uintptr(w.handle), uintptr(unsafe.Pointer(&ci)))
- ci.visible = 1
- procSetConsoleCursorInfo.Call(uintptr(w.handle), uintptr(unsafe.Pointer(&ci)))
- }
- case 'l':
- var ci consoleCursorInfo
- cs := buf.String()
- if cs == "5>" {
- procGetConsoleCursorInfo.Call(uintptr(w.handle), uintptr(unsafe.Pointer(&ci)))
- ci.visible = 1
- procSetConsoleCursorInfo.Call(uintptr(w.handle), uintptr(unsafe.Pointer(&ci)))
- } else if cs == "?25" {
- procGetConsoleCursorInfo.Call(uintptr(w.handle), uintptr(unsafe.Pointer(&ci)))
- ci.visible = 0
- procSetConsoleCursorInfo.Call(uintptr(w.handle), uintptr(unsafe.Pointer(&ci)))
- }
- case 's':
- procGetConsoleScreenBufferInfo.Call(uintptr(w.handle), uintptr(unsafe.Pointer(&csbi)))
- w.oldpos = csbi.cursorPosition
- case 'u':
- procSetConsoleCursorPosition.Call(uintptr(w.handle), *(*uintptr)(unsafe.Pointer(&w.oldpos)))
- }
- }
-
- return len(data), nil
-}
-
-type consoleColor struct {
- rgb int
- red bool
- green bool
- blue bool
- intensity bool
-}
-
-func (c consoleColor) foregroundAttr() (attr word) {
- if c.red {
- attr |= foregroundRed
- }
- if c.green {
- attr |= foregroundGreen
- }
- if c.blue {
- attr |= foregroundBlue
- }
- if c.intensity {
- attr |= foregroundIntensity
- }
- return
-}
-
-func (c consoleColor) backgroundAttr() (attr word) {
- if c.red {
- attr |= backgroundRed
- }
- if c.green {
- attr |= backgroundGreen
- }
- if c.blue {
- attr |= backgroundBlue
- }
- if c.intensity {
- attr |= backgroundIntensity
- }
- return
-}
-
-var color16 = []consoleColor{
- {0x000000, false, false, false, false},
- {0x000080, false, false, true, false},
- {0x008000, false, true, false, false},
- {0x008080, false, true, true, false},
- {0x800000, true, false, false, false},
- {0x800080, true, false, true, false},
- {0x808000, true, true, false, false},
- {0xc0c0c0, true, true, true, false},
- {0x808080, false, false, false, true},
- {0x0000ff, false, false, true, true},
- {0x00ff00, false, true, false, true},
- {0x00ffff, false, true, true, true},
- {0xff0000, true, false, false, true},
- {0xff00ff, true, false, true, true},
- {0xffff00, true, true, false, true},
- {0xffffff, true, true, true, true},
-}
-
-type hsv struct {
- h, s, v float32
-}
-
-func (a hsv) dist(b hsv) float32 {
- dh := a.h - b.h
- switch {
- case dh > 0.5:
- dh = 1 - dh
- case dh < -0.5:
- dh = -1 - dh
- }
- ds := a.s - b.s
- dv := a.v - b.v
- return float32(math.Sqrt(float64(dh*dh + ds*ds + dv*dv)))
-}
-
-func toHSV(rgb int) hsv {
- r, g, b := float32((rgb&0xFF0000)>>16)/256.0,
- float32((rgb&0x00FF00)>>8)/256.0,
- float32(rgb&0x0000FF)/256.0
- min, max := minmax3f(r, g, b)
- h := max - min
- if h > 0 {
- if max == r {
- h = (g - b) / h
- if h < 0 {
- h += 6
- }
- } else if max == g {
- h = 2 + (b-r)/h
- } else {
- h = 4 + (r-g)/h
- }
- }
- h /= 6.0
- s := max - min
- if max != 0 {
- s /= max
- }
- v := max
- return hsv{h: h, s: s, v: v}
-}
-
-type hsvTable []hsv
-
-func toHSVTable(rgbTable []consoleColor) hsvTable {
- t := make(hsvTable, len(rgbTable))
- for i, c := range rgbTable {
- t[i] = toHSV(c.rgb)
- }
- return t
-}
-
-func (t hsvTable) find(rgb int) consoleColor {
- hsv := toHSV(rgb)
- n := 7
- l := float32(5.0)
- for i, p := range t {
- d := hsv.dist(p)
- if d < l {
- l, n = d, i
- }
- }
- return color16[n]
-}
-
-func minmax3f(a, b, c float32) (min, max float32) {
- if a < b {
- if b < c {
- return a, c
- } else if a < c {
- return a, b
- } else {
- return c, b
- }
- } else {
- if a < c {
- return b, c
- } else if b < c {
- return b, a
- } else {
- return c, a
- }
- }
-}
-
-var n256foreAttr []word
-var n256backAttr []word
-
-func n256setup() {
- n256foreAttr = make([]word, 256)
- n256backAttr = make([]word, 256)
- t := toHSVTable(color16)
- for i, rgb := range color256 {
- c := t.find(rgb)
- n256foreAttr[i] = c.foregroundAttr()
- n256backAttr[i] = c.backgroundAttr()
- }
-}
diff --git a/vendor/github.com/mattn/go-colorable/noncolorable.go b/vendor/github.com/mattn/go-colorable/noncolorable.go
deleted file mode 100644
index 9721e16..0000000
--- a/vendor/github.com/mattn/go-colorable/noncolorable.go
+++ /dev/null
@@ -1,55 +0,0 @@
-package colorable
-
-import (
- "bytes"
- "io"
-)
-
-// NonColorable hold writer but remove escape sequence.
-type NonColorable struct {
- out io.Writer
-}
-
-// NewNonColorable return new instance of Writer which remove escape sequence from Writer.
-func NewNonColorable(w io.Writer) io.Writer {
- return &NonColorable{out: w}
-}
-
-// Write write data on console
-func (w *NonColorable) Write(data []byte) (n int, err error) {
- er := bytes.NewReader(data)
- var bw [1]byte
-loop:
- for {
- c1, err := er.ReadByte()
- if err != nil {
- break loop
- }
- if c1 != 0x1b {
- bw[0] = c1
- w.out.Write(bw[:])
- continue
- }
- c2, err := er.ReadByte()
- if err != nil {
- break loop
- }
- if c2 != 0x5b {
- continue
- }
-
- var buf bytes.Buffer
- for {
- c, err := er.ReadByte()
- if err != nil {
- break loop
- }
- if ('a' <= c && c <= 'z') || ('A' <= c && c <= 'Z') || c == '@' {
- break
- }
- buf.Write([]byte(string(c)))
- }
- }
-
- return len(data), nil
-}
diff --git a/vendor/github.com/mattn/go-isatty/.travis.yml b/vendor/github.com/mattn/go-isatty/.travis.yml
deleted file mode 100644
index b9f8b23..0000000
--- a/vendor/github.com/mattn/go-isatty/.travis.yml
+++ /dev/null
@@ -1,9 +0,0 @@
-language: go
-go:
- - tip
-
-before_install:
- - go get github.com/mattn/goveralls
- - go get golang.org/x/tools/cmd/cover
-script:
- - $HOME/gopath/bin/goveralls -repotoken 3gHdORO5k5ziZcWMBxnd9LrMZaJs8m9x5
diff --git a/vendor/github.com/mattn/go-isatty/LICENSE b/vendor/github.com/mattn/go-isatty/LICENSE
deleted file mode 100644
index 65dc692..0000000
--- a/vendor/github.com/mattn/go-isatty/LICENSE
+++ /dev/null
@@ -1,9 +0,0 @@
-Copyright (c) Yasuhiro MATSUMOTO
-
-MIT License (Expat)
-
-Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
diff --git a/vendor/github.com/mattn/go-isatty/README.md b/vendor/github.com/mattn/go-isatty/README.md
deleted file mode 100644
index 1e69004..0000000
--- a/vendor/github.com/mattn/go-isatty/README.md
+++ /dev/null
@@ -1,50 +0,0 @@
-# go-isatty
-
-[![Godoc Reference](https://godoc.org/github.com/mattn/go-isatty?status.svg)](http://godoc.org/github.com/mattn/go-isatty)
-[![Build Status](https://travis-ci.org/mattn/go-isatty.svg?branch=master)](https://travis-ci.org/mattn/go-isatty)
-[![Coverage Status](https://coveralls.io/repos/github/mattn/go-isatty/badge.svg?branch=master)](https://coveralls.io/github/mattn/go-isatty?branch=master)
-[![Go Report Card](https://goreportcard.com/badge/mattn/go-isatty)](https://goreportcard.com/report/mattn/go-isatty)
-
-isatty for golang
-
-## Usage
-
-```go
-package main
-
-import (
- "fmt"
- "github.com/mattn/go-isatty"
- "os"
-)
-
-func main() {
- if isatty.IsTerminal(os.Stdout.Fd()) {
- fmt.Println("Is Terminal")
- } else if isatty.IsCygwinTerminal(os.Stdout.Fd()) {
- fmt.Println("Is Cygwin/MSYS2 Terminal")
- } else {
- fmt.Println("Is Not Terminal")
- }
-}
-```
-
-## Installation
-
-```
-$ go get github.com/mattn/go-isatty
-```
-
-## License
-
-MIT
-
-## Author
-
-Yasuhiro Matsumoto (a.k.a mattn)
-
-## Thanks
-
-* k-takata: base idea for IsCygwinTerminal
-
- https://github.com/k-takata/go-iscygpty
diff --git a/vendor/github.com/mattn/go-isatty/doc.go b/vendor/github.com/mattn/go-isatty/doc.go
deleted file mode 100644
index 17d4f90..0000000
--- a/vendor/github.com/mattn/go-isatty/doc.go
+++ /dev/null
@@ -1,2 +0,0 @@
-// Package isatty implements interface to isatty
-package isatty
diff --git a/vendor/github.com/mattn/go-isatty/example_test.go b/vendor/github.com/mattn/go-isatty/example_test.go
deleted file mode 100644
index fa8f7e7..0000000
--- a/vendor/github.com/mattn/go-isatty/example_test.go
+++ /dev/null
@@ -1,18 +0,0 @@
-package isatty_test
-
-import (
- "fmt"
- "os"
-
- "github.com/mattn/go-isatty"
-)
-
-func Example() {
- if isatty.IsTerminal(os.Stdout.Fd()) {
- fmt.Println("Is Terminal")
- } else if isatty.IsCygwinTerminal(os.Stdout.Fd()) {
- fmt.Println("Is Cygwin/MSYS2 Terminal")
- } else {
- fmt.Println("Is Not Terminal")
- }
-}
diff --git a/vendor/github.com/mattn/go-isatty/isatty_appengine.go b/vendor/github.com/mattn/go-isatty/isatty_appengine.go
deleted file mode 100644
index 9584a98..0000000
--- a/vendor/github.com/mattn/go-isatty/isatty_appengine.go
+++ /dev/null
@@ -1,15 +0,0 @@
-// +build appengine
-
-package isatty
-
-// IsTerminal returns true if the file descriptor is terminal which
-// is always false on on appengine classic which is a sandboxed PaaS.
-func IsTerminal(fd uintptr) bool {
- return false
-}
-
-// IsCygwinTerminal() return true if the file descriptor is a cygwin or msys2
-// terminal. This is also always false on this environment.
-func IsCygwinTerminal(fd uintptr) bool {
- return false
-}
diff --git a/vendor/github.com/mattn/go-isatty/isatty_bsd.go b/vendor/github.com/mattn/go-isatty/isatty_bsd.go
deleted file mode 100644
index 42f2514..0000000
--- a/vendor/github.com/mattn/go-isatty/isatty_bsd.go
+++ /dev/null
@@ -1,18 +0,0 @@
-// +build darwin freebsd openbsd netbsd dragonfly
-// +build !appengine
-
-package isatty
-
-import (
- "syscall"
- "unsafe"
-)
-
-const ioctlReadTermios = syscall.TIOCGETA
-
-// IsTerminal return true if the file descriptor is terminal.
-func IsTerminal(fd uintptr) bool {
- var termios syscall.Termios
- _, _, err := syscall.Syscall6(syscall.SYS_IOCTL, fd, ioctlReadTermios, uintptr(unsafe.Pointer(&termios)), 0, 0, 0)
- return err == 0
-}
diff --git a/vendor/github.com/mattn/go-isatty/isatty_linux.go b/vendor/github.com/mattn/go-isatty/isatty_linux.go
deleted file mode 100644
index 7384cf9..0000000
--- a/vendor/github.com/mattn/go-isatty/isatty_linux.go
+++ /dev/null
@@ -1,18 +0,0 @@
-// +build linux
-// +build !appengine,!ppc64,!ppc64le
-
-package isatty
-
-import (
- "syscall"
- "unsafe"
-)
-
-const ioctlReadTermios = syscall.TCGETS
-
-// IsTerminal return true if the file descriptor is terminal.
-func IsTerminal(fd uintptr) bool {
- var termios syscall.Termios
- _, _, err := syscall.Syscall6(syscall.SYS_IOCTL, fd, ioctlReadTermios, uintptr(unsafe.Pointer(&termios)), 0, 0, 0)
- return err == 0
-}
diff --git a/vendor/github.com/mattn/go-isatty/isatty_linux_ppc64x.go b/vendor/github.com/mattn/go-isatty/isatty_linux_ppc64x.go
deleted file mode 100644
index 44e5d21..0000000
--- a/vendor/github.com/mattn/go-isatty/isatty_linux_ppc64x.go
+++ /dev/null
@@ -1,19 +0,0 @@
-// +build linux
-// +build ppc64 ppc64le
-
-package isatty
-
-import (
- "unsafe"
-
- syscall "golang.org/x/sys/unix"
-)
-
-const ioctlReadTermios = syscall.TCGETS
-
-// IsTerminal return true if the file descriptor is terminal.
-func IsTerminal(fd uintptr) bool {
- var termios syscall.Termios
- _, _, err := syscall.Syscall6(syscall.SYS_IOCTL, fd, ioctlReadTermios, uintptr(unsafe.Pointer(&termios)), 0, 0, 0)
- return err == 0
-}
diff --git a/vendor/github.com/mattn/go-isatty/isatty_others.go b/vendor/github.com/mattn/go-isatty/isatty_others.go
deleted file mode 100644
index ff4de3d..0000000
--- a/vendor/github.com/mattn/go-isatty/isatty_others.go
+++ /dev/null
@@ -1,10 +0,0 @@
-// +build !windows
-// +build !appengine
-
-package isatty
-
-// IsCygwinTerminal() return true if the file descriptor is a cygwin or msys2
-// terminal. This is also always false on this environment.
-func IsCygwinTerminal(fd uintptr) bool {
- return false
-}
diff --git a/vendor/github.com/mattn/go-isatty/isatty_others_test.go b/vendor/github.com/mattn/go-isatty/isatty_others_test.go
deleted file mode 100644
index a2091cf..0000000
--- a/vendor/github.com/mattn/go-isatty/isatty_others_test.go
+++ /dev/null
@@ -1,19 +0,0 @@
-// +build !windows
-
-package isatty
-
-import (
- "os"
- "testing"
-)
-
-func TestTerminal(t *testing.T) {
- // test for non-panic
- IsTerminal(os.Stdout.Fd())
-}
-
-func TestCygwinPipeName(t *testing.T) {
- if IsCygwinTerminal(os.Stdout.Fd()) {
- t.Fatal("should be false always")
- }
-}
diff --git a/vendor/github.com/mattn/go-isatty/isatty_solaris.go b/vendor/github.com/mattn/go-isatty/isatty_solaris.go
deleted file mode 100644
index 1f0c6bf..0000000
--- a/vendor/github.com/mattn/go-isatty/isatty_solaris.go
+++ /dev/null
@@ -1,16 +0,0 @@
-// +build solaris
-// +build !appengine
-
-package isatty
-
-import (
- "golang.org/x/sys/unix"
-)
-
-// IsTerminal returns true if the given file descriptor is a terminal.
-// see: http://src.illumos.org/source/xref/illumos-gate/usr/src/lib/libbc/libc/gen/common/isatty.c
-func IsTerminal(fd uintptr) bool {
- var termio unix.Termio
- err := unix.IoctlSetTermio(int(fd), unix.TCGETA, &termio)
- return err == nil
-}
diff --git a/vendor/github.com/mattn/go-isatty/isatty_windows.go b/vendor/github.com/mattn/go-isatty/isatty_windows.go
deleted file mode 100644
index af51cbc..0000000
--- a/vendor/github.com/mattn/go-isatty/isatty_windows.go
+++ /dev/null
@@ -1,94 +0,0 @@
-// +build windows
-// +build !appengine
-
-package isatty
-
-import (
- "strings"
- "syscall"
- "unicode/utf16"
- "unsafe"
-)
-
-const (
- fileNameInfo uintptr = 2
- fileTypePipe = 3
-)
-
-var (
- kernel32 = syscall.NewLazyDLL("kernel32.dll")
- procGetConsoleMode = kernel32.NewProc("GetConsoleMode")
- procGetFileInformationByHandleEx = kernel32.NewProc("GetFileInformationByHandleEx")
- procGetFileType = kernel32.NewProc("GetFileType")
-)
-
-func init() {
- // Check if GetFileInformationByHandleEx is available.
- if procGetFileInformationByHandleEx.Find() != nil {
- procGetFileInformationByHandleEx = nil
- }
-}
-
-// IsTerminal return true if the file descriptor is terminal.
-func IsTerminal(fd uintptr) bool {
- var st uint32
- r, _, e := syscall.Syscall(procGetConsoleMode.Addr(), 2, fd, uintptr(unsafe.Pointer(&st)), 0)
- return r != 0 && e == 0
-}
-
-// Check pipe name is used for cygwin/msys2 pty.
-// Cygwin/MSYS2 PTY has a name like:
-// \{cygwin,msys}-XXXXXXXXXXXXXXXX-ptyN-{from,to}-master
-func isCygwinPipeName(name string) bool {
- token := strings.Split(name, "-")
- if len(token) < 5 {
- return false
- }
-
- if token[0] != `\msys` && token[0] != `\cygwin` {
- return false
- }
-
- if token[1] == "" {
- return false
- }
-
- if !strings.HasPrefix(token[2], "pty") {
- return false
- }
-
- if token[3] != `from` && token[3] != `to` {
- return false
- }
-
- if token[4] != "master" {
- return false
- }
-
- return true
-}
-
-// IsCygwinTerminal() return true if the file descriptor is a cygwin or msys2
-// terminal.
-func IsCygwinTerminal(fd uintptr) bool {
- if procGetFileInformationByHandleEx == nil {
- return false
- }
-
- // Cygwin/msys's pty is a pipe.
- ft, _, e := syscall.Syscall(procGetFileType.Addr(), 1, fd, 0, 0)
- if ft != fileTypePipe || e != 0 {
- return false
- }
-
- var buf [2 + syscall.MAX_PATH]uint16
- r, _, e := syscall.Syscall6(procGetFileInformationByHandleEx.Addr(),
- 4, fd, fileNameInfo, uintptr(unsafe.Pointer(&buf)),
- uintptr(len(buf)*2), 0, 0)
- if r == 0 || e != 0 {
- return false
- }
-
- l := *(*uint32)(unsafe.Pointer(&buf))
- return isCygwinPipeName(string(utf16.Decode(buf[2 : 2+l/2])))
-}
diff --git a/vendor/github.com/mattn/go-isatty/isatty_windows_test.go b/vendor/github.com/mattn/go-isatty/isatty_windows_test.go
deleted file mode 100644
index 777e8a6..0000000
--- a/vendor/github.com/mattn/go-isatty/isatty_windows_test.go
+++ /dev/null
@@ -1,35 +0,0 @@
-// +build windows
-
-package isatty
-
-import (
- "testing"
-)
-
-func TestCygwinPipeName(t *testing.T) {
- tests := []struct {
- name string
- result bool
- }{
- {``, false},
- {`\msys-`, false},
- {`\cygwin-----`, false},
- {`\msys-x-PTY5-pty1-from-master`, false},
- {`\cygwin-x-PTY5-from-master`, false},
- {`\cygwin-x-pty2-from-toaster`, false},
- {`\cygwin--pty2-from-master`, false},
- {`\\cygwin-x-pty2-from-master`, false},
- {`\cygwin-x-pty2-from-master-`, true}, // for the feature
- {`\cygwin-e022582115c10879-pty4-from-master`, true},
- {`\msys-e022582115c10879-pty4-to-master`, true},
- {`\cygwin-e022582115c10879-pty4-to-master`, true},
- }
-
- for _, test := range tests {
- want := test.result
- got := isCygwinPipeName(test.name)
- if want != got {
- t.Fatalf("isatty(%q): got %v, want %v:", test.name, got, want)
- }
- }
-}
diff --git a/vendor/github.com/mattn/go-runewidth/.travis.yml b/vendor/github.com/mattn/go-runewidth/.travis.yml
deleted file mode 100644
index 5c9c2a3..0000000
--- a/vendor/github.com/mattn/go-runewidth/.travis.yml
+++ /dev/null
@@ -1,8 +0,0 @@
-language: go
-go:
- - tip
-before_install:
- - go get github.com/mattn/goveralls
- - go get golang.org/x/tools/cmd/cover
-script:
- - $HOME/gopath/bin/goveralls -repotoken lAKAWPzcGsD3A8yBX3BGGtRUdJ6CaGERL
diff --git a/vendor/github.com/mattn/go-runewidth/LICENSE b/vendor/github.com/mattn/go-runewidth/LICENSE
deleted file mode 100644
index 91b5cef..0000000
--- a/vendor/github.com/mattn/go-runewidth/LICENSE
+++ /dev/null
@@ -1,21 +0,0 @@
-The MIT License (MIT)
-
-Copyright (c) 2016 Yasuhiro Matsumoto
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all
-copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-SOFTWARE.
diff --git a/vendor/github.com/mattn/go-runewidth/README.mkd b/vendor/github.com/mattn/go-runewidth/README.mkd
deleted file mode 100644
index 66663a9..0000000
--- a/vendor/github.com/mattn/go-runewidth/README.mkd
+++ /dev/null
@@ -1,27 +0,0 @@
-go-runewidth
-============
-
-[![Build Status](https://travis-ci.org/mattn/go-runewidth.png?branch=master)](https://travis-ci.org/mattn/go-runewidth)
-[![Coverage Status](https://coveralls.io/repos/mattn/go-runewidth/badge.png?branch=HEAD)](https://coveralls.io/r/mattn/go-runewidth?branch=HEAD)
-[![GoDoc](https://godoc.org/github.com/mattn/go-runewidth?status.svg)](http://godoc.org/github.com/mattn/go-runewidth)
-[![Go Report Card](https://goreportcard.com/badge/github.com/mattn/go-runewidth)](https://goreportcard.com/report/github.com/mattn/go-runewidth)
-
-Provides functions to get fixed width of the character or string.
-
-Usage
------
-
-```go
-runewidth.StringWidth("つのだ☆HIRO") == 12
-```
-
-
-Author
-------
-
-Yasuhiro Matsumoto
-
-License
--------
-
-under the MIT License: http://mattn.mit-license.org/2013
diff --git a/vendor/github.com/mattn/go-runewidth/runewidth.go b/vendor/github.com/mattn/go-runewidth/runewidth.go
deleted file mode 100644
index 2164497..0000000
--- a/vendor/github.com/mattn/go-runewidth/runewidth.go
+++ /dev/null
@@ -1,1223 +0,0 @@
-package runewidth
-
-var (
- // EastAsianWidth will be set true if the current locale is CJK
- EastAsianWidth = IsEastAsian()
-
- // DefaultCondition is a condition in current locale
- DefaultCondition = &Condition{EastAsianWidth}
-)
-
-type interval struct {
- first rune
- last rune
-}
-
-type table []interval
-
-func inTables(r rune, ts ...table) bool {
- for _, t := range ts {
- if inTable(r, t) {
- return true
- }
- }
- return false
-}
-
-func inTable(r rune, t table) bool {
- // func (t table) IncludesRune(r rune) bool {
- if r < t[0].first {
- return false
- }
-
- bot := 0
- top := len(t) - 1
- for top >= bot {
- mid := (bot + top) / 2
-
- switch {
- case t[mid].last < r:
- bot = mid + 1
- case t[mid].first > r:
- top = mid - 1
- default:
- return true
- }
- }
-
- return false
-}
-
-var private = table{
- {0x00E000, 0x00F8FF}, {0x0F0000, 0x0FFFFD}, {0x100000, 0x10FFFD},
-}
-
-var nonprint = table{
- {0x0000, 0x001F}, {0x007F, 0x009F}, {0x00AD, 0x00AD},
- {0x070F, 0x070F}, {0x180B, 0x180E}, {0x200B, 0x200F},
- {0x202A, 0x202E}, {0x206A, 0x206F}, {0xD800, 0xDFFF},
- {0xFEFF, 0xFEFF}, {0xFFF9, 0xFFFB}, {0xFFFE, 0xFFFF},
-}
-
-var combining = table{
- {0x0300, 0x036F}, {0x0483, 0x0489}, {0x0591, 0x05BD},
- {0x05BF, 0x05BF}, {0x05C1, 0x05C2}, {0x05C4, 0x05C5},
- {0x05C7, 0x05C7}, {0x0610, 0x061A}, {0x064B, 0x065F},
- {0x0670, 0x0670}, {0x06D6, 0x06DC}, {0x06DF, 0x06E4},
- {0x06E7, 0x06E8}, {0x06EA, 0x06ED}, {0x0711, 0x0711},
- {0x0730, 0x074A}, {0x07A6, 0x07B0}, {0x07EB, 0x07F3},
- {0x0816, 0x0819}, {0x081B, 0x0823}, {0x0825, 0x0827},
- {0x0829, 0x082D}, {0x0859, 0x085B}, {0x08D4, 0x08E1},
- {0x08E3, 0x0903}, {0x093A, 0x093C}, {0x093E, 0x094F},
- {0x0951, 0x0957}, {0x0962, 0x0963}, {0x0981, 0x0983},
- {0x09BC, 0x09BC}, {0x09BE, 0x09C4}, {0x09C7, 0x09C8},
- {0x09CB, 0x09CD}, {0x09D7, 0x09D7}, {0x09E2, 0x09E3},
- {0x0A01, 0x0A03}, {0x0A3C, 0x0A3C}, {0x0A3E, 0x0A42},
- {0x0A47, 0x0A48}, {0x0A4B, 0x0A4D}, {0x0A51, 0x0A51},
- {0x0A70, 0x0A71}, {0x0A75, 0x0A75}, {0x0A81, 0x0A83},
- {0x0ABC, 0x0ABC}, {0x0ABE, 0x0AC5}, {0x0AC7, 0x0AC9},
- {0x0ACB, 0x0ACD}, {0x0AE2, 0x0AE3}, {0x0B01, 0x0B03},
- {0x0B3C, 0x0B3C}, {0x0B3E, 0x0B44}, {0x0B47, 0x0B48},
- {0x0B4B, 0x0B4D}, {0x0B56, 0x0B57}, {0x0B62, 0x0B63},
- {0x0B82, 0x0B82}, {0x0BBE, 0x0BC2}, {0x0BC6, 0x0BC8},
- {0x0BCA, 0x0BCD}, {0x0BD7, 0x0BD7}, {0x0C00, 0x0C03},
- {0x0C3E, 0x0C44}, {0x0C46, 0x0C48}, {0x0C4A, 0x0C4D},
- {0x0C55, 0x0C56}, {0x0C62, 0x0C63}, {0x0C81, 0x0C83},
- {0x0CBC, 0x0CBC}, {0x0CBE, 0x0CC4}, {0x0CC6, 0x0CC8},
- {0x0CCA, 0x0CCD}, {0x0CD5, 0x0CD6}, {0x0CE2, 0x0CE3},
- {0x0D01, 0x0D03}, {0x0D3E, 0x0D44}, {0x0D46, 0x0D48},
- {0x0D4A, 0x0D4D}, {0x0D57, 0x0D57}, {0x0D62, 0x0D63},
- {0x0D82, 0x0D83}, {0x0DCA, 0x0DCA}, {0x0DCF, 0x0DD4},
- {0x0DD6, 0x0DD6}, {0x0DD8, 0x0DDF}, {0x0DF2, 0x0DF3},
- {0x0E31, 0x0E31}, {0x0E34, 0x0E3A}, {0x0E47, 0x0E4E},
- {0x0EB1, 0x0EB1}, {0x0EB4, 0x0EB9}, {0x0EBB, 0x0EBC},
- {0x0EC8, 0x0ECD}, {0x0F18, 0x0F19}, {0x0F35, 0x0F35},
- {0x0F37, 0x0F37}, {0x0F39, 0x0F39}, {0x0F3E, 0x0F3F},
- {0x0F71, 0x0F84}, {0x0F86, 0x0F87}, {0x0F8D, 0x0F97},
- {0x0F99, 0x0FBC}, {0x0FC6, 0x0FC6}, {0x102B, 0x103E},
- {0x1056, 0x1059}, {0x105E, 0x1060}, {0x1062, 0x1064},
- {0x1067, 0x106D}, {0x1071, 0x1074}, {0x1082, 0x108D},
- {0x108F, 0x108F}, {0x109A, 0x109D}, {0x135D, 0x135F},
- {0x1712, 0x1714}, {0x1732, 0x1734}, {0x1752, 0x1753},
- {0x1772, 0x1773}, {0x17B4, 0x17D3}, {0x17DD, 0x17DD},
- {0x180B, 0x180D}, {0x1885, 0x1886}, {0x18A9, 0x18A9},
- {0x1920, 0x192B}, {0x1930, 0x193B}, {0x1A17, 0x1A1B},
- {0x1A55, 0x1A5E}, {0x1A60, 0x1A7C}, {0x1A7F, 0x1A7F},
- {0x1AB0, 0x1ABE}, {0x1B00, 0x1B04}, {0x1B34, 0x1B44},
- {0x1B6B, 0x1B73}, {0x1B80, 0x1B82}, {0x1BA1, 0x1BAD},
- {0x1BE6, 0x1BF3}, {0x1C24, 0x1C37}, {0x1CD0, 0x1CD2},
- {0x1CD4, 0x1CE8}, {0x1CED, 0x1CED}, {0x1CF2, 0x1CF4},
- {0x1CF8, 0x1CF9}, {0x1DC0, 0x1DF5}, {0x1DFB, 0x1DFF},
- {0x20D0, 0x20F0}, {0x2CEF, 0x2CF1}, {0x2D7F, 0x2D7F},
- {0x2DE0, 0x2DFF}, {0x302A, 0x302F}, {0x3099, 0x309A},
- {0xA66F, 0xA672}, {0xA674, 0xA67D}, {0xA69E, 0xA69F},
- {0xA6F0, 0xA6F1}, {0xA802, 0xA802}, {0xA806, 0xA806},
- {0xA80B, 0xA80B}, {0xA823, 0xA827}, {0xA880, 0xA881},
- {0xA8B4, 0xA8C5}, {0xA8E0, 0xA8F1}, {0xA926, 0xA92D},
- {0xA947, 0xA953}, {0xA980, 0xA983}, {0xA9B3, 0xA9C0},
- {0xA9E5, 0xA9E5}, {0xAA29, 0xAA36}, {0xAA43, 0xAA43},
- {0xAA4C, 0xAA4D}, {0xAA7B, 0xAA7D}, {0xAAB0, 0xAAB0},
- {0xAAB2, 0xAAB4}, {0xAAB7, 0xAAB8}, {0xAABE, 0xAABF},
- {0xAAC1, 0xAAC1}, {0xAAEB, 0xAAEF}, {0xAAF5, 0xAAF6},
- {0xABE3, 0xABEA}, {0xABEC, 0xABED}, {0xFB1E, 0xFB1E},
- {0xFE00, 0xFE0F}, {0xFE20, 0xFE2F}, {0x101FD, 0x101FD},
- {0x102E0, 0x102E0}, {0x10376, 0x1037A}, {0x10A01, 0x10A03},
- {0x10A05, 0x10A06}, {0x10A0C, 0x10A0F}, {0x10A38, 0x10A3A},
- {0x10A3F, 0x10A3F}, {0x10AE5, 0x10AE6}, {0x11000, 0x11002},
- {0x11038, 0x11046}, {0x1107F, 0x11082}, {0x110B0, 0x110BA},
- {0x11100, 0x11102}, {0x11127, 0x11134}, {0x11173, 0x11173},
- {0x11180, 0x11182}, {0x111B3, 0x111C0}, {0x111CA, 0x111CC},
- {0x1122C, 0x11237}, {0x1123E, 0x1123E}, {0x112DF, 0x112EA},
- {0x11300, 0x11303}, {0x1133C, 0x1133C}, {0x1133E, 0x11344},
- {0x11347, 0x11348}, {0x1134B, 0x1134D}, {0x11357, 0x11357},
- {0x11362, 0x11363}, {0x11366, 0x1136C}, {0x11370, 0x11374},
- {0x11435, 0x11446}, {0x114B0, 0x114C3}, {0x115AF, 0x115B5},
- {0x115B8, 0x115C0}, {0x115DC, 0x115DD}, {0x11630, 0x11640},
- {0x116AB, 0x116B7}, {0x1171D, 0x1172B}, {0x11C2F, 0x11C36},
- {0x11C38, 0x11C3F}, {0x11C92, 0x11CA7}, {0x11CA9, 0x11CB6},
- {0x16AF0, 0x16AF4}, {0x16B30, 0x16B36}, {0x16F51, 0x16F7E},
- {0x16F8F, 0x16F92}, {0x1BC9D, 0x1BC9E}, {0x1D165, 0x1D169},
- {0x1D16D, 0x1D172}, {0x1D17B, 0x1D182}, {0x1D185, 0x1D18B},
- {0x1D1AA, 0x1D1AD}, {0x1D242, 0x1D244}, {0x1DA00, 0x1DA36},
- {0x1DA3B, 0x1DA6C}, {0x1DA75, 0x1DA75}, {0x1DA84, 0x1DA84},
- {0x1DA9B, 0x1DA9F}, {0x1DAA1, 0x1DAAF}, {0x1E000, 0x1E006},
- {0x1E008, 0x1E018}, {0x1E01B, 0x1E021}, {0x1E023, 0x1E024},
- {0x1E026, 0x1E02A}, {0x1E8D0, 0x1E8D6}, {0x1E944, 0x1E94A},
- {0xE0100, 0xE01EF},
-}
-
-var doublewidth = table{
- {0x1100, 0x115F}, {0x231A, 0x231B}, {0x2329, 0x232A},
- {0x23E9, 0x23EC}, {0x23F0, 0x23F0}, {0x23F3, 0x23F3},
- {0x25FD, 0x25FE}, {0x2614, 0x2615}, {0x2648, 0x2653},
- {0x267F, 0x267F}, {0x2693, 0x2693}, {0x26A1, 0x26A1},
- {0x26AA, 0x26AB}, {0x26BD, 0x26BE}, {0x26C4, 0x26C5},
- {0x26CE, 0x26CE}, {0x26D4, 0x26D4}, {0x26EA, 0x26EA},
- {0x26F2, 0x26F3}, {0x26F5, 0x26F5}, {0x26FA, 0x26FA},
- {0x26FD, 0x26FD}, {0x2705, 0x2705}, {0x270A, 0x270B},
- {0x2728, 0x2728}, {0x274C, 0x274C}, {0x274E, 0x274E},
- {0x2753, 0x2755}, {0x2757, 0x2757}, {0x2795, 0x2797},
- {0x27B0, 0x27B0}, {0x27BF, 0x27BF}, {0x2B1B, 0x2B1C},
- {0x2B50, 0x2B50}, {0x2B55, 0x2B55}, {0x2E80, 0x2E99},
- {0x2E9B, 0x2EF3}, {0x2F00, 0x2FD5}, {0x2FF0, 0x2FFB},
- {0x3000, 0x303E}, {0x3041, 0x3096}, {0x3099, 0x30FF},
- {0x3105, 0x312D}, {0x3131, 0x318E}, {0x3190, 0x31BA},
- {0x31C0, 0x31E3}, {0x31F0, 0x321E}, {0x3220, 0x3247},
- {0x3250, 0x32FE}, {0x3300, 0x4DBF}, {0x4E00, 0xA48C},
- {0xA490, 0xA4C6}, {0xA960, 0xA97C}, {0xAC00, 0xD7A3},
- {0xF900, 0xFAFF}, {0xFE10, 0xFE19}, {0xFE30, 0xFE52},
- {0xFE54, 0xFE66}, {0xFE68, 0xFE6B}, {0xFF01, 0xFF60},
- {0xFFE0, 0xFFE6}, {0x16FE0, 0x16FE0}, {0x17000, 0x187EC},
- {0x18800, 0x18AF2}, {0x1B000, 0x1B001}, {0x1F004, 0x1F004},
- {0x1F0CF, 0x1F0CF}, {0x1F18E, 0x1F18E}, {0x1F191, 0x1F19A},
- {0x1F200, 0x1F202}, {0x1F210, 0x1F23B}, {0x1F240, 0x1F248},
- {0x1F250, 0x1F251}, {0x1F300, 0x1F320}, {0x1F32D, 0x1F335},
- {0x1F337, 0x1F37C}, {0x1F37E, 0x1F393}, {0x1F3A0, 0x1F3CA},
- {0x1F3CF, 0x1F3D3}, {0x1F3E0, 0x1F3F0}, {0x1F3F4, 0x1F3F4},
- {0x1F3F8, 0x1F43E}, {0x1F440, 0x1F440}, {0x1F442, 0x1F4FC},
- {0x1F4FF, 0x1F53D}, {0x1F54B, 0x1F54E}, {0x1F550, 0x1F567},
- {0x1F57A, 0x1F57A}, {0x1F595, 0x1F596}, {0x1F5A4, 0x1F5A4},
- {0x1F5FB, 0x1F64F}, {0x1F680, 0x1F6C5}, {0x1F6CC, 0x1F6CC},
- {0x1F6D0, 0x1F6D2}, {0x1F6EB, 0x1F6EC}, {0x1F6F4, 0x1F6F6},
- {0x1F910, 0x1F91E}, {0x1F920, 0x1F927}, {0x1F930, 0x1F930},
- {0x1F933, 0x1F93E}, {0x1F940, 0x1F94B}, {0x1F950, 0x1F95E},
- {0x1F980, 0x1F991}, {0x1F9C0, 0x1F9C0}, {0x20000, 0x2FFFD},
- {0x30000, 0x3FFFD},
-}
-
-var ambiguous = table{
- {0x00A1, 0x00A1}, {0x00A4, 0x00A4}, {0x00A7, 0x00A8},
- {0x00AA, 0x00AA}, {0x00AD, 0x00AE}, {0x00B0, 0x00B4},
- {0x00B6, 0x00BA}, {0x00BC, 0x00BF}, {0x00C6, 0x00C6},
- {0x00D0, 0x00D0}, {0x00D7, 0x00D8}, {0x00DE, 0x00E1},
- {0x00E6, 0x00E6}, {0x00E8, 0x00EA}, {0x00EC, 0x00ED},
- {0x00F0, 0x00F0}, {0x00F2, 0x00F3}, {0x00F7, 0x00FA},
- {0x00FC, 0x00FC}, {0x00FE, 0x00FE}, {0x0101, 0x0101},
- {0x0111, 0x0111}, {0x0113, 0x0113}, {0x011B, 0x011B},
- {0x0126, 0x0127}, {0x012B, 0x012B}, {0x0131, 0x0133},
- {0x0138, 0x0138}, {0x013F, 0x0142}, {0x0144, 0x0144},
- {0x0148, 0x014B}, {0x014D, 0x014D}, {0x0152, 0x0153},
- {0x0166, 0x0167}, {0x016B, 0x016B}, {0x01CE, 0x01CE},
- {0x01D0, 0x01D0}, {0x01D2, 0x01D2}, {0x01D4, 0x01D4},
- {0x01D6, 0x01D6}, {0x01D8, 0x01D8}, {0x01DA, 0x01DA},
- {0x01DC, 0x01DC}, {0x0251, 0x0251}, {0x0261, 0x0261},
- {0x02C4, 0x02C4}, {0x02C7, 0x02C7}, {0x02C9, 0x02CB},
- {0x02CD, 0x02CD}, {0x02D0, 0x02D0}, {0x02D8, 0x02DB},
- {0x02DD, 0x02DD}, {0x02DF, 0x02DF}, {0x0300, 0x036F},
- {0x0391, 0x03A1}, {0x03A3, 0x03A9}, {0x03B1, 0x03C1},
- {0x03C3, 0x03C9}, {0x0401, 0x0401}, {0x0410, 0x044F},
- {0x0451, 0x0451}, {0x2010, 0x2010}, {0x2013, 0x2016},
- {0x2018, 0x2019}, {0x201C, 0x201D}, {0x2020, 0x2022},
- {0x2024, 0x2027}, {0x2030, 0x2030}, {0x2032, 0x2033},
- {0x2035, 0x2035}, {0x203B, 0x203B}, {0x203E, 0x203E},
- {0x2074, 0x2074}, {0x207F, 0x207F}, {0x2081, 0x2084},
- {0x20AC, 0x20AC}, {0x2103, 0x2103}, {0x2105, 0x2105},
- {0x2109, 0x2109}, {0x2113, 0x2113}, {0x2116, 0x2116},
- {0x2121, 0x2122}, {0x2126, 0x2126}, {0x212B, 0x212B},
- {0x2153, 0x2154}, {0x215B, 0x215E}, {0x2160, 0x216B},
- {0x2170, 0x2179}, {0x2189, 0x2189}, {0x2190, 0x2199},
- {0x21B8, 0x21B9}, {0x21D2, 0x21D2}, {0x21D4, 0x21D4},
- {0x21E7, 0x21E7}, {0x2200, 0x2200}, {0x2202, 0x2203},
- {0x2207, 0x2208}, {0x220B, 0x220B}, {0x220F, 0x220F},
- {0x2211, 0x2211}, {0x2215, 0x2215}, {0x221A, 0x221A},
- {0x221D, 0x2220}, {0x2223, 0x2223}, {0x2225, 0x2225},
- {0x2227, 0x222C}, {0x222E, 0x222E}, {0x2234, 0x2237},
- {0x223C, 0x223D}, {0x2248, 0x2248}, {0x224C, 0x224C},
- {0x2252, 0x2252}, {0x2260, 0x2261}, {0x2264, 0x2267},
- {0x226A, 0x226B}, {0x226E, 0x226F}, {0x2282, 0x2283},
- {0x2286, 0x2287}, {0x2295, 0x2295}, {0x2299, 0x2299},
- {0x22A5, 0x22A5}, {0x22BF, 0x22BF}, {0x2312, 0x2312},
- {0x2460, 0x24E9}, {0x24EB, 0x254B}, {0x2550, 0x2573},
- {0x2580, 0x258F}, {0x2592, 0x2595}, {0x25A0, 0x25A1},
- {0x25A3, 0x25A9}, {0x25B2, 0x25B3}, {0x25B6, 0x25B7},
- {0x25BC, 0x25BD}, {0x25C0, 0x25C1}, {0x25C6, 0x25C8},
- {0x25CB, 0x25CB}, {0x25CE, 0x25D1}, {0x25E2, 0x25E5},
- {0x25EF, 0x25EF}, {0x2605, 0x2606}, {0x2609, 0x2609},
- {0x260E, 0x260F}, {0x261C, 0x261C}, {0x261E, 0x261E},
- {0x2640, 0x2640}, {0x2642, 0x2642}, {0x2660, 0x2661},
- {0x2663, 0x2665}, {0x2667, 0x266A}, {0x266C, 0x266D},
- {0x266F, 0x266F}, {0x269E, 0x269F}, {0x26BF, 0x26BF},
- {0x26C6, 0x26CD}, {0x26CF, 0x26D3}, {0x26D5, 0x26E1},
- {0x26E3, 0x26E3}, {0x26E8, 0x26E9}, {0x26EB, 0x26F1},
- {0x26F4, 0x26F4}, {0x26F6, 0x26F9}, {0x26FB, 0x26FC},
- {0x26FE, 0x26FF}, {0x273D, 0x273D}, {0x2776, 0x277F},
- {0x2B56, 0x2B59}, {0x3248, 0x324F}, {0xE000, 0xF8FF},
- {0xFE00, 0xFE0F}, {0xFFFD, 0xFFFD}, {0x1F100, 0x1F10A},
- {0x1F110, 0x1F12D}, {0x1F130, 0x1F169}, {0x1F170, 0x1F18D},
- {0x1F18F, 0x1F190}, {0x1F19B, 0x1F1AC}, {0xE0100, 0xE01EF},
- {0xF0000, 0xFFFFD}, {0x100000, 0x10FFFD},
-}
-
-var emoji = table{
- {0x1F1E6, 0x1F1FF}, {0x1F321, 0x1F321}, {0x1F324, 0x1F32C},
- {0x1F336, 0x1F336}, {0x1F37D, 0x1F37D}, {0x1F396, 0x1F397},
- {0x1F399, 0x1F39B}, {0x1F39E, 0x1F39F}, {0x1F3CB, 0x1F3CE},
- {0x1F3D4, 0x1F3DF}, {0x1F3F3, 0x1F3F5}, {0x1F3F7, 0x1F3F7},
- {0x1F43F, 0x1F43F}, {0x1F441, 0x1F441}, {0x1F4FD, 0x1F4FD},
- {0x1F549, 0x1F54A}, {0x1F56F, 0x1F570}, {0x1F573, 0x1F579},
- {0x1F587, 0x1F587}, {0x1F58A, 0x1F58D}, {0x1F590, 0x1F590},
- {0x1F5A5, 0x1F5A5}, {0x1F5A8, 0x1F5A8}, {0x1F5B1, 0x1F5B2},
- {0x1F5BC, 0x1F5BC}, {0x1F5C2, 0x1F5C4}, {0x1F5D1, 0x1F5D3},
- {0x1F5DC, 0x1F5DE}, {0x1F5E1, 0x1F5E1}, {0x1F5E3, 0x1F5E3},
- {0x1F5E8, 0x1F5E8}, {0x1F5EF, 0x1F5EF}, {0x1F5F3, 0x1F5F3},
- {0x1F5FA, 0x1F5FA}, {0x1F6CB, 0x1F6CF}, {0x1F6E0, 0x1F6E5},
- {0x1F6E9, 0x1F6E9}, {0x1F6F0, 0x1F6F0}, {0x1F6F3, 0x1F6F3},
-}
-
-var notassigned = table{
- {0x0378, 0x0379}, {0x0380, 0x0383}, {0x038B, 0x038B},
- {0x038D, 0x038D}, {0x03A2, 0x03A2}, {0x0530, 0x0530},
- {0x0557, 0x0558}, {0x0560, 0x0560}, {0x0588, 0x0588},
- {0x058B, 0x058C}, {0x0590, 0x0590}, {0x05C8, 0x05CF},
- {0x05EB, 0x05EF}, {0x05F5, 0x05FF}, {0x061D, 0x061D},
- {0x070E, 0x070E}, {0x074B, 0x074C}, {0x07B2, 0x07BF},
- {0x07FB, 0x07FF}, {0x082E, 0x082F}, {0x083F, 0x083F},
- {0x085C, 0x085D}, {0x085F, 0x089F}, {0x08B5, 0x08B5},
- {0x08BE, 0x08D3}, {0x0984, 0x0984}, {0x098D, 0x098E},
- {0x0991, 0x0992}, {0x09A9, 0x09A9}, {0x09B1, 0x09B1},
- {0x09B3, 0x09B5}, {0x09BA, 0x09BB}, {0x09C5, 0x09C6},
- {0x09C9, 0x09CA}, {0x09CF, 0x09D6}, {0x09D8, 0x09DB},
- {0x09DE, 0x09DE}, {0x09E4, 0x09E5}, {0x09FC, 0x0A00},
- {0x0A04, 0x0A04}, {0x0A0B, 0x0A0E}, {0x0A11, 0x0A12},
- {0x0A29, 0x0A29}, {0x0A31, 0x0A31}, {0x0A34, 0x0A34},
- {0x0A37, 0x0A37}, {0x0A3A, 0x0A3B}, {0x0A3D, 0x0A3D},
- {0x0A43, 0x0A46}, {0x0A49, 0x0A4A}, {0x0A4E, 0x0A50},
- {0x0A52, 0x0A58}, {0x0A5D, 0x0A5D}, {0x0A5F, 0x0A65},
- {0x0A76, 0x0A80}, {0x0A84, 0x0A84}, {0x0A8E, 0x0A8E},
- {0x0A92, 0x0A92}, {0x0AA9, 0x0AA9}, {0x0AB1, 0x0AB1},
- {0x0AB4, 0x0AB4}, {0x0ABA, 0x0ABB}, {0x0AC6, 0x0AC6},
- {0x0ACA, 0x0ACA}, {0x0ACE, 0x0ACF}, {0x0AD1, 0x0ADF},
- {0x0AE4, 0x0AE5}, {0x0AF2, 0x0AF8}, {0x0AFA, 0x0B00},
- {0x0B04, 0x0B04}, {0x0B0D, 0x0B0E}, {0x0B11, 0x0B12},
- {0x0B29, 0x0B29}, {0x0B31, 0x0B31}, {0x0B34, 0x0B34},
- {0x0B3A, 0x0B3B}, {0x0B45, 0x0B46}, {0x0B49, 0x0B4A},
- {0x0B4E, 0x0B55}, {0x0B58, 0x0B5B}, {0x0B5E, 0x0B5E},
- {0x0B64, 0x0B65}, {0x0B78, 0x0B81}, {0x0B84, 0x0B84},
- {0x0B8B, 0x0B8D}, {0x0B91, 0x0B91}, {0x0B96, 0x0B98},
- {0x0B9B, 0x0B9B}, {0x0B9D, 0x0B9D}, {0x0BA0, 0x0BA2},
- {0x0BA5, 0x0BA7}, {0x0BAB, 0x0BAD}, {0x0BBA, 0x0BBD},
- {0x0BC3, 0x0BC5}, {0x0BC9, 0x0BC9}, {0x0BCE, 0x0BCF},
- {0x0BD1, 0x0BD6}, {0x0BD8, 0x0BE5}, {0x0BFB, 0x0BFF},
- {0x0C04, 0x0C04}, {0x0C0D, 0x0C0D}, {0x0C11, 0x0C11},
- {0x0C29, 0x0C29}, {0x0C3A, 0x0C3C}, {0x0C45, 0x0C45},
- {0x0C49, 0x0C49}, {0x0C4E, 0x0C54}, {0x0C57, 0x0C57},
- {0x0C5B, 0x0C5F}, {0x0C64, 0x0C65}, {0x0C70, 0x0C77},
- {0x0C84, 0x0C84}, {0x0C8D, 0x0C8D}, {0x0C91, 0x0C91},
- {0x0CA9, 0x0CA9}, {0x0CB4, 0x0CB4}, {0x0CBA, 0x0CBB},
- {0x0CC5, 0x0CC5}, {0x0CC9, 0x0CC9}, {0x0CCE, 0x0CD4},
- {0x0CD7, 0x0CDD}, {0x0CDF, 0x0CDF}, {0x0CE4, 0x0CE5},
- {0x0CF0, 0x0CF0}, {0x0CF3, 0x0D00}, {0x0D04, 0x0D04},
- {0x0D0D, 0x0D0D}, {0x0D11, 0x0D11}, {0x0D3B, 0x0D3C},
- {0x0D45, 0x0D45}, {0x0D49, 0x0D49}, {0x0D50, 0x0D53},
- {0x0D64, 0x0D65}, {0x0D80, 0x0D81}, {0x0D84, 0x0D84},
- {0x0D97, 0x0D99}, {0x0DB2, 0x0DB2}, {0x0DBC, 0x0DBC},
- {0x0DBE, 0x0DBF}, {0x0DC7, 0x0DC9}, {0x0DCB, 0x0DCE},
- {0x0DD5, 0x0DD5}, {0x0DD7, 0x0DD7}, {0x0DE0, 0x0DE5},
- {0x0DF0, 0x0DF1}, {0x0DF5, 0x0E00}, {0x0E3B, 0x0E3E},
- {0x0E5C, 0x0E80}, {0x0E83, 0x0E83}, {0x0E85, 0x0E86},
- {0x0E89, 0x0E89}, {0x0E8B, 0x0E8C}, {0x0E8E, 0x0E93},
- {0x0E98, 0x0E98}, {0x0EA0, 0x0EA0}, {0x0EA4, 0x0EA4},
- {0x0EA6, 0x0EA6}, {0x0EA8, 0x0EA9}, {0x0EAC, 0x0EAC},
- {0x0EBA, 0x0EBA}, {0x0EBE, 0x0EBF}, {0x0EC5, 0x0EC5},
- {0x0EC7, 0x0EC7}, {0x0ECE, 0x0ECF}, {0x0EDA, 0x0EDB},
- {0x0EE0, 0x0EFF}, {0x0F48, 0x0F48}, {0x0F6D, 0x0F70},
- {0x0F98, 0x0F98}, {0x0FBD, 0x0FBD}, {0x0FCD, 0x0FCD},
- {0x0FDB, 0x0FFF}, {0x10C6, 0x10C6}, {0x10C8, 0x10CC},
- {0x10CE, 0x10CF}, {0x1249, 0x1249}, {0x124E, 0x124F},
- {0x1257, 0x1257}, {0x1259, 0x1259}, {0x125E, 0x125F},
- {0x1289, 0x1289}, {0x128E, 0x128F}, {0x12B1, 0x12B1},
- {0x12B6, 0x12B7}, {0x12BF, 0x12BF}, {0x12C1, 0x12C1},
- {0x12C6, 0x12C7}, {0x12D7, 0x12D7}, {0x1311, 0x1311},
- {0x1316, 0x1317}, {0x135B, 0x135C}, {0x137D, 0x137F},
- {0x139A, 0x139F}, {0x13F6, 0x13F7}, {0x13FE, 0x13FF},
- {0x169D, 0x169F}, {0x16F9, 0x16FF}, {0x170D, 0x170D},
- {0x1715, 0x171F}, {0x1737, 0x173F}, {0x1754, 0x175F},
- {0x176D, 0x176D}, {0x1771, 0x1771}, {0x1774, 0x177F},
- {0x17DE, 0x17DF}, {0x17EA, 0x17EF}, {0x17FA, 0x17FF},
- {0x180F, 0x180F}, {0x181A, 0x181F}, {0x1878, 0x187F},
- {0x18AB, 0x18AF}, {0x18F6, 0x18FF}, {0x191F, 0x191F},
- {0x192C, 0x192F}, {0x193C, 0x193F}, {0x1941, 0x1943},
- {0x196E, 0x196F}, {0x1975, 0x197F}, {0x19AC, 0x19AF},
- {0x19CA, 0x19CF}, {0x19DB, 0x19DD}, {0x1A1C, 0x1A1D},
- {0x1A5F, 0x1A5F}, {0x1A7D, 0x1A7E}, {0x1A8A, 0x1A8F},
- {0x1A9A, 0x1A9F}, {0x1AAE, 0x1AAF}, {0x1ABF, 0x1AFF},
- {0x1B4C, 0x1B4F}, {0x1B7D, 0x1B7F}, {0x1BF4, 0x1BFB},
- {0x1C38, 0x1C3A}, {0x1C4A, 0x1C4C}, {0x1C89, 0x1CBF},
- {0x1CC8, 0x1CCF}, {0x1CF7, 0x1CF7}, {0x1CFA, 0x1CFF},
- {0x1DF6, 0x1DFA}, {0x1F16, 0x1F17}, {0x1F1E, 0x1F1F},
- {0x1F46, 0x1F47}, {0x1F4E, 0x1F4F}, {0x1F58, 0x1F58},
- {0x1F5A, 0x1F5A}, {0x1F5C, 0x1F5C}, {0x1F5E, 0x1F5E},
- {0x1F7E, 0x1F7F}, {0x1FB5, 0x1FB5}, {0x1FC5, 0x1FC5},
- {0x1FD4, 0x1FD5}, {0x1FDC, 0x1FDC}, {0x1FF0, 0x1FF1},
- {0x1FF5, 0x1FF5}, {0x1FFF, 0x1FFF}, {0x2065, 0x2065},
- {0x2072, 0x2073}, {0x208F, 0x208F}, {0x209D, 0x209F},
- {0x20BF, 0x20CF}, {0x20F1, 0x20FF}, {0x218C, 0x218F},
- {0x23FF, 0x23FF}, {0x2427, 0x243F}, {0x244B, 0x245F},
- {0x2B74, 0x2B75}, {0x2B96, 0x2B97}, {0x2BBA, 0x2BBC},
- {0x2BC9, 0x2BC9}, {0x2BD2, 0x2BEB}, {0x2BF0, 0x2BFF},
- {0x2C2F, 0x2C2F}, {0x2C5F, 0x2C5F}, {0x2CF4, 0x2CF8},
- {0x2D26, 0x2D26}, {0x2D28, 0x2D2C}, {0x2D2E, 0x2D2F},
- {0x2D68, 0x2D6E}, {0x2D71, 0x2D7E}, {0x2D97, 0x2D9F},
- {0x2DA7, 0x2DA7}, {0x2DAF, 0x2DAF}, {0x2DB7, 0x2DB7},
- {0x2DBF, 0x2DBF}, {0x2DC7, 0x2DC7}, {0x2DCF, 0x2DCF},
- {0x2DD7, 0x2DD7}, {0x2DDF, 0x2DDF}, {0x2E45, 0x2E7F},
- {0x2E9A, 0x2E9A}, {0x2EF4, 0x2EFF}, {0x2FD6, 0x2FEF},
- {0x2FFC, 0x2FFF}, {0x3040, 0x3040}, {0x3097, 0x3098},
- {0x3100, 0x3104}, {0x312E, 0x3130}, {0x318F, 0x318F},
- {0x31BB, 0x31BF}, {0x31E4, 0x31EF}, {0x321F, 0x321F},
- {0x32FF, 0x32FF}, {0x4DB6, 0x4DBF}, {0x9FD6, 0x9FFF},
- {0xA48D, 0xA48F}, {0xA4C7, 0xA4CF}, {0xA62C, 0xA63F},
- {0xA6F8, 0xA6FF}, {0xA7AF, 0xA7AF}, {0xA7B8, 0xA7F6},
- {0xA82C, 0xA82F}, {0xA83A, 0xA83F}, {0xA878, 0xA87F},
- {0xA8C6, 0xA8CD}, {0xA8DA, 0xA8DF}, {0xA8FE, 0xA8FF},
- {0xA954, 0xA95E}, {0xA97D, 0xA97F}, {0xA9CE, 0xA9CE},
- {0xA9DA, 0xA9DD}, {0xA9FF, 0xA9FF}, {0xAA37, 0xAA3F},
- {0xAA4E, 0xAA4F}, {0xAA5A, 0xAA5B}, {0xAAC3, 0xAADA},
- {0xAAF7, 0xAB00}, {0xAB07, 0xAB08}, {0xAB0F, 0xAB10},
- {0xAB17, 0xAB1F}, {0xAB27, 0xAB27}, {0xAB2F, 0xAB2F},
- {0xAB66, 0xAB6F}, {0xABEE, 0xABEF}, {0xABFA, 0xABFF},
- {0xD7A4, 0xD7AF}, {0xD7C7, 0xD7CA}, {0xD7FC, 0xD7FF},
- {0xFA6E, 0xFA6F}, {0xFADA, 0xFAFF}, {0xFB07, 0xFB12},
- {0xFB18, 0xFB1C}, {0xFB37, 0xFB37}, {0xFB3D, 0xFB3D},
- {0xFB3F, 0xFB3F}, {0xFB42, 0xFB42}, {0xFB45, 0xFB45},
- {0xFBC2, 0xFBD2}, {0xFD40, 0xFD4F}, {0xFD90, 0xFD91},
- {0xFDC8, 0xFDEF}, {0xFDFE, 0xFDFF}, {0xFE1A, 0xFE1F},
- {0xFE53, 0xFE53}, {0xFE67, 0xFE67}, {0xFE6C, 0xFE6F},
- {0xFE75, 0xFE75}, {0xFEFD, 0xFEFE}, {0xFF00, 0xFF00},
- {0xFFBF, 0xFFC1}, {0xFFC8, 0xFFC9}, {0xFFD0, 0xFFD1},
- {0xFFD8, 0xFFD9}, {0xFFDD, 0xFFDF}, {0xFFE7, 0xFFE7},
- {0xFFEF, 0xFFF8}, {0xFFFE, 0xFFFF}, {0x1000C, 0x1000C},
- {0x10027, 0x10027}, {0x1003B, 0x1003B}, {0x1003E, 0x1003E},
- {0x1004E, 0x1004F}, {0x1005E, 0x1007F}, {0x100FB, 0x100FF},
- {0x10103, 0x10106}, {0x10134, 0x10136}, {0x1018F, 0x1018F},
- {0x1019C, 0x1019F}, {0x101A1, 0x101CF}, {0x101FE, 0x1027F},
- {0x1029D, 0x1029F}, {0x102D1, 0x102DF}, {0x102FC, 0x102FF},
- {0x10324, 0x1032F}, {0x1034B, 0x1034F}, {0x1037B, 0x1037F},
- {0x1039E, 0x1039E}, {0x103C4, 0x103C7}, {0x103D6, 0x103FF},
- {0x1049E, 0x1049F}, {0x104AA, 0x104AF}, {0x104D4, 0x104D7},
- {0x104FC, 0x104FF}, {0x10528, 0x1052F}, {0x10564, 0x1056E},
- {0x10570, 0x105FF}, {0x10737, 0x1073F}, {0x10756, 0x1075F},
- {0x10768, 0x107FF}, {0x10806, 0x10807}, {0x10809, 0x10809},
- {0x10836, 0x10836}, {0x10839, 0x1083B}, {0x1083D, 0x1083E},
- {0x10856, 0x10856}, {0x1089F, 0x108A6}, {0x108B0, 0x108DF},
- {0x108F3, 0x108F3}, {0x108F6, 0x108FA}, {0x1091C, 0x1091E},
- {0x1093A, 0x1093E}, {0x10940, 0x1097F}, {0x109B8, 0x109BB},
- {0x109D0, 0x109D1}, {0x10A04, 0x10A04}, {0x10A07, 0x10A0B},
- {0x10A14, 0x10A14}, {0x10A18, 0x10A18}, {0x10A34, 0x10A37},
- {0x10A3B, 0x10A3E}, {0x10A48, 0x10A4F}, {0x10A59, 0x10A5F},
- {0x10AA0, 0x10ABF}, {0x10AE7, 0x10AEA}, {0x10AF7, 0x10AFF},
- {0x10B36, 0x10B38}, {0x10B56, 0x10B57}, {0x10B73, 0x10B77},
- {0x10B92, 0x10B98}, {0x10B9D, 0x10BA8}, {0x10BB0, 0x10BFF},
- {0x10C49, 0x10C7F}, {0x10CB3, 0x10CBF}, {0x10CF3, 0x10CF9},
- {0x10D00, 0x10E5F}, {0x10E7F, 0x10FFF}, {0x1104E, 0x11051},
- {0x11070, 0x1107E}, {0x110C2, 0x110CF}, {0x110E9, 0x110EF},
- {0x110FA, 0x110FF}, {0x11135, 0x11135}, {0x11144, 0x1114F},
- {0x11177, 0x1117F}, {0x111CE, 0x111CF}, {0x111E0, 0x111E0},
- {0x111F5, 0x111FF}, {0x11212, 0x11212}, {0x1123F, 0x1127F},
- {0x11287, 0x11287}, {0x11289, 0x11289}, {0x1128E, 0x1128E},
- {0x1129E, 0x1129E}, {0x112AA, 0x112AF}, {0x112EB, 0x112EF},
- {0x112FA, 0x112FF}, {0x11304, 0x11304}, {0x1130D, 0x1130E},
- {0x11311, 0x11312}, {0x11329, 0x11329}, {0x11331, 0x11331},
- {0x11334, 0x11334}, {0x1133A, 0x1133B}, {0x11345, 0x11346},
- {0x11349, 0x1134A}, {0x1134E, 0x1134F}, {0x11351, 0x11356},
- {0x11358, 0x1135C}, {0x11364, 0x11365}, {0x1136D, 0x1136F},
- {0x11375, 0x113FF}, {0x1145A, 0x1145A}, {0x1145C, 0x1145C},
- {0x1145E, 0x1147F}, {0x114C8, 0x114CF}, {0x114DA, 0x1157F},
- {0x115B6, 0x115B7}, {0x115DE, 0x115FF}, {0x11645, 0x1164F},
- {0x1165A, 0x1165F}, {0x1166D, 0x1167F}, {0x116B8, 0x116BF},
- {0x116CA, 0x116FF}, {0x1171A, 0x1171C}, {0x1172C, 0x1172F},
- {0x11740, 0x1189F}, {0x118F3, 0x118FE}, {0x11900, 0x11ABF},
- {0x11AF9, 0x11BFF}, {0x11C09, 0x11C09}, {0x11C37, 0x11C37},
- {0x11C46, 0x11C4F}, {0x11C6D, 0x11C6F}, {0x11C90, 0x11C91},
- {0x11CA8, 0x11CA8}, {0x11CB7, 0x11FFF}, {0x1239A, 0x123FF},
- {0x1246F, 0x1246F}, {0x12475, 0x1247F}, {0x12544, 0x12FFF},
- {0x1342F, 0x143FF}, {0x14647, 0x167FF}, {0x16A39, 0x16A3F},
- {0x16A5F, 0x16A5F}, {0x16A6A, 0x16A6D}, {0x16A70, 0x16ACF},
- {0x16AEE, 0x16AEF}, {0x16AF6, 0x16AFF}, {0x16B46, 0x16B4F},
- {0x16B5A, 0x16B5A}, {0x16B62, 0x16B62}, {0x16B78, 0x16B7C},
- {0x16B90, 0x16EFF}, {0x16F45, 0x16F4F}, {0x16F7F, 0x16F8E},
- {0x16FA0, 0x16FDF}, {0x16FE1, 0x16FFF}, {0x187ED, 0x187FF},
- {0x18AF3, 0x1AFFF}, {0x1B002, 0x1BBFF}, {0x1BC6B, 0x1BC6F},
- {0x1BC7D, 0x1BC7F}, {0x1BC89, 0x1BC8F}, {0x1BC9A, 0x1BC9B},
- {0x1BCA4, 0x1CFFF}, {0x1D0F6, 0x1D0FF}, {0x1D127, 0x1D128},
- {0x1D1E9, 0x1D1FF}, {0x1D246, 0x1D2FF}, {0x1D357, 0x1D35F},
- {0x1D372, 0x1D3FF}, {0x1D455, 0x1D455}, {0x1D49D, 0x1D49D},
- {0x1D4A0, 0x1D4A1}, {0x1D4A3, 0x1D4A4}, {0x1D4A7, 0x1D4A8},
- {0x1D4AD, 0x1D4AD}, {0x1D4BA, 0x1D4BA}, {0x1D4BC, 0x1D4BC},
- {0x1D4C4, 0x1D4C4}, {0x1D506, 0x1D506}, {0x1D50B, 0x1D50C},
- {0x1D515, 0x1D515}, {0x1D51D, 0x1D51D}, {0x1D53A, 0x1D53A},
- {0x1D53F, 0x1D53F}, {0x1D545, 0x1D545}, {0x1D547, 0x1D549},
- {0x1D551, 0x1D551}, {0x1D6A6, 0x1D6A7}, {0x1D7CC, 0x1D7CD},
- {0x1DA8C, 0x1DA9A}, {0x1DAA0, 0x1DAA0}, {0x1DAB0, 0x1DFFF},
- {0x1E007, 0x1E007}, {0x1E019, 0x1E01A}, {0x1E022, 0x1E022},
- {0x1E025, 0x1E025}, {0x1E02B, 0x1E7FF}, {0x1E8C5, 0x1E8C6},
- {0x1E8D7, 0x1E8FF}, {0x1E94B, 0x1E94F}, {0x1E95A, 0x1E95D},
- {0x1E960, 0x1EDFF}, {0x1EE04, 0x1EE04}, {0x1EE20, 0x1EE20},
- {0x1EE23, 0x1EE23}, {0x1EE25, 0x1EE26}, {0x1EE28, 0x1EE28},
- {0x1EE33, 0x1EE33}, {0x1EE38, 0x1EE38}, {0x1EE3A, 0x1EE3A},
- {0x1EE3C, 0x1EE41}, {0x1EE43, 0x1EE46}, {0x1EE48, 0x1EE48},
- {0x1EE4A, 0x1EE4A}, {0x1EE4C, 0x1EE4C}, {0x1EE50, 0x1EE50},
- {0x1EE53, 0x1EE53}, {0x1EE55, 0x1EE56}, {0x1EE58, 0x1EE58},
- {0x1EE5A, 0x1EE5A}, {0x1EE5C, 0x1EE5C}, {0x1EE5E, 0x1EE5E},
- {0x1EE60, 0x1EE60}, {0x1EE63, 0x1EE63}, {0x1EE65, 0x1EE66},
- {0x1EE6B, 0x1EE6B}, {0x1EE73, 0x1EE73}, {0x1EE78, 0x1EE78},
- {0x1EE7D, 0x1EE7D}, {0x1EE7F, 0x1EE7F}, {0x1EE8A, 0x1EE8A},
- {0x1EE9C, 0x1EEA0}, {0x1EEA4, 0x1EEA4}, {0x1EEAA, 0x1EEAA},
- {0x1EEBC, 0x1EEEF}, {0x1EEF2, 0x1EFFF}, {0x1F02C, 0x1F02F},
- {0x1F094, 0x1F09F}, {0x1F0AF, 0x1F0B0}, {0x1F0C0, 0x1F0C0},
- {0x1F0D0, 0x1F0D0}, {0x1F0F6, 0x1F0FF}, {0x1F10D, 0x1F10F},
- {0x1F12F, 0x1F12F}, {0x1F16C, 0x1F16F}, {0x1F1AD, 0x1F1E5},
- {0x1F203, 0x1F20F}, {0x1F23C, 0x1F23F}, {0x1F249, 0x1F24F},
- {0x1F252, 0x1F2FF}, {0x1F6D3, 0x1F6DF}, {0x1F6ED, 0x1F6EF},
- {0x1F6F7, 0x1F6FF}, {0x1F774, 0x1F77F}, {0x1F7D5, 0x1F7FF},
- {0x1F80C, 0x1F80F}, {0x1F848, 0x1F84F}, {0x1F85A, 0x1F85F},
- {0x1F888, 0x1F88F}, {0x1F8AE, 0x1F90F}, {0x1F91F, 0x1F91F},
- {0x1F928, 0x1F92F}, {0x1F931, 0x1F932}, {0x1F93F, 0x1F93F},
- {0x1F94C, 0x1F94F}, {0x1F95F, 0x1F97F}, {0x1F992, 0x1F9BF},
- {0x1F9C1, 0x1FFFF}, {0x2A6D7, 0x2A6FF}, {0x2B735, 0x2B73F},
- {0x2B81E, 0x2B81F}, {0x2CEA2, 0x2F7FF}, {0x2FA1E, 0xE0000},
- {0xE0002, 0xE001F}, {0xE0080, 0xE00FF}, {0xE01F0, 0xEFFFF},
- {0xFFFFE, 0xFFFFF},
-}
-
-var neutral = table{
- {0x0000, 0x001F}, {0x007F, 0x007F}, {0x0080, 0x009F},
- {0x00A0, 0x00A0}, {0x00A9, 0x00A9}, {0x00AB, 0x00AB},
- {0x00B5, 0x00B5}, {0x00BB, 0x00BB}, {0x00C0, 0x00C5},
- {0x00C7, 0x00CF}, {0x00D1, 0x00D6}, {0x00D9, 0x00DD},
- {0x00E2, 0x00E5}, {0x00E7, 0x00E7}, {0x00EB, 0x00EB},
- {0x00EE, 0x00EF}, {0x00F1, 0x00F1}, {0x00F4, 0x00F6},
- {0x00FB, 0x00FB}, {0x00FD, 0x00FD}, {0x00FF, 0x00FF},
- {0x0100, 0x0100}, {0x0102, 0x0110}, {0x0112, 0x0112},
- {0x0114, 0x011A}, {0x011C, 0x0125}, {0x0128, 0x012A},
- {0x012C, 0x0130}, {0x0134, 0x0137}, {0x0139, 0x013E},
- {0x0143, 0x0143}, {0x0145, 0x0147}, {0x014C, 0x014C},
- {0x014E, 0x0151}, {0x0154, 0x0165}, {0x0168, 0x016A},
- {0x016C, 0x017F}, {0x0180, 0x01BA}, {0x01BB, 0x01BB},
- {0x01BC, 0x01BF}, {0x01C0, 0x01C3}, {0x01C4, 0x01CD},
- {0x01CF, 0x01CF}, {0x01D1, 0x01D1}, {0x01D3, 0x01D3},
- {0x01D5, 0x01D5}, {0x01D7, 0x01D7}, {0x01D9, 0x01D9},
- {0x01DB, 0x01DB}, {0x01DD, 0x024F}, {0x0250, 0x0250},
- {0x0252, 0x0260}, {0x0262, 0x0293}, {0x0294, 0x0294},
- {0x0295, 0x02AF}, {0x02B0, 0x02C1}, {0x02C2, 0x02C3},
- {0x02C5, 0x02C5}, {0x02C6, 0x02C6}, {0x02C8, 0x02C8},
- {0x02CC, 0x02CC}, {0x02CE, 0x02CF}, {0x02D1, 0x02D1},
- {0x02D2, 0x02D7}, {0x02DC, 0x02DC}, {0x02DE, 0x02DE},
- {0x02E0, 0x02E4}, {0x02E5, 0x02EB}, {0x02EC, 0x02EC},
- {0x02ED, 0x02ED}, {0x02EE, 0x02EE}, {0x02EF, 0x02FF},
- {0x0370, 0x0373}, {0x0374, 0x0374}, {0x0375, 0x0375},
- {0x0376, 0x0377}, {0x037A, 0x037A}, {0x037B, 0x037D},
- {0x037E, 0x037E}, {0x037F, 0x037F}, {0x0384, 0x0385},
- {0x0386, 0x0386}, {0x0387, 0x0387}, {0x0388, 0x038A},
- {0x038C, 0x038C}, {0x038E, 0x0390}, {0x03AA, 0x03B0},
- {0x03C2, 0x03C2}, {0x03CA, 0x03F5}, {0x03F6, 0x03F6},
- {0x03F7, 0x03FF}, {0x0400, 0x0400}, {0x0402, 0x040F},
- {0x0450, 0x0450}, {0x0452, 0x0481}, {0x0482, 0x0482},
- {0x0483, 0x0487}, {0x0488, 0x0489}, {0x048A, 0x04FF},
- {0x0500, 0x052F}, {0x0531, 0x0556}, {0x0559, 0x0559},
- {0x055A, 0x055F}, {0x0561, 0x0587}, {0x0589, 0x0589},
- {0x058A, 0x058A}, {0x058D, 0x058E}, {0x058F, 0x058F},
- {0x0591, 0x05BD}, {0x05BE, 0x05BE}, {0x05BF, 0x05BF},
- {0x05C0, 0x05C0}, {0x05C1, 0x05C2}, {0x05C3, 0x05C3},
- {0x05C4, 0x05C5}, {0x05C6, 0x05C6}, {0x05C7, 0x05C7},
- {0x05D0, 0x05EA}, {0x05F0, 0x05F2}, {0x05F3, 0x05F4},
- {0x0600, 0x0605}, {0x0606, 0x0608}, {0x0609, 0x060A},
- {0x060B, 0x060B}, {0x060C, 0x060D}, {0x060E, 0x060F},
- {0x0610, 0x061A}, {0x061B, 0x061B}, {0x061C, 0x061C},
- {0x061E, 0x061F}, {0x0620, 0x063F}, {0x0640, 0x0640},
- {0x0641, 0x064A}, {0x064B, 0x065F}, {0x0660, 0x0669},
- {0x066A, 0x066D}, {0x066E, 0x066F}, {0x0670, 0x0670},
- {0x0671, 0x06D3}, {0x06D4, 0x06D4}, {0x06D5, 0x06D5},
- {0x06D6, 0x06DC}, {0x06DD, 0x06DD}, {0x06DE, 0x06DE},
- {0x06DF, 0x06E4}, {0x06E5, 0x06E6}, {0x06E7, 0x06E8},
- {0x06E9, 0x06E9}, {0x06EA, 0x06ED}, {0x06EE, 0x06EF},
- {0x06F0, 0x06F9}, {0x06FA, 0x06FC}, {0x06FD, 0x06FE},
- {0x06FF, 0x06FF}, {0x0700, 0x070D}, {0x070F, 0x070F},
- {0x0710, 0x0710}, {0x0711, 0x0711}, {0x0712, 0x072F},
- {0x0730, 0x074A}, {0x074D, 0x074F}, {0x0750, 0x077F},
- {0x0780, 0x07A5}, {0x07A6, 0x07B0}, {0x07B1, 0x07B1},
- {0x07C0, 0x07C9}, {0x07CA, 0x07EA}, {0x07EB, 0x07F3},
- {0x07F4, 0x07F5}, {0x07F6, 0x07F6}, {0x07F7, 0x07F9},
- {0x07FA, 0x07FA}, {0x0800, 0x0815}, {0x0816, 0x0819},
- {0x081A, 0x081A}, {0x081B, 0x0823}, {0x0824, 0x0824},
- {0x0825, 0x0827}, {0x0828, 0x0828}, {0x0829, 0x082D},
- {0x0830, 0x083E}, {0x0840, 0x0858}, {0x0859, 0x085B},
- {0x085E, 0x085E}, {0x08A0, 0x08B4}, {0x08B6, 0x08BD},
- {0x08D4, 0x08E1}, {0x08E2, 0x08E2}, {0x08E3, 0x08FF},
- {0x0900, 0x0902}, {0x0903, 0x0903}, {0x0904, 0x0939},
- {0x093A, 0x093A}, {0x093B, 0x093B}, {0x093C, 0x093C},
- {0x093D, 0x093D}, {0x093E, 0x0940}, {0x0941, 0x0948},
- {0x0949, 0x094C}, {0x094D, 0x094D}, {0x094E, 0x094F},
- {0x0950, 0x0950}, {0x0951, 0x0957}, {0x0958, 0x0961},
- {0x0962, 0x0963}, {0x0964, 0x0965}, {0x0966, 0x096F},
- {0x0970, 0x0970}, {0x0971, 0x0971}, {0x0972, 0x097F},
- {0x0980, 0x0980}, {0x0981, 0x0981}, {0x0982, 0x0983},
- {0x0985, 0x098C}, {0x098F, 0x0990}, {0x0993, 0x09A8},
- {0x09AA, 0x09B0}, {0x09B2, 0x09B2}, {0x09B6, 0x09B9},
- {0x09BC, 0x09BC}, {0x09BD, 0x09BD}, {0x09BE, 0x09C0},
- {0x09C1, 0x09C4}, {0x09C7, 0x09C8}, {0x09CB, 0x09CC},
- {0x09CD, 0x09CD}, {0x09CE, 0x09CE}, {0x09D7, 0x09D7},
- {0x09DC, 0x09DD}, {0x09DF, 0x09E1}, {0x09E2, 0x09E3},
- {0x09E6, 0x09EF}, {0x09F0, 0x09F1}, {0x09F2, 0x09F3},
- {0x09F4, 0x09F9}, {0x09FA, 0x09FA}, {0x09FB, 0x09FB},
- {0x0A01, 0x0A02}, {0x0A03, 0x0A03}, {0x0A05, 0x0A0A},
- {0x0A0F, 0x0A10}, {0x0A13, 0x0A28}, {0x0A2A, 0x0A30},
- {0x0A32, 0x0A33}, {0x0A35, 0x0A36}, {0x0A38, 0x0A39},
- {0x0A3C, 0x0A3C}, {0x0A3E, 0x0A40}, {0x0A41, 0x0A42},
- {0x0A47, 0x0A48}, {0x0A4B, 0x0A4D}, {0x0A51, 0x0A51},
- {0x0A59, 0x0A5C}, {0x0A5E, 0x0A5E}, {0x0A66, 0x0A6F},
- {0x0A70, 0x0A71}, {0x0A72, 0x0A74}, {0x0A75, 0x0A75},
- {0x0A81, 0x0A82}, {0x0A83, 0x0A83}, {0x0A85, 0x0A8D},
- {0x0A8F, 0x0A91}, {0x0A93, 0x0AA8}, {0x0AAA, 0x0AB0},
- {0x0AB2, 0x0AB3}, {0x0AB5, 0x0AB9}, {0x0ABC, 0x0ABC},
- {0x0ABD, 0x0ABD}, {0x0ABE, 0x0AC0}, {0x0AC1, 0x0AC5},
- {0x0AC7, 0x0AC8}, {0x0AC9, 0x0AC9}, {0x0ACB, 0x0ACC},
- {0x0ACD, 0x0ACD}, {0x0AD0, 0x0AD0}, {0x0AE0, 0x0AE1},
- {0x0AE2, 0x0AE3}, {0x0AE6, 0x0AEF}, {0x0AF0, 0x0AF0},
- {0x0AF1, 0x0AF1}, {0x0AF9, 0x0AF9}, {0x0B01, 0x0B01},
- {0x0B02, 0x0B03}, {0x0B05, 0x0B0C}, {0x0B0F, 0x0B10},
- {0x0B13, 0x0B28}, {0x0B2A, 0x0B30}, {0x0B32, 0x0B33},
- {0x0B35, 0x0B39}, {0x0B3C, 0x0B3C}, {0x0B3D, 0x0B3D},
- {0x0B3E, 0x0B3E}, {0x0B3F, 0x0B3F}, {0x0B40, 0x0B40},
- {0x0B41, 0x0B44}, {0x0B47, 0x0B48}, {0x0B4B, 0x0B4C},
- {0x0B4D, 0x0B4D}, {0x0B56, 0x0B56}, {0x0B57, 0x0B57},
- {0x0B5C, 0x0B5D}, {0x0B5F, 0x0B61}, {0x0B62, 0x0B63},
- {0x0B66, 0x0B6F}, {0x0B70, 0x0B70}, {0x0B71, 0x0B71},
- {0x0B72, 0x0B77}, {0x0B82, 0x0B82}, {0x0B83, 0x0B83},
- {0x0B85, 0x0B8A}, {0x0B8E, 0x0B90}, {0x0B92, 0x0B95},
- {0x0B99, 0x0B9A}, {0x0B9C, 0x0B9C}, {0x0B9E, 0x0B9F},
- {0x0BA3, 0x0BA4}, {0x0BA8, 0x0BAA}, {0x0BAE, 0x0BB9},
- {0x0BBE, 0x0BBF}, {0x0BC0, 0x0BC0}, {0x0BC1, 0x0BC2},
- {0x0BC6, 0x0BC8}, {0x0BCA, 0x0BCC}, {0x0BCD, 0x0BCD},
- {0x0BD0, 0x0BD0}, {0x0BD7, 0x0BD7}, {0x0BE6, 0x0BEF},
- {0x0BF0, 0x0BF2}, {0x0BF3, 0x0BF8}, {0x0BF9, 0x0BF9},
- {0x0BFA, 0x0BFA}, {0x0C00, 0x0C00}, {0x0C01, 0x0C03},
- {0x0C05, 0x0C0C}, {0x0C0E, 0x0C10}, {0x0C12, 0x0C28},
- {0x0C2A, 0x0C39}, {0x0C3D, 0x0C3D}, {0x0C3E, 0x0C40},
- {0x0C41, 0x0C44}, {0x0C46, 0x0C48}, {0x0C4A, 0x0C4D},
- {0x0C55, 0x0C56}, {0x0C58, 0x0C5A}, {0x0C60, 0x0C61},
- {0x0C62, 0x0C63}, {0x0C66, 0x0C6F}, {0x0C78, 0x0C7E},
- {0x0C7F, 0x0C7F}, {0x0C80, 0x0C80}, {0x0C81, 0x0C81},
- {0x0C82, 0x0C83}, {0x0C85, 0x0C8C}, {0x0C8E, 0x0C90},
- {0x0C92, 0x0CA8}, {0x0CAA, 0x0CB3}, {0x0CB5, 0x0CB9},
- {0x0CBC, 0x0CBC}, {0x0CBD, 0x0CBD}, {0x0CBE, 0x0CBE},
- {0x0CBF, 0x0CBF}, {0x0CC0, 0x0CC4}, {0x0CC6, 0x0CC6},
- {0x0CC7, 0x0CC8}, {0x0CCA, 0x0CCB}, {0x0CCC, 0x0CCD},
- {0x0CD5, 0x0CD6}, {0x0CDE, 0x0CDE}, {0x0CE0, 0x0CE1},
- {0x0CE2, 0x0CE3}, {0x0CE6, 0x0CEF}, {0x0CF1, 0x0CF2},
- {0x0D01, 0x0D01}, {0x0D02, 0x0D03}, {0x0D05, 0x0D0C},
- {0x0D0E, 0x0D10}, {0x0D12, 0x0D3A}, {0x0D3D, 0x0D3D},
- {0x0D3E, 0x0D40}, {0x0D41, 0x0D44}, {0x0D46, 0x0D48},
- {0x0D4A, 0x0D4C}, {0x0D4D, 0x0D4D}, {0x0D4E, 0x0D4E},
- {0x0D4F, 0x0D4F}, {0x0D54, 0x0D56}, {0x0D57, 0x0D57},
- {0x0D58, 0x0D5E}, {0x0D5F, 0x0D61}, {0x0D62, 0x0D63},
- {0x0D66, 0x0D6F}, {0x0D70, 0x0D78}, {0x0D79, 0x0D79},
- {0x0D7A, 0x0D7F}, {0x0D82, 0x0D83}, {0x0D85, 0x0D96},
- {0x0D9A, 0x0DB1}, {0x0DB3, 0x0DBB}, {0x0DBD, 0x0DBD},
- {0x0DC0, 0x0DC6}, {0x0DCA, 0x0DCA}, {0x0DCF, 0x0DD1},
- {0x0DD2, 0x0DD4}, {0x0DD6, 0x0DD6}, {0x0DD8, 0x0DDF},
- {0x0DE6, 0x0DEF}, {0x0DF2, 0x0DF3}, {0x0DF4, 0x0DF4},
- {0x0E01, 0x0E30}, {0x0E31, 0x0E31}, {0x0E32, 0x0E33},
- {0x0E34, 0x0E3A}, {0x0E3F, 0x0E3F}, {0x0E40, 0x0E45},
- {0x0E46, 0x0E46}, {0x0E47, 0x0E4E}, {0x0E4F, 0x0E4F},
- {0x0E50, 0x0E59}, {0x0E5A, 0x0E5B}, {0x0E81, 0x0E82},
- {0x0E84, 0x0E84}, {0x0E87, 0x0E88}, {0x0E8A, 0x0E8A},
- {0x0E8D, 0x0E8D}, {0x0E94, 0x0E97}, {0x0E99, 0x0E9F},
- {0x0EA1, 0x0EA3}, {0x0EA5, 0x0EA5}, {0x0EA7, 0x0EA7},
- {0x0EAA, 0x0EAB}, {0x0EAD, 0x0EB0}, {0x0EB1, 0x0EB1},
- {0x0EB2, 0x0EB3}, {0x0EB4, 0x0EB9}, {0x0EBB, 0x0EBC},
- {0x0EBD, 0x0EBD}, {0x0EC0, 0x0EC4}, {0x0EC6, 0x0EC6},
- {0x0EC8, 0x0ECD}, {0x0ED0, 0x0ED9}, {0x0EDC, 0x0EDF},
- {0x0F00, 0x0F00}, {0x0F01, 0x0F03}, {0x0F04, 0x0F12},
- {0x0F13, 0x0F13}, {0x0F14, 0x0F14}, {0x0F15, 0x0F17},
- {0x0F18, 0x0F19}, {0x0F1A, 0x0F1F}, {0x0F20, 0x0F29},
- {0x0F2A, 0x0F33}, {0x0F34, 0x0F34}, {0x0F35, 0x0F35},
- {0x0F36, 0x0F36}, {0x0F37, 0x0F37}, {0x0F38, 0x0F38},
- {0x0F39, 0x0F39}, {0x0F3A, 0x0F3A}, {0x0F3B, 0x0F3B},
- {0x0F3C, 0x0F3C}, {0x0F3D, 0x0F3D}, {0x0F3E, 0x0F3F},
- {0x0F40, 0x0F47}, {0x0F49, 0x0F6C}, {0x0F71, 0x0F7E},
- {0x0F7F, 0x0F7F}, {0x0F80, 0x0F84}, {0x0F85, 0x0F85},
- {0x0F86, 0x0F87}, {0x0F88, 0x0F8C}, {0x0F8D, 0x0F97},
- {0x0F99, 0x0FBC}, {0x0FBE, 0x0FC5}, {0x0FC6, 0x0FC6},
- {0x0FC7, 0x0FCC}, {0x0FCE, 0x0FCF}, {0x0FD0, 0x0FD4},
- {0x0FD5, 0x0FD8}, {0x0FD9, 0x0FDA}, {0x1000, 0x102A},
- {0x102B, 0x102C}, {0x102D, 0x1030}, {0x1031, 0x1031},
- {0x1032, 0x1037}, {0x1038, 0x1038}, {0x1039, 0x103A},
- {0x103B, 0x103C}, {0x103D, 0x103E}, {0x103F, 0x103F},
- {0x1040, 0x1049}, {0x104A, 0x104F}, {0x1050, 0x1055},
- {0x1056, 0x1057}, {0x1058, 0x1059}, {0x105A, 0x105D},
- {0x105E, 0x1060}, {0x1061, 0x1061}, {0x1062, 0x1064},
- {0x1065, 0x1066}, {0x1067, 0x106D}, {0x106E, 0x1070},
- {0x1071, 0x1074}, {0x1075, 0x1081}, {0x1082, 0x1082},
- {0x1083, 0x1084}, {0x1085, 0x1086}, {0x1087, 0x108C},
- {0x108D, 0x108D}, {0x108E, 0x108E}, {0x108F, 0x108F},
- {0x1090, 0x1099}, {0x109A, 0x109C}, {0x109D, 0x109D},
- {0x109E, 0x109F}, {0x10A0, 0x10C5}, {0x10C7, 0x10C7},
- {0x10CD, 0x10CD}, {0x10D0, 0x10FA}, {0x10FB, 0x10FB},
- {0x10FC, 0x10FC}, {0x10FD, 0x10FF}, {0x1160, 0x11FF},
- {0x1200, 0x1248}, {0x124A, 0x124D}, {0x1250, 0x1256},
- {0x1258, 0x1258}, {0x125A, 0x125D}, {0x1260, 0x1288},
- {0x128A, 0x128D}, {0x1290, 0x12B0}, {0x12B2, 0x12B5},
- {0x12B8, 0x12BE}, {0x12C0, 0x12C0}, {0x12C2, 0x12C5},
- {0x12C8, 0x12D6}, {0x12D8, 0x1310}, {0x1312, 0x1315},
- {0x1318, 0x135A}, {0x135D, 0x135F}, {0x1360, 0x1368},
- {0x1369, 0x137C}, {0x1380, 0x138F}, {0x1390, 0x1399},
- {0x13A0, 0x13F5}, {0x13F8, 0x13FD}, {0x1400, 0x1400},
- {0x1401, 0x166C}, {0x166D, 0x166E}, {0x166F, 0x167F},
- {0x1680, 0x1680}, {0x1681, 0x169A}, {0x169B, 0x169B},
- {0x169C, 0x169C}, {0x16A0, 0x16EA}, {0x16EB, 0x16ED},
- {0x16EE, 0x16F0}, {0x16F1, 0x16F8}, {0x1700, 0x170C},
- {0x170E, 0x1711}, {0x1712, 0x1714}, {0x1720, 0x1731},
- {0x1732, 0x1734}, {0x1735, 0x1736}, {0x1740, 0x1751},
- {0x1752, 0x1753}, {0x1760, 0x176C}, {0x176E, 0x1770},
- {0x1772, 0x1773}, {0x1780, 0x17B3}, {0x17B4, 0x17B5},
- {0x17B6, 0x17B6}, {0x17B7, 0x17BD}, {0x17BE, 0x17C5},
- {0x17C6, 0x17C6}, {0x17C7, 0x17C8}, {0x17C9, 0x17D3},
- {0x17D4, 0x17D6}, {0x17D7, 0x17D7}, {0x17D8, 0x17DA},
- {0x17DB, 0x17DB}, {0x17DC, 0x17DC}, {0x17DD, 0x17DD},
- {0x17E0, 0x17E9}, {0x17F0, 0x17F9}, {0x1800, 0x1805},
- {0x1806, 0x1806}, {0x1807, 0x180A}, {0x180B, 0x180D},
- {0x180E, 0x180E}, {0x1810, 0x1819}, {0x1820, 0x1842},
- {0x1843, 0x1843}, {0x1844, 0x1877}, {0x1880, 0x1884},
- {0x1885, 0x1886}, {0x1887, 0x18A8}, {0x18A9, 0x18A9},
- {0x18AA, 0x18AA}, {0x18B0, 0x18F5}, {0x1900, 0x191E},
- {0x1920, 0x1922}, {0x1923, 0x1926}, {0x1927, 0x1928},
- {0x1929, 0x192B}, {0x1930, 0x1931}, {0x1932, 0x1932},
- {0x1933, 0x1938}, {0x1939, 0x193B}, {0x1940, 0x1940},
- {0x1944, 0x1945}, {0x1946, 0x194F}, {0x1950, 0x196D},
- {0x1970, 0x1974}, {0x1980, 0x19AB}, {0x19B0, 0x19C9},
- {0x19D0, 0x19D9}, {0x19DA, 0x19DA}, {0x19DE, 0x19DF},
- {0x19E0, 0x19FF}, {0x1A00, 0x1A16}, {0x1A17, 0x1A18},
- {0x1A19, 0x1A1A}, {0x1A1B, 0x1A1B}, {0x1A1E, 0x1A1F},
- {0x1A20, 0x1A54}, {0x1A55, 0x1A55}, {0x1A56, 0x1A56},
- {0x1A57, 0x1A57}, {0x1A58, 0x1A5E}, {0x1A60, 0x1A60},
- {0x1A61, 0x1A61}, {0x1A62, 0x1A62}, {0x1A63, 0x1A64},
- {0x1A65, 0x1A6C}, {0x1A6D, 0x1A72}, {0x1A73, 0x1A7C},
- {0x1A7F, 0x1A7F}, {0x1A80, 0x1A89}, {0x1A90, 0x1A99},
- {0x1AA0, 0x1AA6}, {0x1AA7, 0x1AA7}, {0x1AA8, 0x1AAD},
- {0x1AB0, 0x1ABD}, {0x1ABE, 0x1ABE}, {0x1B00, 0x1B03},
- {0x1B04, 0x1B04}, {0x1B05, 0x1B33}, {0x1B34, 0x1B34},
- {0x1B35, 0x1B35}, {0x1B36, 0x1B3A}, {0x1B3B, 0x1B3B},
- {0x1B3C, 0x1B3C}, {0x1B3D, 0x1B41}, {0x1B42, 0x1B42},
- {0x1B43, 0x1B44}, {0x1B45, 0x1B4B}, {0x1B50, 0x1B59},
- {0x1B5A, 0x1B60}, {0x1B61, 0x1B6A}, {0x1B6B, 0x1B73},
- {0x1B74, 0x1B7C}, {0x1B80, 0x1B81}, {0x1B82, 0x1B82},
- {0x1B83, 0x1BA0}, {0x1BA1, 0x1BA1}, {0x1BA2, 0x1BA5},
- {0x1BA6, 0x1BA7}, {0x1BA8, 0x1BA9}, {0x1BAA, 0x1BAA},
- {0x1BAB, 0x1BAD}, {0x1BAE, 0x1BAF}, {0x1BB0, 0x1BB9},
- {0x1BBA, 0x1BBF}, {0x1BC0, 0x1BE5}, {0x1BE6, 0x1BE6},
- {0x1BE7, 0x1BE7}, {0x1BE8, 0x1BE9}, {0x1BEA, 0x1BEC},
- {0x1BED, 0x1BED}, {0x1BEE, 0x1BEE}, {0x1BEF, 0x1BF1},
- {0x1BF2, 0x1BF3}, {0x1BFC, 0x1BFF}, {0x1C00, 0x1C23},
- {0x1C24, 0x1C2B}, {0x1C2C, 0x1C33}, {0x1C34, 0x1C35},
- {0x1C36, 0x1C37}, {0x1C3B, 0x1C3F}, {0x1C40, 0x1C49},
- {0x1C4D, 0x1C4F}, {0x1C50, 0x1C59}, {0x1C5A, 0x1C77},
- {0x1C78, 0x1C7D}, {0x1C7E, 0x1C7F}, {0x1C80, 0x1C88},
- {0x1CC0, 0x1CC7}, {0x1CD0, 0x1CD2}, {0x1CD3, 0x1CD3},
- {0x1CD4, 0x1CE0}, {0x1CE1, 0x1CE1}, {0x1CE2, 0x1CE8},
- {0x1CE9, 0x1CEC}, {0x1CED, 0x1CED}, {0x1CEE, 0x1CF1},
- {0x1CF2, 0x1CF3}, {0x1CF4, 0x1CF4}, {0x1CF5, 0x1CF6},
- {0x1CF8, 0x1CF9}, {0x1D00, 0x1D2B}, {0x1D2C, 0x1D6A},
- {0x1D6B, 0x1D77}, {0x1D78, 0x1D78}, {0x1D79, 0x1D7F},
- {0x1D80, 0x1D9A}, {0x1D9B, 0x1DBF}, {0x1DC0, 0x1DF5},
- {0x1DFB, 0x1DFF}, {0x1E00, 0x1EFF}, {0x1F00, 0x1F15},
- {0x1F18, 0x1F1D}, {0x1F20, 0x1F45}, {0x1F48, 0x1F4D},
- {0x1F50, 0x1F57}, {0x1F59, 0x1F59}, {0x1F5B, 0x1F5B},
- {0x1F5D, 0x1F5D}, {0x1F5F, 0x1F7D}, {0x1F80, 0x1FB4},
- {0x1FB6, 0x1FBC}, {0x1FBD, 0x1FBD}, {0x1FBE, 0x1FBE},
- {0x1FBF, 0x1FC1}, {0x1FC2, 0x1FC4}, {0x1FC6, 0x1FCC},
- {0x1FCD, 0x1FCF}, {0x1FD0, 0x1FD3}, {0x1FD6, 0x1FDB},
- {0x1FDD, 0x1FDF}, {0x1FE0, 0x1FEC}, {0x1FED, 0x1FEF},
- {0x1FF2, 0x1FF4}, {0x1FF6, 0x1FFC}, {0x1FFD, 0x1FFE},
- {0x2000, 0x200A}, {0x200B, 0x200F}, {0x2011, 0x2012},
- {0x2017, 0x2017}, {0x201A, 0x201A}, {0x201B, 0x201B},
- {0x201E, 0x201E}, {0x201F, 0x201F}, {0x2023, 0x2023},
- {0x2028, 0x2028}, {0x2029, 0x2029}, {0x202A, 0x202E},
- {0x202F, 0x202F}, {0x2031, 0x2031}, {0x2034, 0x2034},
- {0x2036, 0x2038}, {0x2039, 0x2039}, {0x203A, 0x203A},
- {0x203C, 0x203D}, {0x203F, 0x2040}, {0x2041, 0x2043},
- {0x2044, 0x2044}, {0x2045, 0x2045}, {0x2046, 0x2046},
- {0x2047, 0x2051}, {0x2052, 0x2052}, {0x2053, 0x2053},
- {0x2054, 0x2054}, {0x2055, 0x205E}, {0x205F, 0x205F},
- {0x2060, 0x2064}, {0x2066, 0x206F}, {0x2070, 0x2070},
- {0x2071, 0x2071}, {0x2075, 0x2079}, {0x207A, 0x207C},
- {0x207D, 0x207D}, {0x207E, 0x207E}, {0x2080, 0x2080},
- {0x2085, 0x2089}, {0x208A, 0x208C}, {0x208D, 0x208D},
- {0x208E, 0x208E}, {0x2090, 0x209C}, {0x20A0, 0x20A8},
- {0x20AA, 0x20AB}, {0x20AD, 0x20BE}, {0x20D0, 0x20DC},
- {0x20DD, 0x20E0}, {0x20E1, 0x20E1}, {0x20E2, 0x20E4},
- {0x20E5, 0x20F0}, {0x2100, 0x2101}, {0x2102, 0x2102},
- {0x2104, 0x2104}, {0x2106, 0x2106}, {0x2107, 0x2107},
- {0x2108, 0x2108}, {0x210A, 0x2112}, {0x2114, 0x2114},
- {0x2115, 0x2115}, {0x2117, 0x2117}, {0x2118, 0x2118},
- {0x2119, 0x211D}, {0x211E, 0x2120}, {0x2123, 0x2123},
- {0x2124, 0x2124}, {0x2125, 0x2125}, {0x2127, 0x2127},
- {0x2128, 0x2128}, {0x2129, 0x2129}, {0x212A, 0x212A},
- {0x212C, 0x212D}, {0x212E, 0x212E}, {0x212F, 0x2134},
- {0x2135, 0x2138}, {0x2139, 0x2139}, {0x213A, 0x213B},
- {0x213C, 0x213F}, {0x2140, 0x2144}, {0x2145, 0x2149},
- {0x214A, 0x214A}, {0x214B, 0x214B}, {0x214C, 0x214D},
- {0x214E, 0x214E}, {0x214F, 0x214F}, {0x2150, 0x2152},
- {0x2155, 0x215A}, {0x215F, 0x215F}, {0x216C, 0x216F},
- {0x217A, 0x2182}, {0x2183, 0x2184}, {0x2185, 0x2188},
- {0x218A, 0x218B}, {0x219A, 0x219B}, {0x219C, 0x219F},
- {0x21A0, 0x21A0}, {0x21A1, 0x21A2}, {0x21A3, 0x21A3},
- {0x21A4, 0x21A5}, {0x21A6, 0x21A6}, {0x21A7, 0x21AD},
- {0x21AE, 0x21AE}, {0x21AF, 0x21B7}, {0x21BA, 0x21CD},
- {0x21CE, 0x21CF}, {0x21D0, 0x21D1}, {0x21D3, 0x21D3},
- {0x21D5, 0x21E6}, {0x21E8, 0x21F3}, {0x21F4, 0x21FF},
- {0x2201, 0x2201}, {0x2204, 0x2206}, {0x2209, 0x220A},
- {0x220C, 0x220E}, {0x2210, 0x2210}, {0x2212, 0x2214},
- {0x2216, 0x2219}, {0x221B, 0x221C}, {0x2221, 0x2222},
- {0x2224, 0x2224}, {0x2226, 0x2226}, {0x222D, 0x222D},
- {0x222F, 0x2233}, {0x2238, 0x223B}, {0x223E, 0x2247},
- {0x2249, 0x224B}, {0x224D, 0x2251}, {0x2253, 0x225F},
- {0x2262, 0x2263}, {0x2268, 0x2269}, {0x226C, 0x226D},
- {0x2270, 0x2281}, {0x2284, 0x2285}, {0x2288, 0x2294},
- {0x2296, 0x2298}, {0x229A, 0x22A4}, {0x22A6, 0x22BE},
- {0x22C0, 0x22FF}, {0x2300, 0x2307}, {0x2308, 0x2308},
- {0x2309, 0x2309}, {0x230A, 0x230A}, {0x230B, 0x230B},
- {0x230C, 0x2311}, {0x2313, 0x2319}, {0x231C, 0x231F},
- {0x2320, 0x2321}, {0x2322, 0x2328}, {0x232B, 0x237B},
- {0x237C, 0x237C}, {0x237D, 0x239A}, {0x239B, 0x23B3},
- {0x23B4, 0x23DB}, {0x23DC, 0x23E1}, {0x23E2, 0x23E8},
- {0x23ED, 0x23EF}, {0x23F1, 0x23F2}, {0x23F4, 0x23FE},
- {0x2400, 0x2426}, {0x2440, 0x244A}, {0x24EA, 0x24EA},
- {0x254C, 0x254F}, {0x2574, 0x257F}, {0x2590, 0x2591},
- {0x2596, 0x259F}, {0x25A2, 0x25A2}, {0x25AA, 0x25B1},
- {0x25B4, 0x25B5}, {0x25B8, 0x25BB}, {0x25BE, 0x25BF},
- {0x25C2, 0x25C5}, {0x25C9, 0x25CA}, {0x25CC, 0x25CD},
- {0x25D2, 0x25E1}, {0x25E6, 0x25EE}, {0x25F0, 0x25F7},
- {0x25F8, 0x25FC}, {0x25FF, 0x25FF}, {0x2600, 0x2604},
- {0x2607, 0x2608}, {0x260A, 0x260D}, {0x2610, 0x2613},
- {0x2616, 0x261B}, {0x261D, 0x261D}, {0x261F, 0x263F},
- {0x2641, 0x2641}, {0x2643, 0x2647}, {0x2654, 0x265F},
- {0x2662, 0x2662}, {0x2666, 0x2666}, {0x266B, 0x266B},
- {0x266E, 0x266E}, {0x2670, 0x267E}, {0x2680, 0x2692},
- {0x2694, 0x269D}, {0x26A0, 0x26A0}, {0x26A2, 0x26A9},
- {0x26AC, 0x26BC}, {0x26C0, 0x26C3}, {0x26E2, 0x26E2},
- {0x26E4, 0x26E7}, {0x2700, 0x2704}, {0x2706, 0x2709},
- {0x270C, 0x2727}, {0x2729, 0x273C}, {0x273E, 0x274B},
- {0x274D, 0x274D}, {0x274F, 0x2752}, {0x2756, 0x2756},
- {0x2758, 0x2767}, {0x2768, 0x2768}, {0x2769, 0x2769},
- {0x276A, 0x276A}, {0x276B, 0x276B}, {0x276C, 0x276C},
- {0x276D, 0x276D}, {0x276E, 0x276E}, {0x276F, 0x276F},
- {0x2770, 0x2770}, {0x2771, 0x2771}, {0x2772, 0x2772},
- {0x2773, 0x2773}, {0x2774, 0x2774}, {0x2775, 0x2775},
- {0x2780, 0x2793}, {0x2794, 0x2794}, {0x2798, 0x27AF},
- {0x27B1, 0x27BE}, {0x27C0, 0x27C4}, {0x27C5, 0x27C5},
- {0x27C6, 0x27C6}, {0x27C7, 0x27E5}, {0x27EE, 0x27EE},
- {0x27EF, 0x27EF}, {0x27F0, 0x27FF}, {0x2800, 0x28FF},
- {0x2900, 0x297F}, {0x2980, 0x2982}, {0x2983, 0x2983},
- {0x2984, 0x2984}, {0x2987, 0x2987}, {0x2988, 0x2988},
- {0x2989, 0x2989}, {0x298A, 0x298A}, {0x298B, 0x298B},
- {0x298C, 0x298C}, {0x298D, 0x298D}, {0x298E, 0x298E},
- {0x298F, 0x298F}, {0x2990, 0x2990}, {0x2991, 0x2991},
- {0x2992, 0x2992}, {0x2993, 0x2993}, {0x2994, 0x2994},
- {0x2995, 0x2995}, {0x2996, 0x2996}, {0x2997, 0x2997},
- {0x2998, 0x2998}, {0x2999, 0x29D7}, {0x29D8, 0x29D8},
- {0x29D9, 0x29D9}, {0x29DA, 0x29DA}, {0x29DB, 0x29DB},
- {0x29DC, 0x29FB}, {0x29FC, 0x29FC}, {0x29FD, 0x29FD},
- {0x29FE, 0x29FF}, {0x2A00, 0x2AFF}, {0x2B00, 0x2B1A},
- {0x2B1D, 0x2B2F}, {0x2B30, 0x2B44}, {0x2B45, 0x2B46},
- {0x2B47, 0x2B4C}, {0x2B4D, 0x2B4F}, {0x2B51, 0x2B54},
- {0x2B5A, 0x2B73}, {0x2B76, 0x2B95}, {0x2B98, 0x2BB9},
- {0x2BBD, 0x2BC8}, {0x2BCA, 0x2BD1}, {0x2BEC, 0x2BEF},
- {0x2C00, 0x2C2E}, {0x2C30, 0x2C5E}, {0x2C60, 0x2C7B},
- {0x2C7C, 0x2C7D}, {0x2C7E, 0x2C7F}, {0x2C80, 0x2CE4},
- {0x2CE5, 0x2CEA}, {0x2CEB, 0x2CEE}, {0x2CEF, 0x2CF1},
- {0x2CF2, 0x2CF3}, {0x2CF9, 0x2CFC}, {0x2CFD, 0x2CFD},
- {0x2CFE, 0x2CFF}, {0x2D00, 0x2D25}, {0x2D27, 0x2D27},
- {0x2D2D, 0x2D2D}, {0x2D30, 0x2D67}, {0x2D6F, 0x2D6F},
- {0x2D70, 0x2D70}, {0x2D7F, 0x2D7F}, {0x2D80, 0x2D96},
- {0x2DA0, 0x2DA6}, {0x2DA8, 0x2DAE}, {0x2DB0, 0x2DB6},
- {0x2DB8, 0x2DBE}, {0x2DC0, 0x2DC6}, {0x2DC8, 0x2DCE},
- {0x2DD0, 0x2DD6}, {0x2DD8, 0x2DDE}, {0x2DE0, 0x2DFF},
- {0x2E00, 0x2E01}, {0x2E02, 0x2E02}, {0x2E03, 0x2E03},
- {0x2E04, 0x2E04}, {0x2E05, 0x2E05}, {0x2E06, 0x2E08},
- {0x2E09, 0x2E09}, {0x2E0A, 0x2E0A}, {0x2E0B, 0x2E0B},
- {0x2E0C, 0x2E0C}, {0x2E0D, 0x2E0D}, {0x2E0E, 0x2E16},
- {0x2E17, 0x2E17}, {0x2E18, 0x2E19}, {0x2E1A, 0x2E1A},
- {0x2E1B, 0x2E1B}, {0x2E1C, 0x2E1C}, {0x2E1D, 0x2E1D},
- {0x2E1E, 0x2E1F}, {0x2E20, 0x2E20}, {0x2E21, 0x2E21},
- {0x2E22, 0x2E22}, {0x2E23, 0x2E23}, {0x2E24, 0x2E24},
- {0x2E25, 0x2E25}, {0x2E26, 0x2E26}, {0x2E27, 0x2E27},
- {0x2E28, 0x2E28}, {0x2E29, 0x2E29}, {0x2E2A, 0x2E2E},
- {0x2E2F, 0x2E2F}, {0x2E30, 0x2E39}, {0x2E3A, 0x2E3B},
- {0x2E3C, 0x2E3F}, {0x2E40, 0x2E40}, {0x2E41, 0x2E41},
- {0x2E42, 0x2E42}, {0x2E43, 0x2E44}, {0x303F, 0x303F},
- {0x4DC0, 0x4DFF}, {0xA4D0, 0xA4F7}, {0xA4F8, 0xA4FD},
- {0xA4FE, 0xA4FF}, {0xA500, 0xA60B}, {0xA60C, 0xA60C},
- {0xA60D, 0xA60F}, {0xA610, 0xA61F}, {0xA620, 0xA629},
- {0xA62A, 0xA62B}, {0xA640, 0xA66D}, {0xA66E, 0xA66E},
- {0xA66F, 0xA66F}, {0xA670, 0xA672}, {0xA673, 0xA673},
- {0xA674, 0xA67D}, {0xA67E, 0xA67E}, {0xA67F, 0xA67F},
- {0xA680, 0xA69B}, {0xA69C, 0xA69D}, {0xA69E, 0xA69F},
- {0xA6A0, 0xA6E5}, {0xA6E6, 0xA6EF}, {0xA6F0, 0xA6F1},
- {0xA6F2, 0xA6F7}, {0xA700, 0xA716}, {0xA717, 0xA71F},
- {0xA720, 0xA721}, {0xA722, 0xA76F}, {0xA770, 0xA770},
- {0xA771, 0xA787}, {0xA788, 0xA788}, {0xA789, 0xA78A},
- {0xA78B, 0xA78E}, {0xA78F, 0xA78F}, {0xA790, 0xA7AE},
- {0xA7B0, 0xA7B7}, {0xA7F7, 0xA7F7}, {0xA7F8, 0xA7F9},
- {0xA7FA, 0xA7FA}, {0xA7FB, 0xA7FF}, {0xA800, 0xA801},
- {0xA802, 0xA802}, {0xA803, 0xA805}, {0xA806, 0xA806},
- {0xA807, 0xA80A}, {0xA80B, 0xA80B}, {0xA80C, 0xA822},
- {0xA823, 0xA824}, {0xA825, 0xA826}, {0xA827, 0xA827},
- {0xA828, 0xA82B}, {0xA830, 0xA835}, {0xA836, 0xA837},
- {0xA838, 0xA838}, {0xA839, 0xA839}, {0xA840, 0xA873},
- {0xA874, 0xA877}, {0xA880, 0xA881}, {0xA882, 0xA8B3},
- {0xA8B4, 0xA8C3}, {0xA8C4, 0xA8C5}, {0xA8CE, 0xA8CF},
- {0xA8D0, 0xA8D9}, {0xA8E0, 0xA8F1}, {0xA8F2, 0xA8F7},
- {0xA8F8, 0xA8FA}, {0xA8FB, 0xA8FB}, {0xA8FC, 0xA8FC},
- {0xA8FD, 0xA8FD}, {0xA900, 0xA909}, {0xA90A, 0xA925},
- {0xA926, 0xA92D}, {0xA92E, 0xA92F}, {0xA930, 0xA946},
- {0xA947, 0xA951}, {0xA952, 0xA953}, {0xA95F, 0xA95F},
- {0xA980, 0xA982}, {0xA983, 0xA983}, {0xA984, 0xA9B2},
- {0xA9B3, 0xA9B3}, {0xA9B4, 0xA9B5}, {0xA9B6, 0xA9B9},
- {0xA9BA, 0xA9BB}, {0xA9BC, 0xA9BC}, {0xA9BD, 0xA9C0},
- {0xA9C1, 0xA9CD}, {0xA9CF, 0xA9CF}, {0xA9D0, 0xA9D9},
- {0xA9DE, 0xA9DF}, {0xA9E0, 0xA9E4}, {0xA9E5, 0xA9E5},
- {0xA9E6, 0xA9E6}, {0xA9E7, 0xA9EF}, {0xA9F0, 0xA9F9},
- {0xA9FA, 0xA9FE}, {0xAA00, 0xAA28}, {0xAA29, 0xAA2E},
- {0xAA2F, 0xAA30}, {0xAA31, 0xAA32}, {0xAA33, 0xAA34},
- {0xAA35, 0xAA36}, {0xAA40, 0xAA42}, {0xAA43, 0xAA43},
- {0xAA44, 0xAA4B}, {0xAA4C, 0xAA4C}, {0xAA4D, 0xAA4D},
- {0xAA50, 0xAA59}, {0xAA5C, 0xAA5F}, {0xAA60, 0xAA6F},
- {0xAA70, 0xAA70}, {0xAA71, 0xAA76}, {0xAA77, 0xAA79},
- {0xAA7A, 0xAA7A}, {0xAA7B, 0xAA7B}, {0xAA7C, 0xAA7C},
- {0xAA7D, 0xAA7D}, {0xAA7E, 0xAA7F}, {0xAA80, 0xAAAF},
- {0xAAB0, 0xAAB0}, {0xAAB1, 0xAAB1}, {0xAAB2, 0xAAB4},
- {0xAAB5, 0xAAB6}, {0xAAB7, 0xAAB8}, {0xAAB9, 0xAABD},
- {0xAABE, 0xAABF}, {0xAAC0, 0xAAC0}, {0xAAC1, 0xAAC1},
- {0xAAC2, 0xAAC2}, {0xAADB, 0xAADC}, {0xAADD, 0xAADD},
- {0xAADE, 0xAADF}, {0xAAE0, 0xAAEA}, {0xAAEB, 0xAAEB},
- {0xAAEC, 0xAAED}, {0xAAEE, 0xAAEF}, {0xAAF0, 0xAAF1},
- {0xAAF2, 0xAAF2}, {0xAAF3, 0xAAF4}, {0xAAF5, 0xAAF5},
- {0xAAF6, 0xAAF6}, {0xAB01, 0xAB06}, {0xAB09, 0xAB0E},
- {0xAB11, 0xAB16}, {0xAB20, 0xAB26}, {0xAB28, 0xAB2E},
- {0xAB30, 0xAB5A}, {0xAB5B, 0xAB5B}, {0xAB5C, 0xAB5F},
- {0xAB60, 0xAB65}, {0xAB70, 0xABBF}, {0xABC0, 0xABE2},
- {0xABE3, 0xABE4}, {0xABE5, 0xABE5}, {0xABE6, 0xABE7},
- {0xABE8, 0xABE8}, {0xABE9, 0xABEA}, {0xABEB, 0xABEB},
- {0xABEC, 0xABEC}, {0xABED, 0xABED}, {0xABF0, 0xABF9},
- {0xD7B0, 0xD7C6}, {0xD7CB, 0xD7FB}, {0xD800, 0xDB7F},
- {0xDB80, 0xDBFF}, {0xDC00, 0xDFFF}, {0xFB00, 0xFB06},
- {0xFB13, 0xFB17}, {0xFB1D, 0xFB1D}, {0xFB1E, 0xFB1E},
- {0xFB1F, 0xFB28}, {0xFB29, 0xFB29}, {0xFB2A, 0xFB36},
- {0xFB38, 0xFB3C}, {0xFB3E, 0xFB3E}, {0xFB40, 0xFB41},
- {0xFB43, 0xFB44}, {0xFB46, 0xFB4F}, {0xFB50, 0xFBB1},
- {0xFBB2, 0xFBC1}, {0xFBD3, 0xFD3D}, {0xFD3E, 0xFD3E},
- {0xFD3F, 0xFD3F}, {0xFD50, 0xFD8F}, {0xFD92, 0xFDC7},
- {0xFDF0, 0xFDFB}, {0xFDFC, 0xFDFC}, {0xFDFD, 0xFDFD},
- {0xFE20, 0xFE2F}, {0xFE70, 0xFE74}, {0xFE76, 0xFEFC},
- {0xFEFF, 0xFEFF}, {0xFFF9, 0xFFFB}, {0xFFFC, 0xFFFC},
- {0x10000, 0x1000B}, {0x1000D, 0x10026}, {0x10028, 0x1003A},
- {0x1003C, 0x1003D}, {0x1003F, 0x1004D}, {0x10050, 0x1005D},
- {0x10080, 0x100FA}, {0x10100, 0x10102}, {0x10107, 0x10133},
- {0x10137, 0x1013F}, {0x10140, 0x10174}, {0x10175, 0x10178},
- {0x10179, 0x10189}, {0x1018A, 0x1018B}, {0x1018C, 0x1018E},
- {0x10190, 0x1019B}, {0x101A0, 0x101A0}, {0x101D0, 0x101FC},
- {0x101FD, 0x101FD}, {0x10280, 0x1029C}, {0x102A0, 0x102D0},
- {0x102E0, 0x102E0}, {0x102E1, 0x102FB}, {0x10300, 0x1031F},
- {0x10320, 0x10323}, {0x10330, 0x10340}, {0x10341, 0x10341},
- {0x10342, 0x10349}, {0x1034A, 0x1034A}, {0x10350, 0x10375},
- {0x10376, 0x1037A}, {0x10380, 0x1039D}, {0x1039F, 0x1039F},
- {0x103A0, 0x103C3}, {0x103C8, 0x103CF}, {0x103D0, 0x103D0},
- {0x103D1, 0x103D5}, {0x10400, 0x1044F}, {0x10450, 0x1047F},
- {0x10480, 0x1049D}, {0x104A0, 0x104A9}, {0x104B0, 0x104D3},
- {0x104D8, 0x104FB}, {0x10500, 0x10527}, {0x10530, 0x10563},
- {0x1056F, 0x1056F}, {0x10600, 0x10736}, {0x10740, 0x10755},
- {0x10760, 0x10767}, {0x10800, 0x10805}, {0x10808, 0x10808},
- {0x1080A, 0x10835}, {0x10837, 0x10838}, {0x1083C, 0x1083C},
- {0x1083F, 0x1083F}, {0x10840, 0x10855}, {0x10857, 0x10857},
- {0x10858, 0x1085F}, {0x10860, 0x10876}, {0x10877, 0x10878},
- {0x10879, 0x1087F}, {0x10880, 0x1089E}, {0x108A7, 0x108AF},
- {0x108E0, 0x108F2}, {0x108F4, 0x108F5}, {0x108FB, 0x108FF},
- {0x10900, 0x10915}, {0x10916, 0x1091B}, {0x1091F, 0x1091F},
- {0x10920, 0x10939}, {0x1093F, 0x1093F}, {0x10980, 0x1099F},
- {0x109A0, 0x109B7}, {0x109BC, 0x109BD}, {0x109BE, 0x109BF},
- {0x109C0, 0x109CF}, {0x109D2, 0x109FF}, {0x10A00, 0x10A00},
- {0x10A01, 0x10A03}, {0x10A05, 0x10A06}, {0x10A0C, 0x10A0F},
- {0x10A10, 0x10A13}, {0x10A15, 0x10A17}, {0x10A19, 0x10A33},
- {0x10A38, 0x10A3A}, {0x10A3F, 0x10A3F}, {0x10A40, 0x10A47},
- {0x10A50, 0x10A58}, {0x10A60, 0x10A7C}, {0x10A7D, 0x10A7E},
- {0x10A7F, 0x10A7F}, {0x10A80, 0x10A9C}, {0x10A9D, 0x10A9F},
- {0x10AC0, 0x10AC7}, {0x10AC8, 0x10AC8}, {0x10AC9, 0x10AE4},
- {0x10AE5, 0x10AE6}, {0x10AEB, 0x10AEF}, {0x10AF0, 0x10AF6},
- {0x10B00, 0x10B35}, {0x10B39, 0x10B3F}, {0x10B40, 0x10B55},
- {0x10B58, 0x10B5F}, {0x10B60, 0x10B72}, {0x10B78, 0x10B7F},
- {0x10B80, 0x10B91}, {0x10B99, 0x10B9C}, {0x10BA9, 0x10BAF},
- {0x10C00, 0x10C48}, {0x10C80, 0x10CB2}, {0x10CC0, 0x10CF2},
- {0x10CFA, 0x10CFF}, {0x10E60, 0x10E7E}, {0x11000, 0x11000},
- {0x11001, 0x11001}, {0x11002, 0x11002}, {0x11003, 0x11037},
- {0x11038, 0x11046}, {0x11047, 0x1104D}, {0x11052, 0x11065},
- {0x11066, 0x1106F}, {0x1107F, 0x1107F}, {0x11080, 0x11081},
- {0x11082, 0x11082}, {0x11083, 0x110AF}, {0x110B0, 0x110B2},
- {0x110B3, 0x110B6}, {0x110B7, 0x110B8}, {0x110B9, 0x110BA},
- {0x110BB, 0x110BC}, {0x110BD, 0x110BD}, {0x110BE, 0x110C1},
- {0x110D0, 0x110E8}, {0x110F0, 0x110F9}, {0x11100, 0x11102},
- {0x11103, 0x11126}, {0x11127, 0x1112B}, {0x1112C, 0x1112C},
- {0x1112D, 0x11134}, {0x11136, 0x1113F}, {0x11140, 0x11143},
- {0x11150, 0x11172}, {0x11173, 0x11173}, {0x11174, 0x11175},
- {0x11176, 0x11176}, {0x11180, 0x11181}, {0x11182, 0x11182},
- {0x11183, 0x111B2}, {0x111B3, 0x111B5}, {0x111B6, 0x111BE},
- {0x111BF, 0x111C0}, {0x111C1, 0x111C4}, {0x111C5, 0x111C9},
- {0x111CA, 0x111CC}, {0x111CD, 0x111CD}, {0x111D0, 0x111D9},
- {0x111DA, 0x111DA}, {0x111DB, 0x111DB}, {0x111DC, 0x111DC},
- {0x111DD, 0x111DF}, {0x111E1, 0x111F4}, {0x11200, 0x11211},
- {0x11213, 0x1122B}, {0x1122C, 0x1122E}, {0x1122F, 0x11231},
- {0x11232, 0x11233}, {0x11234, 0x11234}, {0x11235, 0x11235},
- {0x11236, 0x11237}, {0x11238, 0x1123D}, {0x1123E, 0x1123E},
- {0x11280, 0x11286}, {0x11288, 0x11288}, {0x1128A, 0x1128D},
- {0x1128F, 0x1129D}, {0x1129F, 0x112A8}, {0x112A9, 0x112A9},
- {0x112B0, 0x112DE}, {0x112DF, 0x112DF}, {0x112E0, 0x112E2},
- {0x112E3, 0x112EA}, {0x112F0, 0x112F9}, {0x11300, 0x11301},
- {0x11302, 0x11303}, {0x11305, 0x1130C}, {0x1130F, 0x11310},
- {0x11313, 0x11328}, {0x1132A, 0x11330}, {0x11332, 0x11333},
- {0x11335, 0x11339}, {0x1133C, 0x1133C}, {0x1133D, 0x1133D},
- {0x1133E, 0x1133F}, {0x11340, 0x11340}, {0x11341, 0x11344},
- {0x11347, 0x11348}, {0x1134B, 0x1134D}, {0x11350, 0x11350},
- {0x11357, 0x11357}, {0x1135D, 0x11361}, {0x11362, 0x11363},
- {0x11366, 0x1136C}, {0x11370, 0x11374}, {0x11400, 0x11434},
- {0x11435, 0x11437}, {0x11438, 0x1143F}, {0x11440, 0x11441},
- {0x11442, 0x11444}, {0x11445, 0x11445}, {0x11446, 0x11446},
- {0x11447, 0x1144A}, {0x1144B, 0x1144F}, {0x11450, 0x11459},
- {0x1145B, 0x1145B}, {0x1145D, 0x1145D}, {0x11480, 0x114AF},
- {0x114B0, 0x114B2}, {0x114B3, 0x114B8}, {0x114B9, 0x114B9},
- {0x114BA, 0x114BA}, {0x114BB, 0x114BE}, {0x114BF, 0x114C0},
- {0x114C1, 0x114C1}, {0x114C2, 0x114C3}, {0x114C4, 0x114C5},
- {0x114C6, 0x114C6}, {0x114C7, 0x114C7}, {0x114D0, 0x114D9},
- {0x11580, 0x115AE}, {0x115AF, 0x115B1}, {0x115B2, 0x115B5},
- {0x115B8, 0x115BB}, {0x115BC, 0x115BD}, {0x115BE, 0x115BE},
- {0x115BF, 0x115C0}, {0x115C1, 0x115D7}, {0x115D8, 0x115DB},
- {0x115DC, 0x115DD}, {0x11600, 0x1162F}, {0x11630, 0x11632},
- {0x11633, 0x1163A}, {0x1163B, 0x1163C}, {0x1163D, 0x1163D},
- {0x1163E, 0x1163E}, {0x1163F, 0x11640}, {0x11641, 0x11643},
- {0x11644, 0x11644}, {0x11650, 0x11659}, {0x11660, 0x1166C},
- {0x11680, 0x116AA}, {0x116AB, 0x116AB}, {0x116AC, 0x116AC},
- {0x116AD, 0x116AD}, {0x116AE, 0x116AF}, {0x116B0, 0x116B5},
- {0x116B6, 0x116B6}, {0x116B7, 0x116B7}, {0x116C0, 0x116C9},
- {0x11700, 0x11719}, {0x1171D, 0x1171F}, {0x11720, 0x11721},
- {0x11722, 0x11725}, {0x11726, 0x11726}, {0x11727, 0x1172B},
- {0x11730, 0x11739}, {0x1173A, 0x1173B}, {0x1173C, 0x1173E},
- {0x1173F, 0x1173F}, {0x118A0, 0x118DF}, {0x118E0, 0x118E9},
- {0x118EA, 0x118F2}, {0x118FF, 0x118FF}, {0x11AC0, 0x11AF8},
- {0x11C00, 0x11C08}, {0x11C0A, 0x11C2E}, {0x11C2F, 0x11C2F},
- {0x11C30, 0x11C36}, {0x11C38, 0x11C3D}, {0x11C3E, 0x11C3E},
- {0x11C3F, 0x11C3F}, {0x11C40, 0x11C40}, {0x11C41, 0x11C45},
- {0x11C50, 0x11C59}, {0x11C5A, 0x11C6C}, {0x11C70, 0x11C71},
- {0x11C72, 0x11C8F}, {0x11C92, 0x11CA7}, {0x11CA9, 0x11CA9},
- {0x11CAA, 0x11CB0}, {0x11CB1, 0x11CB1}, {0x11CB2, 0x11CB3},
- {0x11CB4, 0x11CB4}, {0x11CB5, 0x11CB6}, {0x12000, 0x12399},
- {0x12400, 0x1246E}, {0x12470, 0x12474}, {0x12480, 0x12543},
- {0x13000, 0x1342E}, {0x14400, 0x14646}, {0x16800, 0x16A38},
- {0x16A40, 0x16A5E}, {0x16A60, 0x16A69}, {0x16A6E, 0x16A6F},
- {0x16AD0, 0x16AED}, {0x16AF0, 0x16AF4}, {0x16AF5, 0x16AF5},
- {0x16B00, 0x16B2F}, {0x16B30, 0x16B36}, {0x16B37, 0x16B3B},
- {0x16B3C, 0x16B3F}, {0x16B40, 0x16B43}, {0x16B44, 0x16B44},
- {0x16B45, 0x16B45}, {0x16B50, 0x16B59}, {0x16B5B, 0x16B61},
- {0x16B63, 0x16B77}, {0x16B7D, 0x16B8F}, {0x16F00, 0x16F44},
- {0x16F50, 0x16F50}, {0x16F51, 0x16F7E}, {0x16F8F, 0x16F92},
- {0x16F93, 0x16F9F}, {0x1BC00, 0x1BC6A}, {0x1BC70, 0x1BC7C},
- {0x1BC80, 0x1BC88}, {0x1BC90, 0x1BC99}, {0x1BC9C, 0x1BC9C},
- {0x1BC9D, 0x1BC9E}, {0x1BC9F, 0x1BC9F}, {0x1BCA0, 0x1BCA3},
- {0x1D000, 0x1D0F5}, {0x1D100, 0x1D126}, {0x1D129, 0x1D164},
- {0x1D165, 0x1D166}, {0x1D167, 0x1D169}, {0x1D16A, 0x1D16C},
- {0x1D16D, 0x1D172}, {0x1D173, 0x1D17A}, {0x1D17B, 0x1D182},
- {0x1D183, 0x1D184}, {0x1D185, 0x1D18B}, {0x1D18C, 0x1D1A9},
- {0x1D1AA, 0x1D1AD}, {0x1D1AE, 0x1D1E8}, {0x1D200, 0x1D241},
- {0x1D242, 0x1D244}, {0x1D245, 0x1D245}, {0x1D300, 0x1D356},
- {0x1D360, 0x1D371}, {0x1D400, 0x1D454}, {0x1D456, 0x1D49C},
- {0x1D49E, 0x1D49F}, {0x1D4A2, 0x1D4A2}, {0x1D4A5, 0x1D4A6},
- {0x1D4A9, 0x1D4AC}, {0x1D4AE, 0x1D4B9}, {0x1D4BB, 0x1D4BB},
- {0x1D4BD, 0x1D4C3}, {0x1D4C5, 0x1D505}, {0x1D507, 0x1D50A},
- {0x1D50D, 0x1D514}, {0x1D516, 0x1D51C}, {0x1D51E, 0x1D539},
- {0x1D53B, 0x1D53E}, {0x1D540, 0x1D544}, {0x1D546, 0x1D546},
- {0x1D54A, 0x1D550}, {0x1D552, 0x1D6A5}, {0x1D6A8, 0x1D6C0},
- {0x1D6C1, 0x1D6C1}, {0x1D6C2, 0x1D6DA}, {0x1D6DB, 0x1D6DB},
- {0x1D6DC, 0x1D6FA}, {0x1D6FB, 0x1D6FB}, {0x1D6FC, 0x1D714},
- {0x1D715, 0x1D715}, {0x1D716, 0x1D734}, {0x1D735, 0x1D735},
- {0x1D736, 0x1D74E}, {0x1D74F, 0x1D74F}, {0x1D750, 0x1D76E},
- {0x1D76F, 0x1D76F}, {0x1D770, 0x1D788}, {0x1D789, 0x1D789},
- {0x1D78A, 0x1D7A8}, {0x1D7A9, 0x1D7A9}, {0x1D7AA, 0x1D7C2},
- {0x1D7C3, 0x1D7C3}, {0x1D7C4, 0x1D7CB}, {0x1D7CE, 0x1D7FF},
- {0x1D800, 0x1D9FF}, {0x1DA00, 0x1DA36}, {0x1DA37, 0x1DA3A},
- {0x1DA3B, 0x1DA6C}, {0x1DA6D, 0x1DA74}, {0x1DA75, 0x1DA75},
- {0x1DA76, 0x1DA83}, {0x1DA84, 0x1DA84}, {0x1DA85, 0x1DA86},
- {0x1DA87, 0x1DA8B}, {0x1DA9B, 0x1DA9F}, {0x1DAA1, 0x1DAAF},
- {0x1E000, 0x1E006}, {0x1E008, 0x1E018}, {0x1E01B, 0x1E021},
- {0x1E023, 0x1E024}, {0x1E026, 0x1E02A}, {0x1E800, 0x1E8C4},
- {0x1E8C7, 0x1E8CF}, {0x1E8D0, 0x1E8D6}, {0x1E900, 0x1E943},
- {0x1E944, 0x1E94A}, {0x1E950, 0x1E959}, {0x1E95E, 0x1E95F},
- {0x1EE00, 0x1EE03}, {0x1EE05, 0x1EE1F}, {0x1EE21, 0x1EE22},
- {0x1EE24, 0x1EE24}, {0x1EE27, 0x1EE27}, {0x1EE29, 0x1EE32},
- {0x1EE34, 0x1EE37}, {0x1EE39, 0x1EE39}, {0x1EE3B, 0x1EE3B},
- {0x1EE42, 0x1EE42}, {0x1EE47, 0x1EE47}, {0x1EE49, 0x1EE49},
- {0x1EE4B, 0x1EE4B}, {0x1EE4D, 0x1EE4F}, {0x1EE51, 0x1EE52},
- {0x1EE54, 0x1EE54}, {0x1EE57, 0x1EE57}, {0x1EE59, 0x1EE59},
- {0x1EE5B, 0x1EE5B}, {0x1EE5D, 0x1EE5D}, {0x1EE5F, 0x1EE5F},
- {0x1EE61, 0x1EE62}, {0x1EE64, 0x1EE64}, {0x1EE67, 0x1EE6A},
- {0x1EE6C, 0x1EE72}, {0x1EE74, 0x1EE77}, {0x1EE79, 0x1EE7C},
- {0x1EE7E, 0x1EE7E}, {0x1EE80, 0x1EE89}, {0x1EE8B, 0x1EE9B},
- {0x1EEA1, 0x1EEA3}, {0x1EEA5, 0x1EEA9}, {0x1EEAB, 0x1EEBB},
- {0x1EEF0, 0x1EEF1}, {0x1F000, 0x1F003}, {0x1F005, 0x1F02B},
- {0x1F030, 0x1F093}, {0x1F0A0, 0x1F0AE}, {0x1F0B1, 0x1F0BF},
- {0x1F0C1, 0x1F0CE}, {0x1F0D1, 0x1F0F5}, {0x1F10B, 0x1F10C},
- {0x1F12E, 0x1F12E}, {0x1F16A, 0x1F16B}, {0x1F1E6, 0x1F1FF},
- {0x1F321, 0x1F32C}, {0x1F336, 0x1F336}, {0x1F37D, 0x1F37D},
- {0x1F394, 0x1F39F}, {0x1F3CB, 0x1F3CE}, {0x1F3D4, 0x1F3DF},
- {0x1F3F1, 0x1F3F3}, {0x1F3F5, 0x1F3F7}, {0x1F43F, 0x1F43F},
- {0x1F441, 0x1F441}, {0x1F4FD, 0x1F4FE}, {0x1F53E, 0x1F54A},
- {0x1F54F, 0x1F54F}, {0x1F568, 0x1F579}, {0x1F57B, 0x1F594},
- {0x1F597, 0x1F5A3}, {0x1F5A5, 0x1F5FA}, {0x1F650, 0x1F67F},
- {0x1F6C6, 0x1F6CB}, {0x1F6CD, 0x1F6CF}, {0x1F6E0, 0x1F6EA},
- {0x1F6F0, 0x1F6F3}, {0x1F700, 0x1F773}, {0x1F780, 0x1F7D4},
- {0x1F800, 0x1F80B}, {0x1F810, 0x1F847}, {0x1F850, 0x1F859},
- {0x1F860, 0x1F887}, {0x1F890, 0x1F8AD}, {0xE0001, 0xE0001},
- {0xE0020, 0xE007F},
-}
-
-// Condition have flag EastAsianWidth whether the current locale is CJK or not.
-type Condition struct {
- EastAsianWidth bool
-}
-
-// NewCondition return new instance of Condition which is current locale.
-func NewCondition() *Condition {
- return &Condition{EastAsianWidth}
-}
-
-// RuneWidth returns the number of cells in r.
-// See http://www.unicode.org/reports/tr11/
-func (c *Condition) RuneWidth(r rune) int {
- switch {
- case r < 0 || r > 0x10FFFF ||
- inTables(r, nonprint, combining, notassigned):
- return 0
- case (c.EastAsianWidth && IsAmbiguousWidth(r)) ||
- inTables(r, doublewidth, emoji):
- return 2
- default:
- return 1
- }
-}
-
-// StringWidth return width as you can see
-func (c *Condition) StringWidth(s string) (width int) {
- for _, r := range []rune(s) {
- width += c.RuneWidth(r)
- }
- return width
-}
-
-// Truncate return string truncated with w cells
-func (c *Condition) Truncate(s string, w int, tail string) string {
- if c.StringWidth(s) <= w {
- return s
- }
- r := []rune(s)
- tw := c.StringWidth(tail)
- w -= tw
- width := 0
- i := 0
- for ; i < len(r); i++ {
- cw := c.RuneWidth(r[i])
- if width+cw > w {
- break
- }
- width += cw
- }
- return string(r[0:i]) + tail
-}
-
-// Wrap return string wrapped with w cells
-func (c *Condition) Wrap(s string, w int) string {
- width := 0
- out := ""
- for _, r := range []rune(s) {
- cw := RuneWidth(r)
- if r == '\n' {
- out += string(r)
- width = 0
- continue
- } else if width+cw > w {
- out += "\n"
- width = 0
- out += string(r)
- width += cw
- continue
- }
- out += string(r)
- width += cw
- }
- return out
-}
-
-// FillLeft return string filled in left by spaces in w cells
-func (c *Condition) FillLeft(s string, w int) string {
- width := c.StringWidth(s)
- count := w - width
- if count > 0 {
- b := make([]byte, count)
- for i := range b {
- b[i] = ' '
- }
- return string(b) + s
- }
- return s
-}
-
-// FillRight return string filled in left by spaces in w cells
-func (c *Condition) FillRight(s string, w int) string {
- width := c.StringWidth(s)
- count := w - width
- if count > 0 {
- b := make([]byte, count)
- for i := range b {
- b[i] = ' '
- }
- return s + string(b)
- }
- return s
-}
-
-// RuneWidth returns the number of cells in r.
-// See http://www.unicode.org/reports/tr11/
-func RuneWidth(r rune) int {
- return DefaultCondition.RuneWidth(r)
-}
-
-// IsAmbiguousWidth returns whether is ambiguous width or not.
-func IsAmbiguousWidth(r rune) bool {
- return inTables(r, private, ambiguous)
-}
-
-// IsNeutralWidth returns whether is neutral width or not.
-func IsNeutralWidth(r rune) bool {
- return inTable(r, neutral)
-}
-
-// StringWidth return width as you can see
-func StringWidth(s string) (width int) {
- return DefaultCondition.StringWidth(s)
-}
-
-// Truncate return string truncated with w cells
-func Truncate(s string, w int, tail string) string {
- return DefaultCondition.Truncate(s, w, tail)
-}
-
-// Wrap return string wrapped with w cells
-func Wrap(s string, w int) string {
- return DefaultCondition.Wrap(s, w)
-}
-
-// FillLeft return string filled in left by spaces in w cells
-func FillLeft(s string, w int) string {
- return DefaultCondition.FillLeft(s, w)
-}
-
-// FillRight return string filled in left by spaces in w cells
-func FillRight(s string, w int) string {
- return DefaultCondition.FillRight(s, w)
-}
diff --git a/vendor/github.com/mattn/go-runewidth/runewidth_js.go b/vendor/github.com/mattn/go-runewidth/runewidth_js.go
deleted file mode 100644
index 0ce32c5..0000000
--- a/vendor/github.com/mattn/go-runewidth/runewidth_js.go
+++ /dev/null
@@ -1,8 +0,0 @@
-// +build js
-
-package runewidth
-
-func IsEastAsian() bool {
- // TODO: Implement this for the web. Detect east asian in a compatible way, and return true.
- return false
-}
diff --git a/vendor/github.com/mattn/go-runewidth/runewidth_posix.go b/vendor/github.com/mattn/go-runewidth/runewidth_posix.go
deleted file mode 100644
index c579e9a..0000000
--- a/vendor/github.com/mattn/go-runewidth/runewidth_posix.go
+++ /dev/null
@@ -1,77 +0,0 @@
-// +build !windows,!js
-
-package runewidth
-
-import (
- "os"
- "regexp"
- "strings"
-)
-
-var reLoc = regexp.MustCompile(`^[a-z][a-z][a-z]?(?:_[A-Z][A-Z])?\.(.+)`)
-
-var mblenTable = map[string]int{
- "utf-8": 6,
- "utf8": 6,
- "jis": 8,
- "eucjp": 3,
- "euckr": 2,
- "euccn": 2,
- "sjis": 2,
- "cp932": 2,
- "cp51932": 2,
- "cp936": 2,
- "cp949": 2,
- "cp950": 2,
- "big5": 2,
- "gbk": 2,
- "gb2312": 2,
-}
-
-func isEastAsian(locale string) bool {
- charset := strings.ToLower(locale)
- r := reLoc.FindStringSubmatch(locale)
- if len(r) == 2 {
- charset = strings.ToLower(r[1])
- }
-
- if strings.HasSuffix(charset, "@cjk_narrow") {
- return false
- }
-
- for pos, b := range []byte(charset) {
- if b == '@' {
- charset = charset[:pos]
- break
- }
- }
- max := 1
- if m, ok := mblenTable[charset]; ok {
- max = m
- }
- if max > 1 && (charset[0] != 'u' ||
- strings.HasPrefix(locale, "ja") ||
- strings.HasPrefix(locale, "ko") ||
- strings.HasPrefix(locale, "zh")) {
- return true
- }
- return false
-}
-
-// IsEastAsian return true if the current locale is CJK
-func IsEastAsian() bool {
- locale := os.Getenv("LC_CTYPE")
- if locale == "" {
- locale = os.Getenv("LANG")
- }
-
- // ignore C locale
- if locale == "POSIX" || locale == "C" {
- return false
- }
- if len(locale) > 1 && locale[0] == 'C' && (locale[1] == '.' || locale[1] == '-') {
- return false
- }
-
- return isEastAsian(locale)
-}
diff --git a/vendor/github.com/mattn/go-runewidth/runewidth_test.go b/vendor/github.com/mattn/go-runewidth/runewidth_test.go
deleted file mode 100644
index b0378a1..0000000
--- a/vendor/github.com/mattn/go-runewidth/runewidth_test.go
+++ /dev/null
@@ -1,275 +0,0 @@
-package runewidth
-
-import (
- "sort"
- "testing"
-)
-
-var _ sort.Interface = (*table)(nil)
-
-func (t table) Len() int {
- return len(t)
-}
-
-func (t table) Less(i, j int) bool {
- return t[i].first < t[j].first
-}
-
-func (t *table) Swap(i, j int) {
- (*t)[i], (*t)[j] = (*t)[j], (*t)[i]
-}
-
-var tables = []table{
- private,
- nonprint,
- combining,
- doublewidth,
- ambiguous,
- emoji,
- notassigned,
- neutral,
-}
-
-func TestSorted(t *testing.T) {
- for _, tbl := range tables {
- if !sort.IsSorted(&tbl) {
- t.Errorf("not sorted")
- }
- }
-}
-
-var runewidthtests = []struct {
- in rune
- out int
- eaout int
-}{
- {'世', 2, 2},
- {'界', 2, 2},
- {'セ', 1, 1},
- {'カ', 1, 1},
- {'イ', 1, 1},
- {'☆', 1, 2}, // double width in ambiguous
- {'\x00', 0, 0},
- {'\x01', 0, 0},
- {'\u0300', 0, 0},
-}
-
-func TestRuneWidth(t *testing.T) {
- c := NewCondition()
- for _, tt := range runewidthtests {
- if out := c.RuneWidth(tt.in); out != tt.out {
- t.Errorf("RuneWidth(%q) = %d, want %d", tt.in, out, tt.out)
- }
- }
- c.EastAsianWidth = true
- for _, tt := range runewidthtests {
- if out := c.RuneWidth(tt.in); out != tt.eaout {
- t.Errorf("RuneWidth(%q) = %d, want %d", tt.in, out, tt.eaout)
- }
- }
-}
-
-var isambiguouswidthtests = []struct {
- in rune
- out bool
-}{
- {'世', false},
- {'■', true},
- {'界', false},
- {'○', true},
- {'㈱', false},
- {'①', true},
- {'②', true},
- {'③', true},
- {'④', true},
- {'⑤', true},
- {'⑥', true},
- {'⑦', true},
- {'⑧', true},
- {'⑨', true},
- {'⑩', true},
- {'⑪', true},
- {'⑫', true},
- {'⑬', true},
- {'⑭', true},
- {'⑮', true},
- {'⑯', true},
- {'⑰', true},
- {'⑱', true},
- {'⑲', true},
- {'⑳', true},
- {'☆', true},
-}
-
-func TestIsAmbiguousWidth(t *testing.T) {
- for _, tt := range isambiguouswidthtests {
- if out := IsAmbiguousWidth(tt.in); out != tt.out {
- t.Errorf("IsAmbiguousWidth(%q) = %v, want %v", tt.in, out, tt.out)
- }
- }
-}
-
-var stringwidthtests = []struct {
- in string
- out int
- eaout int
-}{
- {"■㈱の世界①", 10, 12},
- {"スター☆", 7, 8},
- {"つのだ☆HIRO", 11, 12},
-}
-
-func TestStringWidth(t *testing.T) {
- c := NewCondition()
- for _, tt := range stringwidthtests {
- if out := c.StringWidth(tt.in); out != tt.out {
- t.Errorf("StringWidth(%q) = %q, want %q", tt.in, out, tt.out)
- }
- }
- c.EastAsianWidth = true
- for _, tt := range stringwidthtests {
- if out := c.StringWidth(tt.in); out != tt.eaout {
- t.Errorf("StringWidth(%q) = %q, want %q", tt.in, out, tt.eaout)
- }
- }
-}
-
-func TestStringWidthInvalid(t *testing.T) {
- s := "こんにちわ\x00世界"
- if out := StringWidth(s); out != 14 {
- t.Errorf("StringWidth(%q) = %q, want %q", s, out, 14)
- }
-}
-
-func TestTruncateSmaller(t *testing.T) {
- s := "あいうえお"
- expected := "あいうえお"
-
- if out := Truncate(s, 10, "..."); out != expected {
- t.Errorf("Truncate(%q) = %q, want %q", s, out, expected)
- }
-}
-
-func TestTruncate(t *testing.T) {
- s := "あいうえおあいうえおえおおおおおおおおおおおおおおおおおおおおおおおおおおおおおお"
- expected := "あいうえおあいうえおえおおおおおおおおおおおおおおおおおおおおおおおおおおお..."
- out := Truncate(s, 80, "...")
- if out != expected {
- t.Errorf("Truncate(%q) = %q, want %q", s, out, expected)
- }
- width := StringWidth(out)
- if width != 79 {
- t.Errorf("width of Truncate(%q) should be %d, but %d", s, 79, width)
- }
-}
-
-func TestTruncateFit(t *testing.T) {
- s := "aあいうえおあいうえおえおおおおおおおおおおおおおおおおおおおおおおおおおおおおおお"
- expected := "aあいうえおあいうえおえおおおおおおおおおおおおおおおおおおおおおおおおおおお..."
-
- out := Truncate(s, 80, "...")
- if out != expected {
- t.Errorf("Truncate(%q) = %q, want %q", s, out, expected)
- }
- width := StringWidth(out)
- if width != 80 {
- t.Errorf("width of Truncate(%q) should be %d, but %d", s, 80, width)
- }
-}
-
-func TestTruncateJustFit(t *testing.T) {
- s := "あいうえおあいうえおえおおおおおおおおおおおおおおおおおおおおおおおおおおおおお"
- expected := "あいうえおあいうえおえおおおおおおおおおおおおおおおおおおおおおおおおおおおおお"
-
- out := Truncate(s, 80, "...")
- if out != expected {
- t.Errorf("Truncate(%q) = %q, want %q", s, out, expected)
- }
- width := StringWidth(out)
- if width != 80 {
- t.Errorf("width of Truncate(%q) should be %d, but %d", s, 80, width)
- }
-}
-
-func TestWrap(t *testing.T) {
- s := `東京特許許可局局長はよく柿喰う客だ/東京特許許可局局長はよく柿喰う客だ
-123456789012345678901234567890
-
-END`
- expected := `東京特許許可局局長はよく柿喰う
-客だ/東京特許許可局局長はよく
-柿喰う客だ
-123456789012345678901234567890
-
-END`
-
- if out := Wrap(s, 30); out != expected {
- t.Errorf("Wrap(%q) = %q, want %q", s, out, expected)
- }
-}
-
-func TestTruncateNoNeeded(t *testing.T) {
- s := "あいうえおあい"
- expected := "あいうえおあい"
-
- if out := Truncate(s, 80, "..."); out != expected {
- t.Errorf("Truncate(%q) = %q, want %q", s, out, expected)
- }
-}
-
-var isneutralwidthtests = []struct {
- in rune
- out bool
-}{
- {'→', false},
- {'┊', false},
- {'┈', false},
- {'~', false},
- {'└', false},
- {'⣀', true},
- {'⣀', true},
-}
-
-func TestIsNeutralWidth(t *testing.T) {
- for _, tt := range isneutralwidthtests {
- if out := IsNeutralWidth(tt.in); out != tt.out {
- t.Errorf("IsNeutralWidth(%q) = %v, want %v", tt.in, out, tt.out)
- }
- }
-}
-
-func TestFillLeft(t *testing.T) {
- s := "あxいうえお"
- expected := " あxいうえお"
-
- if out := FillLeft(s, 15); out != expected {
- t.Errorf("FillLeft(%q) = %q, want %q", s, out, expected)
- }
-}
-
-func TestFillLeftFit(t *testing.T) {
- s := "あいうえお"
- expected := "あいうえお"
-
- if out := FillLeft(s, 10); out != expected {
- t.Errorf("FillLeft(%q) = %q, want %q", s, out, expected)
- }
-}
-
-func TestFillRight(t *testing.T) {
- s := "あxいうえお"
- expected := "あxいうえお "
-
- if out := FillRight(s, 15); out != expected {
- t.Errorf("FillRight(%q) = %q, want %q", s, out, expected)
- }
-}
-
-func TestFillRightFit(t *testing.T) {
- s := "あいうえお"
- expected := "あいうえお"
-
- if out := FillRight(s, 10); out != expected {
- t.Errorf("FillRight(%q) = %q, want %q", s, out, expected)
- }
-}
diff --git a/vendor/github.com/mattn/go-runewidth/runewidth_windows.go b/vendor/github.com/mattn/go-runewidth/runewidth_windows.go
deleted file mode 100644
index 0258876..0000000
--- a/vendor/github.com/mattn/go-runewidth/runewidth_windows.go
+++ /dev/null
@@ -1,25 +0,0 @@
-package runewidth
-
-import (
- "syscall"
-)
-
-var (
- kernel32 = syscall.NewLazyDLL("kernel32")
- procGetConsoleOutputCP = kernel32.NewProc("GetConsoleOutputCP")
-)
-
-// IsEastAsian return true if the current locale is CJK
-func IsEastAsian() bool {
- r1, _, _ := procGetConsoleOutputCP.Call()
- if r1 == 0 {
- return false
- }
-
- switch int(r1) {
- case 932, 51932, 936, 949, 950:
- return true
- }
-
- return false
-}
diff --git a/vendor/github.com/mattn/go-sqlite3/.gitignore b/vendor/github.com/mattn/go-sqlite3/.gitignore
deleted file mode 100644
index 8a0e48d..0000000
--- a/vendor/github.com/mattn/go-sqlite3/.gitignore
+++ /dev/null
@@ -1,4 +0,0 @@
-*.db
-*.exe
-*.dll
-*.o
diff --git a/vendor/github.com/mattn/go-sqlite3/.travis.yml b/vendor/github.com/mattn/go-sqlite3/.travis.yml
deleted file mode 100644
index 46e70cb..0000000
--- a/vendor/github.com/mattn/go-sqlite3/.travis.yml
+++ /dev/null
@@ -1,19 +0,0 @@
-language: go
-sudo: required
-dist: trusty
-env:
- - GOTAGS=
- - GOTAGS=libsqlite3
- - GOTAGS=trace
- - GOTAGS=vtable
-go:
- - 1.7.x
- - 1.8.x
- - 1.9.x
- - master
-before_install:
- - go get github.com/mattn/goveralls
- - go get golang.org/x/tools/cmd/cover
-script:
- - $HOME/gopath/bin/goveralls -repotoken 3qJVUE0iQwqnCbmNcDsjYu1nh4J4KIFXx
- - go test -race -v . -tags "$GOTAGS"
diff --git a/vendor/github.com/mattn/go-sqlite3/LICENSE b/vendor/github.com/mattn/go-sqlite3/LICENSE
deleted file mode 100644
index ca458bb..0000000
--- a/vendor/github.com/mattn/go-sqlite3/LICENSE
+++ /dev/null
@@ -1,21 +0,0 @@
-The MIT License (MIT)
-
-Copyright (c) 2014 Yasuhiro Matsumoto
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all
-copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-SOFTWARE.
diff --git a/vendor/github.com/mattn/go-sqlite3/README.md b/vendor/github.com/mattn/go-sqlite3/README.md
deleted file mode 100644
index ad00f10..0000000
--- a/vendor/github.com/mattn/go-sqlite3/README.md
+++ /dev/null
@@ -1,97 +0,0 @@
-go-sqlite3
-==========
-
-[![GoDoc Reference](https://godoc.org/github.com/mattn/go-sqlite3?status.svg)](http://godoc.org/github.com/mattn/go-sqlite3)
-[![Build Status](https://travis-ci.org/mattn/go-sqlite3.svg?branch=master)](https://travis-ci.org/mattn/go-sqlite3)
-[![Coverage Status](https://coveralls.io/repos/mattn/go-sqlite3/badge.svg?branch=master)](https://coveralls.io/r/mattn/go-sqlite3?branch=master)
-[![Go Report Card](https://goreportcard.com/badge/github.com/mattn/go-sqlite3)](https://goreportcard.com/report/github.com/mattn/go-sqlite3)
-
-Description
------------
-
-sqlite3 driver conforming to the built-in database/sql interface
-
-Installation
-------------
-
-This package can be installed with the go get command:
-
- go get github.com/mattn/go-sqlite3
-
-_go-sqlite3_ is *cgo* package.
-If you want to build your app using go-sqlite3, you need gcc.
-However, if you install _go-sqlite3_ with `go install github.com/mattn/go-sqlite3`, you don't need gcc to build your app anymore.
-
-Documentation
--------------
-
-API documentation can be found here: http://godoc.org/github.com/mattn/go-sqlite3
-
-Examples can be found under the `./_example` directory
-
-FAQ
----
-
-* Want to build go-sqlite3 with libsqlite3 on my linux.
-
- Use `go build --tags "libsqlite3 linux"`
-
-* Want to build go-sqlite3 with libsqlite3 on OS X.
-
- Install sqlite3 from homebrew: `brew install sqlite3`
-
- Use `go build --tags "libsqlite3 darwin"`
-
-* Want to build go-sqlite3 with icu extension.
-
- Use `go build --tags "icu"`
-
- Available extensions: `json1`, `fts5`, `icu`
-
-* Can't build go-sqlite3 on windows 64bit.
-
- > Probably, you are using go 1.0, go1.0 has a problem when it comes to compiling/linking on windows 64bit.
- > See: [#27](https://github.com/mattn/go-sqlite3/issues/27)
-
-* Getting insert error while query is opened.
-
- > You can pass some arguments into the connection string, for example, a URI.
- > See: [#39](https://github.com/mattn/go-sqlite3/issues/39)
-
-* Do you want to cross compile? mingw on Linux or Mac?
-
- > See: [#106](https://github.com/mattn/go-sqlite3/issues/106)
- > See also: http://www.limitlessfx.com/cross-compile-golang-app-for-windows-from-linux.html
-
-* Want to get time.Time with current locale
-
- Use `_loc=auto` in SQLite3 filename schema like `file:foo.db?_loc=auto`.
-
-* Can I use this in multiple routines concurrently?
-
- Yes for readonly. But, No for writable. See [#50](https://github.com/mattn/go-sqlite3/issues/50), [#51](https://github.com/mattn/go-sqlite3/issues/51), [#209](https://github.com/mattn/go-sqlite3/issues/209).
-
-* Why is it racy if I use a `sql.Open("sqlite3", ":memory:")` database?
-
- Each connection to :memory: opens a brand new in-memory sql database, so if
- the stdlib's sql engine happens to open another connection and you've only
- specified ":memory:", that connection will see a brand new database. A
- workaround is to use "file::memory:?mode=memory&cache=shared". Every
- connection to this string will point to the same in-memory database. See
- [#204](https://github.com/mattn/go-sqlite3/issues/204) for more info.
-
-License
--------
-
-MIT: http://mattn.mit-license.org/2012
-
-sqlite3-binding.c, sqlite3-binding.h, sqlite3ext.h
-
-The -binding suffix was added to avoid build failures under gccgo.
-
-In this repository, those files are an amalgamation of code that was copied from SQLite3. The license of that code is the same as the license of SQLite3.
-
-Author
-------
-
-Yasuhiro Matsumoto (a.k.a mattn)
diff --git a/vendor/github.com/mattn/go-sqlite3/_example/custom_func/main.go b/vendor/github.com/mattn/go-sqlite3/_example/custom_func/main.go
deleted file mode 100644
index 85657e6..0000000
--- a/vendor/github.com/mattn/go-sqlite3/_example/custom_func/main.go
+++ /dev/null
@@ -1,133 +0,0 @@
-package main
-
-import (
- "database/sql"
- "fmt"
- "log"
- "math"
- "math/rand"
-
- sqlite "github.com/mattn/go-sqlite3"
-)
-
-// Computes x^y
-func pow(x, y int64) int64 {
- return int64(math.Pow(float64(x), float64(y)))
-}
-
-// Computes the bitwise exclusive-or of all its arguments
-func xor(xs ...int64) int64 {
- var ret int64
- for _, x := range xs {
- ret ^= x
- }
- return ret
-}
-
-// Returns a random number. It's actually deterministic here because
-// we don't seed the RNG, but it's an example of a non-pure function
-// from SQLite's POV.
-func getrand() int64 {
- return rand.Int63()
-}
-
-// Computes the standard deviation of a GROUPed BY set of values
-type stddev struct {
- xs []int64
- // Running average calculation
- sum int64
- n int64
-}
-
-func newStddev() *stddev { return &stddev{} }
-
-func (s *stddev) Step(x int64) {
- s.xs = append(s.xs, x)
- s.sum += x
- s.n++
-}
-
-func (s *stddev) Done() float64 {
- mean := float64(s.sum) / float64(s.n)
- var sqDiff []float64
- for _, x := range s.xs {
- sqDiff = append(sqDiff, math.Pow(float64(x)-mean, 2))
- }
- var dev float64
- for _, x := range sqDiff {
- dev += x
- }
- dev /= float64(len(sqDiff))
- return math.Sqrt(dev)
-}
-
-func main() {
- sql.Register("sqlite3_custom", &sqlite.SQLiteDriver{
- ConnectHook: func(conn *sqlite.SQLiteConn) error {
- if err := conn.RegisterFunc("pow", pow, true); err != nil {
- return err
- }
- if err := conn.RegisterFunc("xor", xor, true); err != nil {
- return err
- }
- if err := conn.RegisterFunc("rand", getrand, false); err != nil {
- return err
- }
- if err := conn.RegisterAggregator("stddev", newStddev, true); err != nil {
- return err
- }
- return nil
- },
- })
-
- db, err := sql.Open("sqlite3_custom", ":memory:")
- if err != nil {
- log.Fatal("Failed to open database:", err)
- }
- defer db.Close()
-
- var i int64
- err = db.QueryRow("SELECT pow(2,3)").Scan(&i)
- if err != nil {
- log.Fatal("POW query error:", err)
- }
- fmt.Println("pow(2,3) =", i) // 8
-
- err = db.QueryRow("SELECT xor(1,2,3,4,5,6)").Scan(&i)
- if err != nil {
- log.Fatal("XOR query error:", err)
- }
- fmt.Println("xor(1,2,3,4,5) =", i) // 7
-
- err = db.QueryRow("SELECT rand()").Scan(&i)
- if err != nil {
- log.Fatal("RAND query error:", err)
- }
- fmt.Println("rand() =", i) // pseudorandom
-
- _, err = db.Exec("create table foo (department integer, profits integer)")
- if err != nil {
- log.Fatal("Failed to create table:", err)
- }
- _, err = db.Exec("insert into foo values (1, 10), (1, 20), (1, 45), (2, 42), (2, 115)")
- if err != nil {
- log.Fatal("Failed to insert records:", err)
- }
-
- rows, err := db.Query("select department, stddev(profits) from foo group by department")
- if err != nil {
- log.Fatal("STDDEV query error:", err)
- }
- defer rows.Close()
- for rows.Next() {
- var dept int64
- var dev float64
- if err := rows.Scan(&dept, &dev); err != nil {
- log.Fatal(err)
- }
- fmt.Printf("dept=%d stddev=%f\n", dept, dev)
- }
- if err := rows.Err(); err != nil {
- log.Fatal(err)
- }
-}
diff --git a/vendor/github.com/mattn/go-sqlite3/_example/hook/hook.go b/vendor/github.com/mattn/go-sqlite3/_example/hook/hook.go
deleted file mode 100644
index 6023181..0000000
--- a/vendor/github.com/mattn/go-sqlite3/_example/hook/hook.go
+++ /dev/null
@@ -1,78 +0,0 @@
-package main
-
-import (
- "database/sql"
- "log"
- "os"
-
- "github.com/mattn/go-sqlite3"
-)
-
-func main() {
- sqlite3conn := []*sqlite3.SQLiteConn{}
- sql.Register("sqlite3_with_hook_example",
- &sqlite3.SQLiteDriver{
- ConnectHook: func(conn *sqlite3.SQLiteConn) error {
- sqlite3conn = append(sqlite3conn, conn)
- conn.RegisterUpdateHook(func(op int, db string, table string, rowid int64) {
- switch op {
- case sqlite3.SQLITE_INSERT:
- log.Println("Notified of insert on db", db, "table", table, "rowid", rowid)
- }
- })
- return nil
- },
- })
- os.Remove("./foo.db")
- os.Remove("./bar.db")
-
- srcDb, err := sql.Open("sqlite3_with_hook_example", "./foo.db")
- if err != nil {
- log.Fatal(err)
- }
- defer srcDb.Close()
- srcDb.Ping()
-
- _, err = srcDb.Exec("create table foo(id int, value text)")
- if err != nil {
- log.Fatal(err)
- }
- _, err = srcDb.Exec("insert into foo values(1, 'foo')")
- if err != nil {
- log.Fatal(err)
- }
- _, err = srcDb.Exec("insert into foo values(2, 'bar')")
- if err != nil {
- log.Fatal(err)
- }
- _, err = srcDb.Query("select * from foo")
- if err != nil {
- log.Fatal(err)
- }
- destDb, err := sql.Open("sqlite3_with_hook_example", "./bar.db")
- if err != nil {
- log.Fatal(err)
- }
- defer destDb.Close()
- destDb.Ping()
-
- bk, err := sqlite3conn[1].Backup("main", sqlite3conn[0], "main")
- if err != nil {
- log.Fatal(err)
- }
-
- _, err = bk.Step(-1)
- if err != nil {
- log.Fatal(err)
- }
- _, err = destDb.Query("select * from foo")
- if err != nil {
- log.Fatal(err)
- }
- _, err = destDb.Exec("insert into foo values(3, 'bar')")
- if err != nil {
- log.Fatal(err)
- }
-
- bk.Finish()
-}
diff --git a/vendor/github.com/mattn/go-sqlite3/_example/limit/limit.go b/vendor/github.com/mattn/go-sqlite3/_example/limit/limit.go
deleted file mode 100644
index 4e4b897..0000000
--- a/vendor/github.com/mattn/go-sqlite3/_example/limit/limit.go
+++ /dev/null
@@ -1,113 +0,0 @@
-package main
-
-import (
- "database/sql"
- "fmt"
- "log"
- "os"
- "strings"
-
- "github.com/mattn/go-sqlite3"
-)
-
-func createBulkInsertQuery(n int, start int) (query string, args []interface{}) {
- values := make([]string, n)
- args = make([]interface{}, n*2)
- pos := 0
- for i := 0; i < n; i++ {
- values[i] = "(?, ?)"
- args[pos] = start + i
- args[pos+1] = fmt.Sprintf("こんにちわ世界%03d", i)
- pos += 2
- }
- query = fmt.Sprintf(
- "insert into foo(id, name) values %s",
- strings.Join(values, ", "),
- )
- return
-}
-
-func bukInsert(db *sql.DB, query string, args []interface{}) (err error) {
- stmt, err := db.Prepare(query)
- if err != nil {
- return
- }
-
- _, err = stmt.Exec(args...)
- if err != nil {
- return
- }
-
- return
-}
-
-func main() {
- var sqlite3conn *sqlite3.SQLiteConn
- sql.Register("sqlite3_with_limit", &sqlite3.SQLiteDriver{
- ConnectHook: func(conn *sqlite3.SQLiteConn) error {
- sqlite3conn = conn
- return nil
- },
- })
-
- os.Remove("./foo.db")
- db, err := sql.Open("sqlite3_with_limit", "./foo.db")
- if err != nil {
- log.Fatal(err)
- }
- defer db.Close()
-
- sqlStmt := `
- create table foo (id integer not null primary key, name text);
- delete from foo;
- `
- _, err = db.Exec(sqlStmt)
- if err != nil {
- log.Printf("%q: %s\n", err, sqlStmt)
- return
- }
-
- if sqlite3conn == nil {
- log.Fatal("not set sqlite3 connection")
- }
-
- limitVariableNumber := sqlite3conn.GetLimit(sqlite3.SQLITE_LIMIT_VARIABLE_NUMBER)
- log.Printf("default SQLITE_LIMIT_VARIABLE_NUMBER: %d", limitVariableNumber)
-
- num := 400
- query, args := createBulkInsertQuery(num, 0)
- err = bukInsert(db, query, args)
- if err != nil {
- log.Fatal(err)
- }
-
- smallLimitVariableNumber := 100
- sqlite3conn.SetLimit(sqlite3.SQLITE_LIMIT_VARIABLE_NUMBER, smallLimitVariableNumber)
-
- limitVariableNumber = sqlite3conn.GetLimit(sqlite3.SQLITE_LIMIT_VARIABLE_NUMBER)
- log.Printf("updated SQLITE_LIMIT_VARIABLE_NUMBER: %d", limitVariableNumber)
-
- query, args = createBulkInsertQuery(num, num)
- err = bukInsert(db, query, args)
- if err != nil {
- if err != nil {
- log.Printf("expect failed since SQLITE_LIMIT_VARIABLE_NUMBER is too small: %v", err)
- }
- }
-
- bigLimitVariableNumber := 999999
- sqlite3conn.SetLimit(sqlite3.SQLITE_LIMIT_VARIABLE_NUMBER, bigLimitVariableNumber)
- limitVariableNumber = sqlite3conn.GetLimit(sqlite3.SQLITE_LIMIT_VARIABLE_NUMBER)
- log.Printf("set SQLITE_LIMIT_VARIABLE_NUMBER: %d", bigLimitVariableNumber)
- log.Printf("updated SQLITE_LIMIT_VARIABLE_NUMBER: %d", limitVariableNumber)
-
- query, args = createBulkInsertQuery(500, num+num)
- err = bukInsert(db, query, args)
- if err != nil {
- if err != nil {
- log.Fatal(err)
- }
- }
-
- log.Println("no error if SQLITE_LIMIT_VARIABLE_NUMBER > 999")
-}
diff --git a/vendor/github.com/mattn/go-sqlite3/_example/mod_regexp/Makefile b/vendor/github.com/mattn/go-sqlite3/_example/mod_regexp/Makefile
deleted file mode 100644
index 97b1e0f..0000000
--- a/vendor/github.com/mattn/go-sqlite3/_example/mod_regexp/Makefile
+++ /dev/null
@@ -1,22 +0,0 @@
-ifeq ($(OS),Windows_NT)
-EXE=extension.exe
-EXT=sqlite3_mod_regexp.dll
-RM=cmd /c del
-LDFLAG=
-else
-EXE=extension
-EXT=sqlite3_mod_regexp.so
-RM=rm
-LDFLAG=-fPIC
-endif
-
-all : $(EXE) $(EXT)
-
-$(EXE) : extension.go
- go build $<
-
-$(EXT) : sqlite3_mod_regexp.c
- gcc $(LDFLAG) -shared -o $@ $< -lsqlite3 -lpcre
-
-clean :
- @-$(RM) $(EXE) $(EXT)
diff --git a/vendor/github.com/mattn/go-sqlite3/_example/mod_regexp/extension.go b/vendor/github.com/mattn/go-sqlite3/_example/mod_regexp/extension.go
deleted file mode 100644
index 61ceb55..0000000
--- a/vendor/github.com/mattn/go-sqlite3/_example/mod_regexp/extension.go
+++ /dev/null
@@ -1,43 +0,0 @@
-package main
-
-import (
- "database/sql"
- "fmt"
- "github.com/mattn/go-sqlite3"
- "log"
-)
-
-func main() {
- sql.Register("sqlite3_with_extensions",
- &sqlite3.SQLiteDriver{
- Extensions: []string{
- "sqlite3_mod_regexp",
- },
- })
-
- db, err := sql.Open("sqlite3_with_extensions", ":memory:")
- if err != nil {
- log.Fatal(err)
- }
- defer db.Close()
-
- // Force db to make a new connection in pool
- // by putting the original in a transaction
- tx, err := db.Begin()
- if err != nil {
- log.Fatal(err)
- }
- defer tx.Commit()
-
- // New connection works (hopefully!)
- rows, err := db.Query("select 'hello world' where 'hello world' regexp '^hello.*d$'")
- if err != nil {
- log.Fatal(err)
- }
- defer rows.Close()
- for rows.Next() {
- var helloworld string
- rows.Scan(&helloworld)
- fmt.Println(helloworld)
- }
-}
diff --git a/vendor/github.com/mattn/go-sqlite3/_example/mod_regexp/sqlite3_mod_regexp.c b/vendor/github.com/mattn/go-sqlite3/_example/mod_regexp/sqlite3_mod_regexp.c
deleted file mode 100644
index 277764d..0000000
--- a/vendor/github.com/mattn/go-sqlite3/_example/mod_regexp/sqlite3_mod_regexp.c
+++ /dev/null
@@ -1,31 +0,0 @@
-#include
-#include
-#include
-#include
-
-SQLITE_EXTENSION_INIT1
-static void regexp_func(sqlite3_context *context, int argc, sqlite3_value **argv) {
- if (argc >= 2) {
- const char *target = (const char *)sqlite3_value_text(argv[1]);
- const char *pattern = (const char *)sqlite3_value_text(argv[0]);
- const char* errstr = NULL;
- int erroff = 0;
- int vec[500];
- int n, rc;
- pcre* re = pcre_compile(pattern, 0, &errstr, &erroff, NULL);
- rc = pcre_exec(re, NULL, target, strlen(target), 0, 0, vec, 500);
- if (rc <= 0) {
- sqlite3_result_error(context, errstr, 0);
- return;
- }
- sqlite3_result_int(context, 1);
- }
-}
-
-#ifdef _WIN32
-__declspec(dllexport)
-#endif
-int sqlite3_extension_init(sqlite3 *db, char **errmsg, const sqlite3_api_routines *api) {
- SQLITE_EXTENSION_INIT2(api);
- return sqlite3_create_function(db, "regexp", 2, SQLITE_UTF8, (void*)db, regexp_func, NULL, NULL);
-}
diff --git a/vendor/github.com/mattn/go-sqlite3/_example/mod_vtable/Makefile b/vendor/github.com/mattn/go-sqlite3/_example/mod_vtable/Makefile
deleted file mode 100644
index cdd4853..0000000
--- a/vendor/github.com/mattn/go-sqlite3/_example/mod_vtable/Makefile
+++ /dev/null
@@ -1,24 +0,0 @@
-ifeq ($(OS),Windows_NT)
-EXE=extension.exe
-EXT=sqlite3_mod_vtable.dll
-RM=cmd /c del
-LIBCURL=-lcurldll
-LDFLAG=
-else
-EXE=extension
-EXT=sqlite3_mod_vtable.so
-RM=rm
-LDFLAG=-fPIC
-LIBCURL=-lcurl
-endif
-
-all : $(EXE) $(EXT)
-
-$(EXE) : extension.go
- go build $<
-
-$(EXT) : sqlite3_mod_vtable.cc
- g++ $(LDFLAG) -shared -o $@ $< -lsqlite3 $(LIBCURL)
-
-clean :
- @-$(RM) $(EXE) $(EXT)
diff --git a/vendor/github.com/mattn/go-sqlite3/_example/mod_vtable/extension.go b/vendor/github.com/mattn/go-sqlite3/_example/mod_vtable/extension.go
deleted file mode 100644
index f738af6..0000000
--- a/vendor/github.com/mattn/go-sqlite3/_example/mod_vtable/extension.go
+++ /dev/null
@@ -1,37 +0,0 @@
-package main
-
-import (
- "database/sql"
- "fmt"
- "log"
-
- "github.com/mattn/go-sqlite3"
-)
-
-func main() {
- sql.Register("sqlite3_with_extensions",
- &sqlite3.SQLiteDriver{
- Extensions: []string{
- "sqlite3_mod_vtable",
- },
- })
-
- db, err := sql.Open("sqlite3_with_extensions", ":memory:")
- if err != nil {
- log.Fatal(err)
- }
- defer db.Close()
-
- db.Exec("create virtual table repo using github(id, full_name, description, html_url)")
-
- rows, err := db.Query("select id, full_name, description, html_url from repo")
- if err != nil {
- log.Fatal(err)
- }
- defer rows.Close()
- for rows.Next() {
- var id, fullName, description, htmlURL string
- rows.Scan(&id, &fullName, &description, &htmlURL)
- fmt.Printf("%s: %s\n\t%s\n\t%s\n\n", id, fullName, description, htmlURL)
- }
-}
diff --git a/vendor/github.com/mattn/go-sqlite3/_example/mod_vtable/picojson.h b/vendor/github.com/mattn/go-sqlite3/_example/mod_vtable/picojson.h
deleted file mode 100644
index 2142647..0000000
--- a/vendor/github.com/mattn/go-sqlite3/_example/mod_vtable/picojson.h
+++ /dev/null
@@ -1,1040 +0,0 @@
-/*
- * Copyright 2009-2010 Cybozu Labs, Inc.
- * Copyright 2011 Kazuho Oku
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY CYBOZU LABS, INC. ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
- * EVENT SHALL CYBOZU LABS, INC. OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * The views and conclusions contained in the software and documentation are
- * those of the authors and should not be interpreted as representing official
- * policies, either expressed or implied, of Cybozu Labs, Inc.
- *
- */
-#ifndef picojson_h
-#define picojson_h
-
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include