diff options
author | Paul Holzinger <pholzing@redhat.com> | 2022-01-17 17:49:00 +0100 |
---|---|---|
committer | Paul Holzinger <pholzing@redhat.com> | 2022-01-18 16:27:00 +0100 |
commit | 774271c38a8c3e96c7518b3c03de2f00e87138be (patch) | |
tree | 09532ca2680778112041ebac0576d483c2452c4f /vendor/github.com/buger | |
parent | 55ad6188b067ba6594819c318dd2ae92dea2f27e (diff) | |
download | podman-774271c38a8c3e96c7518b3c03de2f00e87138be.tar.gz podman-774271c38a8c3e96c7518b3c03de2f00e87138be.tar.bz2 podman-774271c38a8c3e96c7518b3c03de2f00e87138be.zip |
upgrade all dependencies
The dependabot does not update dependencies when they do not use a tag.
This patch upgrades all untagged depenencies if possible.
You can upgrade all dependencies with `go get -u ./... && make vendor`
in theory however this failed since the k8s changes do not compile on
go v1.16 so I only updated the other dependencies.
Signed-off-by: Paul Holzinger <pholzing@redhat.com>
Diffstat (limited to 'vendor/github.com/buger')
-rw-r--r-- | vendor/github.com/buger/goterm/.gitignore | 1 | ||||
-rw-r--r-- | vendor/github.com/buger/goterm/box.go | 66 | ||||
-rw-r--r-- | vendor/github.com/buger/goterm/go.mod | 5 | ||||
-rw-r--r-- | vendor/github.com/buger/goterm/go.sum | 2 | ||||
-rw-r--r-- | vendor/github.com/buger/goterm/plot.go | 3 | ||||
-rw-r--r-- | vendor/github.com/buger/goterm/terminal.go | 10 | ||||
-rw-r--r-- | vendor/github.com/buger/goterm/terminal_nosysioctl.go | 2 | ||||
-rw-r--r-- | vendor/github.com/buger/goterm/terminal_sysioctl.go | 1 | ||||
-rw-r--r-- | vendor/github.com/buger/goterm/terminal_windows.go | 23 |
9 files changed, 100 insertions, 13 deletions
diff --git a/vendor/github.com/buger/goterm/.gitignore b/vendor/github.com/buger/goterm/.gitignore new file mode 100644 index 000000000..1377554eb --- /dev/null +++ b/vendor/github.com/buger/goterm/.gitignore @@ -0,0 +1 @@ +*.swp diff --git a/vendor/github.com/buger/goterm/box.go b/vendor/github.com/buger/goterm/box.go index 7df929d7d..4a119c552 100644 --- a/vendor/github.com/buger/goterm/box.go +++ b/vendor/github.com/buger/goterm/box.go @@ -2,7 +2,9 @@ package goterm import ( "bytes" + "regexp" "strings" + _ "unicode/utf8" ) const DEFAULT_BORDER = "- │ ┌ ┐ └ ┘" @@ -61,7 +63,9 @@ func (b *Box) Write(p []byte) (int, error) { return b.Buf.Write(p) } -// Render Box +var ANSI_RE = regexp.MustCompile(`\\0\d+\[\d+(?:;\d+)?m`) + +// String renders Box func (b *Box) String() (out string) { borders := strings.Split(b.Border, " ") lines := strings.Split(b.Buf.String(), "\n") @@ -74,7 +78,6 @@ func (b *Box) String() (out string) { // Content width without borders and padding contentWidth := b.Width - (b.PaddingX+1)*2 - for y := 0; y < b.Height; y++ { var line string @@ -99,12 +102,63 @@ func (b *Box) String() (out string) { line = "" } - if len(line) > contentWidth-1 { + r := []rune(line) + + lastAnsii := "" + withoutAnsii := []rune{} + withOffset := []rune{} + i := 0 + + for { + if i >= len(r) { + break + } + + if r[i] == 27 { + lastAnsii = "" + withOffset = append(withOffset, r[i]) + lastAnsii += string(r[i]) + i++ + for { + + i++ + if i > len(r) { + break + } + + withOffset = append(withOffset, r[i]) + lastAnsii += string(r[i]) + + if r[i] == 'm' { + i++ + break + } + } + } + + if i >= len(r) { + break + } + + withoutAnsii = append(withoutAnsii, r[i]) + + if len(withoutAnsii) <= contentWidth { + withOffset = append(withOffset, r[i]) + } + + i++ + } + + if len(withoutAnsii) > contentWidth { // If line is too large limit it - line = line[0:contentWidth] + line = string(withOffset) } else { // If line is too small enlarge it by adding spaces - line = line + strings.Repeat(" ", contentWidth-len(line)) + line += strings.Repeat(" ", contentWidth-len(withoutAnsii)) + } + + if lastAnsii != "" { + line += RESET } line = prefix + line + suffix @@ -112,7 +166,7 @@ func (b *Box) String() (out string) { // Don't add newline for last element if y != b.Height-1 { - line = line + "\n" + line += "\n" } out += line diff --git a/vendor/github.com/buger/goterm/go.mod b/vendor/github.com/buger/goterm/go.mod new file mode 100644 index 000000000..47f0e68b9 --- /dev/null +++ b/vendor/github.com/buger/goterm/go.mod @@ -0,0 +1,5 @@ +module github.com/buger/goterm + +go 1.15 + +require golang.org/x/sys v0.0.0-20210331175145-43e1dd70ce54 diff --git a/vendor/github.com/buger/goterm/go.sum b/vendor/github.com/buger/goterm/go.sum new file mode 100644 index 000000000..a9c9b7f42 --- /dev/null +++ b/vendor/github.com/buger/goterm/go.sum @@ -0,0 +1,2 @@ +golang.org/x/sys v0.0.0-20210331175145-43e1dd70ce54 h1:rF3Ohx8DRyl8h2zw9qojyLHLhrJpEMgyPOImREEryf0= +golang.org/x/sys v0.0.0-20210331175145-43e1dd70ce54/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= diff --git a/vendor/github.com/buger/goterm/plot.go b/vendor/github.com/buger/goterm/plot.go index 120147623..504358cbe 100644 --- a/vendor/github.com/buger/goterm/plot.go +++ b/vendor/github.com/buger/goterm/plot.go @@ -4,6 +4,7 @@ import ( "fmt" "math" "strings" + "unicode/utf8" ) const ( @@ -119,7 +120,7 @@ func (c *LineChart) DrawAxes(maxX, minX, maxY, minY float64, index int) { c.writeText(ff(minX), c.paddingX, 0) x_col := c.data.columns[0] - c.writeText(c.data.columns[0], c.Width/2-len(x_col)/2, 1) + c.writeText(c.data.columns[0], c.Width/2-utf8.RuneCountInString(x_col)/2, 1) if c.Flags&DRAW_INDEPENDENT != 0 || len(c.data.columns) < 3 { col := c.data.columns[index] diff --git a/vendor/github.com/buger/goterm/terminal.go b/vendor/github.com/buger/goterm/terminal.go index 7c4dfa70f..1ba6493ad 100644 --- a/vendor/github.com/buger/goterm/terminal.go +++ b/vendor/github.com/buger/goterm/terminal.go @@ -71,7 +71,7 @@ type winsize struct { // Its not recommended write to buffer dirrectly, use package Print,Printf,Println fucntions instead. var Screen *bytes.Buffer = new(bytes.Buffer) -// Get relative or absolute coordinates +// GetXY gets relative or absolute coordinates // To get relative, set PCT flag to number: // // // Get 10% of total width to `x` and 20 to y @@ -145,7 +145,7 @@ func MoveTo(str string, x int, y int) (out string) { }) } -// Return carrier to start of line +// ResetLine returns carrier to start of line func ResetLine(str string) (out string) { return applyTransform(str, func(idx int, line string) string { return fmt.Sprintf("%s%s", RESET_LINE, line) @@ -188,7 +188,7 @@ func Background(str string, color int) string { }) } -// Get console width +// Width gets console width func Width() int { ws, err := getWinsize() @@ -199,7 +199,7 @@ func Width() int { return int(ws.Col) } -// Get console height +// Height gets console height func Height() int { ws, err := getWinsize() if err != nil { @@ -208,7 +208,7 @@ func Height() int { return int(ws.Row) } -// Get current height. Line count in Screen buffer. +// CurrentHeight gets current height. Line count in Screen buffer. func CurrentHeight() int { return strings.Count(Screen.String(), "\n") } diff --git a/vendor/github.com/buger/goterm/terminal_nosysioctl.go b/vendor/github.com/buger/goterm/terminal_nosysioctl.go index 690615008..9b988ffd5 100644 --- a/vendor/github.com/buger/goterm/terminal_nosysioctl.go +++ b/vendor/github.com/buger/goterm/terminal_nosysioctl.go @@ -1,4 +1,4 @@ -// +build windows plan9 solaris +// +build plan9 solaris package goterm diff --git a/vendor/github.com/buger/goterm/terminal_sysioctl.go b/vendor/github.com/buger/goterm/terminal_sysioctl.go index 5a61cd52b..33148ede0 100644 --- a/vendor/github.com/buger/goterm/terminal_sysioctl.go +++ b/vendor/github.com/buger/goterm/terminal_sysioctl.go @@ -4,6 +4,7 @@ package goterm import ( "os" + "golang.org/x/sys/unix" ) diff --git a/vendor/github.com/buger/goterm/terminal_windows.go b/vendor/github.com/buger/goterm/terminal_windows.go new file mode 100644 index 000000000..37c56ae69 --- /dev/null +++ b/vendor/github.com/buger/goterm/terminal_windows.go @@ -0,0 +1,23 @@ +// +build windows + +package goterm + +import ( + "os" + + "golang.org/x/sys/windows" +) + +func getWinsize() (*winsize, error) { + ws := new(winsize) + fd := os.Stdout.Fd() + var info windows.ConsoleScreenBufferInfo + if err := windows.GetConsoleScreenBufferInfo(windows.Handle(fd), &info); err != nil { + return nil, err + } + + ws.Col = uint16(info.Window.Right - info.Window.Left + 1) + ws.Row = uint16(info.Window.Bottom - info.Window.Top + 1) + + return ws, nil +} |