update vendor

This commit is contained in:
Ettore Di Giacinto
2021-10-19 22:26:36 +02:00
parent fe14d56afe
commit b9895c9e05
372 changed files with 23907 additions and 36864 deletions

31
vendor/github.com/atomicgo/cursor/.gitignore generated vendored Normal file
View File

@@ -0,0 +1,31 @@
### Go template
# Binaries for programs and plugins
*.exe
*.exe~
*.dll
*.so
*.dylib
# Test binary, built with `go test -c`
*.test
# Output of the go coverage tool, specifically when used with LiteIDE
*.out
# Dependency directories (remove the comment below to include it)
vendor/
### IntelliJ
.idea
*.iml
out
gen
### VisualStudioCode
.vscode
*.code-workspace
### macOS
# General
.DS_Store
experimenting

71
vendor/github.com/atomicgo/cursor/.golangci.yml generated vendored Normal file
View File

@@ -0,0 +1,71 @@
linters-settings:
gocritic:
enabled-tags:
- diagnostic
- experimental
- opinionated
- performance
- style
disabled-checks:
- dupImport
- ifElseChain
- octalLiteral
- whyNoLint
- wrapperFunc
- exitAfterDefer
- hugeParam
- ptrToRefParam
- paramTypeCombine
- unnamedResult
misspell:
locale: US
linters:
disable-all: true
enable:
- errcheck
- gosimple
- govet
- ineffassign
- staticcheck
- asciicheck
- bodyclose
- dupl
- durationcheck
- errorlint
- exhaustive
- gci
- gocognit
- gocritic
- godot
- godox
- goerr113
- gofmt
- goimports
- goprintffuncname
- misspell
- nilerr
- nlreturn
- noctx
- prealloc
- predeclared
- thelper
- unconvert
- unparam
- wastedassign
- wrapcheck
issues:
# Excluding configuration per-path, per-linter, per-text and per-source
exclude-rules:
- path: _test\.go
linters:
- errcheck
- dupl
- gocritic
- wrapcheck
- goerr113
# https://github.com/go-critic/go-critic/issues/926
- linters:
- gocritic
text: "unnecessaryDefer:"
service:
golangci-lint-version: 1.39.x # use the fixed version to not introduce new linters unexpectedly

0
vendor/github.com/atomicgo/cursor/CHANGELOG.md generated vendored Normal file
View File

21
vendor/github.com/atomicgo/cursor/LICENSE generated vendored Normal file
View File

@@ -0,0 +1,21 @@
MIT License
Copyright (c) 2020 Marvin Wendt (MarvinJWendt)
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.

237
vendor/github.com/atomicgo/cursor/README.md generated vendored Normal file
View File

@@ -0,0 +1,237 @@
<h1 align="center">AtomicGo | cursor</h1>
<p align="center">
<a href="https://github.com/atomicgo/cursor/releases">
<img src="https://img.shields.io/github/v/release/atomicgo/cursor?style=flat-square" alt="Latest Release">
</a>
<a href="https://codecov.io/gh/atomicgo/cursor" target="_blank">
<img src="https://img.shields.io/github/workflow/status/atomicgo/cursor/Go?label=tests&style=flat-square" alt="Tests">
</a>
<a href="https://codecov.io/gh/atomicgo/cursor" target="_blank">
<img src="https://img.shields.io/codecov/c/gh/atomicgo/cursor?color=magenta&logo=codecov&style=flat-square" alt="Coverage">
</a>
<a href="https://codecov.io/gh/atomicgo/cursor">
<!-- unittestcount:start --><img src="https://img.shields.io/badge/Unit_Tests-2-magenta?style=flat-square" alt="Unit test count"><!-- unittestcount:end -->
</a>
<a href="https://github.com/atomicgo/cursor/issues">
<img src="https://img.shields.io/github/issues/atomicgo/cursor.svg?style=flat-square" alt="Issues">
</a>
<a href="https://opensource.org/licenses/MIT" target="_blank">
<img src="https://img.shields.io/badge/License-MIT-yellow.svg?style=flat-square" alt="License: MIT">
</a>
</p>
---
<p align="center">
<strong><a href="#install">Get The Module</a></strong>
|
<strong><a href="https://pkg.go.dev/github.com/atomicgo/cursor#section-documentation" target="_blank">Documentation</a></strong>
|
<strong><a href="https://github.com/atomicgo/atomicgo/blob/main/CONTRIBUTING.md" target="_blank">Contributing</a></strong>
|
<strong><a href="https://github.com/atomicgo/atomicgo/blob/main/CODE_OF_CONDUCT.md" target="_blank">Code of Conduct</a></strong>
</p>
---
<p align="center">
<img src="https://raw.githubusercontent.com/atomicgo/atomicgo/main/assets/header.png" alt="AtomicGo">
</p>
## Description
Package cursor contains cross-platform methods to move the terminal cursor in
different directions. This package can be used to create interactive CLI tools
and games, live charts, algorithm visualizations and other updatable output of
any kind.
Special thanks to github.com/k0kubun/go-ansi which this project is based on.
## Install
```console
# Execute this command inside your project
go get -u github.com/atomicgo/cursor
```
```go
// Add this to your imports
import "github.com/atomicgo/cursor"
```
## Usage
#### func Bottom
```go
func Bottom()
```
Bottom moves the cursor to the bottom of the terminal. This is done by
calculating how many lines were moved by Up and Down.
#### func ClearLine
```go
func ClearLine()
```
ClearLine clears the current line and moves the cursor to it's start position.
#### func ClearLinesDown
```go
func ClearLinesDown(n int)
```
ClearLinesDown clears n lines downwards from the current position and moves the
cursor.
#### func ClearLinesUp
```go
func ClearLinesUp(n int)
```
ClearLinesUp clears n lines upwards from the current position and moves the
cursor.
#### func Down
```go
func Down(n int)
```
Down moves the cursor n lines down relative to the current position.
#### func DownAndClear
```go
func DownAndClear(n int)
```
DownAndClear moves the cursor down by n lines, then clears the line.
#### func Hide
```go
func Hide()
```
Hide the cursor. Don't forget to show the cursor at least at the end of your
application with Show. Otherwise the user might have a terminal with a
permanently hidden cursor, until he reopens the terminal.
#### func HorizontalAbsolute
```go
func HorizontalAbsolute(n int)
```
HorizontalAbsolute moves the cursor to n horizontally. The position n is
absolute to the start of the line.
#### func Left
```go
func Left(n int)
```
Left moves the cursor n characters to the left relative to the current position.
#### func Move
```go
func Move(x, y int)
```
Move moves the cursor relative by x and y.
#### func Right
```go
func Right(n int)
```
Right moves the cursor n characters to the right relative to the current
position.
#### func Show
```go
func Show()
```
Show the cursor if it was hidden previously. Don't forget to show the cursor at
least at the end of your application. Otherwise the user might have a terminal
with a permanently hidden cursor, until he reopens the terminal.
#### func StartOfLine
```go
func StartOfLine()
```
StartOfLine moves the cursor to the start of the current line.
#### func StartOfLineDown
```go
func StartOfLineDown(n int)
```
StartOfLineDown moves the cursor down by n lines, then moves to cursor to the
start of the line.
#### func StartOfLineUp
```go
func StartOfLineUp(n int)
```
StartOfLineUp moves the cursor up by n lines, then moves to cursor to the start
of the line.
#### func Up
```go
func Up(n int)
```
Up moves the cursor n lines up relative to the current position.
#### func UpAndClear
```go
func UpAndClear(n int)
```
UpAndClear moves the cursor up by n lines, then clears the line.
#### type Area
```go
type Area struct {
}
```
Area displays content which can be updated on the fly. You can use this to
create live output, charts, dropdowns, etc.
#### func NewArea
```go
func NewArea() Area
```
NewArea returns a new Area.
#### func (*Area) Clear
```go
func (area *Area) Clear()
```
Clear clears the content of the Area.
#### func (*Area) Update
```go
func (area *Area) Update(content string)
```
Update overwrites the content of the Area.
---
> [AtomicGo.dev](https://atomicgo.dev) &nbsp;&middot;&nbsp;
> with ❤️ by [@MarvinJWendt](https://github.com/MarvinJWendt) |
> [MarvinJWendt.com](https://marvinjwendt.com)

45
vendor/github.com/atomicgo/cursor/area.go generated vendored Normal file
View File

@@ -0,0 +1,45 @@
package cursor
import (
"fmt"
"runtime"
"strings"
)
// Area displays content which can be updated on the fly.
// You can use this to create live output, charts, dropdowns, etc.
type Area struct {
height int
}
// NewArea returns a new Area.
func NewArea() Area {
return Area{}
}
// Clear clears the content of the Area.
func (area *Area) Clear() {
Bottom()
if area.height > 0 {
ClearLinesUp(area.height)
}
}
// Update overwrites the content of the Area.
func (area *Area) Update(content string) {
area.Clear()
lines := strings.Split(content, "\n")
if runtime.GOOS == "windows" {
for _, line := range lines {
fmt.Print(line)
StartOfLineDown(1)
}
} else {
for _, line := range lines {
fmt.Println(line)
}
}
height = 0
area.height = len(lines)
}

59
vendor/github.com/atomicgo/cursor/cursor.go generated vendored Normal file
View File

@@ -0,0 +1,59 @@
// +build !windows
package cursor
import (
"fmt"
)
// Up moves the cursor n lines up relative to the current position.
func Up(n int) {
fmt.Printf("\x1b[%dA", n)
height += n
}
// Down moves the cursor n lines down relative to the current position.
func Down(n int) {
fmt.Printf("\x1b[%dB", n)
if height-n <= 0 {
height = 0
} else {
height -= n
}
}
// Right moves the cursor n characters to the right relative to the current position.
func Right(n int) {
fmt.Printf("\x1b[%dC", n)
}
// Left moves the cursor n characters to the left relative to the current position.
func Left(n int) {
fmt.Printf("\x1b[%dD", n)
}
// HorizontalAbsolute moves the cursor to n horizontally.
// The position n is absolute to the start of the line.
func HorizontalAbsolute(n int) {
n += 1 // Moves the line to the character after n
fmt.Printf("\x1b[%dG", n)
}
// Show the cursor if it was hidden previously.
// Don't forget to show the cursor at least at the end of your application.
// Otherwise the user might have a terminal with a permanently hidden cursor, until he reopens the terminal.
func Show() {
fmt.Print("\x1b[?25h")
}
// Hide the cursor.
// Don't forget to show the cursor at least at the end of your application with Show.
// Otherwise the user might have a terminal with a permanently hidden cursor, until he reopens the terminal.
func Hide() {
fmt.Print("\x1b[?25l")
}
// ClearLine clears the current line and moves the cursor to it's start position.
func ClearLine() {
fmt.Print("\x1b[2K")
}

105
vendor/github.com/atomicgo/cursor/cursor_windows.go generated vendored Normal file
View File

@@ -0,0 +1,105 @@
package cursor
import (
"os"
"syscall"
"unsafe"
)
// Up moves the cursor n lines up relative to the current position.
func Up(n int) {
move(0, -n)
height += n
}
// Down moves the cursor n lines down relative to the current position.
func Down(n int) {
move(0, n)
if height-n <= 0 {
height = 0
} else {
height -= n
}
}
// Right moves the cursor n characters to the right relative to the current position.
func Right(n int) {
move(n, 0)
}
// Left moves the cursor n characters to the left relative to the current position.
func Left(n int) {
move(-n, 0)
}
func move(x int, y int) {
handle := syscall.Handle(os.Stdout.Fd())
var csbi consoleScreenBufferInfo
_, _, _ = procGetConsoleScreenBufferInfo.Call(uintptr(handle), uintptr(unsafe.Pointer(&csbi)))
var cursor coord
cursor.x = csbi.cursorPosition.x + short(x)
cursor.y = csbi.cursorPosition.y + short(y)
_, _, _ = procSetConsoleCursorPosition.Call(uintptr(handle), uintptr(*(*int32)(unsafe.Pointer(&cursor))))
}
// HorizontalAbsolute moves the cursor to n horizontally.
// The position n is absolute to the start of the line.
func HorizontalAbsolute(n int) {
handle := syscall.Handle(os.Stdout.Fd())
var csbi consoleScreenBufferInfo
_, _, _ = procGetConsoleScreenBufferInfo.Call(uintptr(handle), uintptr(unsafe.Pointer(&csbi)))
var cursor coord
cursor.x = short(n)
cursor.y = csbi.cursorPosition.y
if csbi.size.x < cursor.x {
cursor.x = csbi.size.x
}
_, _, _ = procSetConsoleCursorPosition.Call(uintptr(handle), uintptr(*(*int32)(unsafe.Pointer(&cursor))))
}
// Show the cursor if it was hidden previously.
// Don't forget to show the cursor at least at the end of your application.
// Otherwise the user might have a terminal with a permanently hidden cursor, until he reopens the terminal.
func Show() {
handle := syscall.Handle(os.Stdout.Fd())
var cci consoleCursorInfo
_, _, _ = procGetConsoleCursorInfo.Call(uintptr(handle), uintptr(unsafe.Pointer(&cci)))
cci.visible = 1
_, _, _ = procSetConsoleCursorInfo.Call(uintptr(handle), uintptr(unsafe.Pointer(&cci)))
}
// Hide the cursor.
// Don't forget to show the cursor at least at the end of your application with Show.
// Otherwise the user might have a terminal with a permanently hidden cursor, until he reopens the terminal.
func Hide() {
handle := syscall.Handle(os.Stdout.Fd())
var cci consoleCursorInfo
_, _, _ = procGetConsoleCursorInfo.Call(uintptr(handle), uintptr(unsafe.Pointer(&cci)))
cci.visible = 0
_, _, _ = procSetConsoleCursorInfo.Call(uintptr(handle), uintptr(unsafe.Pointer(&cci)))
}
// ClearLine clears the current line and moves the cursor to it's start position.
func ClearLine() {
handle := syscall.Handle(os.Stdout.Fd())
var csbi consoleScreenBufferInfo
_, _, _ = procGetConsoleScreenBufferInfo.Call(uintptr(handle), uintptr(unsafe.Pointer(&csbi)))
var w uint32
var x short
cursor := csbi.cursorPosition
x = csbi.size.x
_, _, _ = procFillConsoleOutputCharacter.Call(uintptr(handle), uintptr(' '), uintptr(x), uintptr(*(*int32)(unsafe.Pointer(&cursor))), uintptr(unsafe.Pointer(&w)))
}

7
vendor/github.com/atomicgo/cursor/doc.go generated vendored Normal file
View File

@@ -0,0 +1,7 @@
/*
Package cursor contains cross-platform methods to move the terminal cursor in different directions.
This package can be used to create interactive CLI tools and games, live charts, algorithm visualizations and other updatable output of any kind.
Special thanks to github.com/k0kubun/go-ansi which this project is based on.
*/
package cursor

3
vendor/github.com/atomicgo/cursor/go.mod generated vendored Normal file
View File

@@ -0,0 +1,3 @@
module github.com/atomicgo/cursor
go 1.15

0
vendor/github.com/atomicgo/cursor/go.sum generated vendored Normal file
View File

43
vendor/github.com/atomicgo/cursor/syscall_windows.go generated vendored Normal file
View File

@@ -0,0 +1,43 @@
package cursor
import (
"syscall"
)
var (
kernel32 = syscall.NewLazyDLL("kernel32.dll")
procFillConsoleOutputCharacter = kernel32.NewProc("FillConsoleOutputCharacterW")
procGetConsoleCursorInfo = kernel32.NewProc("GetConsoleCursorInfo")
procGetConsoleScreenBufferInfo = kernel32.NewProc("GetConsoleScreenBufferInfo")
procSetConsoleCursorInfo = kernel32.NewProc("SetConsoleCursorInfo")
procSetConsoleCursorPosition = kernel32.NewProc("SetConsoleCursorPosition")
)
type short int16
type dword uint32
type word uint16
type coord struct {
x short
y short
}
type smallRect struct {
bottom short
left short
right short
top short
}
type consoleScreenBufferInfo struct {
size coord
cursorPosition coord
attributes word
window smallRect
maximumWindowSize coord
}
type consoleCursorInfo struct {
size dword
visible int32
}

73
vendor/github.com/atomicgo/cursor/utils.go generated vendored Normal file
View File

@@ -0,0 +1,73 @@
package cursor
var height int
// Bottom moves the cursor to the bottom of the terminal.
// This is done by calculating how many lines were moved by Up and Down.
func Bottom() {
if height > 0 {
Down(height)
StartOfLine()
height = 0
}
}
// StartOfLine moves the cursor to the start of the current line.
func StartOfLine() {
HorizontalAbsolute(0)
}
// StartOfLineDown moves the cursor down by n lines, then moves to cursor to the start of the line.
func StartOfLineDown(n int) {
Down(n)
StartOfLine()
}
// StartOfLineUp moves the cursor up by n lines, then moves to cursor to the start of the line.
func StartOfLineUp(n int) {
Up(n)
StartOfLine()
}
// UpAndClear moves the cursor up by n lines, then clears the line.
func UpAndClear(n int) {
Up(n)
ClearLine()
}
// DownAndClear moves the cursor down by n lines, then clears the line.
func DownAndClear(n int) {
Down(n)
ClearLine()
}
// Move moves the cursor relative by x and y.
func Move(x, y int) {
if x > 0 {
Right(x)
} else if x < 0 {
x *= -1
Left(x)
}
if y > 0 {
Up(y)
} else if y < 0 {
y *= -1
Down(y)
}
}
// ClearLinesUp clears n lines upwards from the current position and moves the cursor.
func ClearLinesUp(n int) {
for i := 0; i < n; i++ {
UpAndClear(1)
}
}
// ClearLinesDown clears n lines downwards from the current position and moves the cursor.
func ClearLinesDown(n int) {
for i := 0; i < n; i++ {
DownAndClear(1)
}
}