forked from toolshed/abra
chore: go mod tidy / vendor / make deps
This commit is contained in:
24
vendor/github.com/charmbracelet/x/ansi/inband.go
generated
vendored
Normal file
24
vendor/github.com/charmbracelet/x/ansi/inband.go
generated
vendored
Normal file
@ -0,0 +1,24 @@
|
||||
package ansi
|
||||
|
||||
import "fmt"
|
||||
|
||||
// InBandResize encodes an in-band terminal resize event sequence.
|
||||
//
|
||||
// CSI 48 ; height_cells ; widht_cells ; height_pixels ; width_pixels t
|
||||
//
|
||||
// See https://gist.github.com/rockorager/e695fb2924d36b2bcf1fff4a3704bd83
|
||||
func InBandResize(heightCells, widthCells, heightPixels, widthPixels int) string {
|
||||
if heightCells < 0 {
|
||||
heightCells = 0
|
||||
}
|
||||
if widthCells < 0 {
|
||||
widthCells = 0
|
||||
}
|
||||
if heightPixels < 0 {
|
||||
heightPixels = 0
|
||||
}
|
||||
if widthPixels < 0 {
|
||||
widthPixels = 0
|
||||
}
|
||||
return fmt.Sprintf("\x1b[48;%d;%d;%d;%dt", heightCells, widthCells, heightPixels, widthPixels)
|
||||
}
|
34
vendor/github.com/charmbracelet/x/ansi/palette.go
generated
vendored
Normal file
34
vendor/github.com/charmbracelet/x/ansi/palette.go
generated
vendored
Normal file
@ -0,0 +1,34 @@
|
||||
package ansi
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"image/color"
|
||||
)
|
||||
|
||||
// SetPalette sets the palette color for the given index. The index is a 16
|
||||
// color index between 0 and 15. The color is a 24-bit RGB color.
|
||||
//
|
||||
// OSC P n rrggbb BEL
|
||||
//
|
||||
// Where n is the color index in hex (0-f), and rrggbb is the color in
|
||||
// hexadecimal format (e.g., ff0000 for red).
|
||||
//
|
||||
// This sequence is specific to the Linux Console and may not work in other
|
||||
// terminal emulators.
|
||||
//
|
||||
// See https://man7.org/linux/man-pages/man4/console_codes.4.html
|
||||
func SetPalette(i int, c color.Color) string {
|
||||
if c == nil || i < 0 || i > 15 {
|
||||
return ""
|
||||
}
|
||||
r, g, b, _ := c.RGBA()
|
||||
return fmt.Sprintf("\x1b]P%x%02x%02x%02x\x07", i, r>>8, g>>8, b>>8)
|
||||
}
|
||||
|
||||
// ResetPalette resets the color palette to the default values.
|
||||
//
|
||||
// This sequence is specific to the Linux Console and may not work in other
|
||||
// terminal emulators.
|
||||
//
|
||||
// See https://man7.org/linux/man-pages/man4/console_codes.4.html
|
||||
const ResetPalette = "\x1b]R\x07"
|
49
vendor/github.com/charmbracelet/x/ansi/progress.go
generated
vendored
Normal file
49
vendor/github.com/charmbracelet/x/ansi/progress.go
generated
vendored
Normal file
@ -0,0 +1,49 @@
|
||||
package ansi
|
||||
|
||||
import "strconv"
|
||||
|
||||
// ResetProgressBar is a sequence that resets the progress bar to its default
|
||||
// state (hidden).
|
||||
//
|
||||
// OSC 9 ; 4 ; 0 BEL
|
||||
//
|
||||
// See: https://learn.microsoft.com/en-us/windows/terminal/tutorials/progress-bar-sequences
|
||||
const ResetProgressBar = "\x1b]9;4;0\x07"
|
||||
|
||||
// SetProgressBar returns a sequence for setting the progress bar to a specific
|
||||
// percentage (0-100) in the "default" state.
|
||||
//
|
||||
// OSC 9 ; 4 ; 1 Percentage BEL
|
||||
//
|
||||
// See: https://learn.microsoft.com/en-us/windows/terminal/tutorials/progress-bar-sequences
|
||||
func SetProgressBar(percentage int) string {
|
||||
return "\x1b]9;4;1;" + strconv.Itoa(min(max(0, percentage), 100)) + "\x07"
|
||||
}
|
||||
|
||||
// SetErrorProgressBar returns a sequence for setting the progress bar to a
|
||||
// specific percentage (0-100) in the "Error" state..
|
||||
//
|
||||
// OSC 9 ; 4 ; 2 Percentage BEL
|
||||
//
|
||||
// See: https://learn.microsoft.com/en-us/windows/terminal/tutorials/progress-bar-sequences
|
||||
func SetErrorProgressBar(percentage int) string {
|
||||
return "\x1b]9;4;2;" + strconv.Itoa(min(max(0, percentage), 100)) + "\x07"
|
||||
}
|
||||
|
||||
// SetIndeterminateProgressBar is a sequence that sets the progress bar to the
|
||||
// indeterminate state.
|
||||
//
|
||||
// OSC 9 ; 4 ; 3 BEL
|
||||
//
|
||||
// See: https://learn.microsoft.com/en-us/windows/terminal/tutorials/progress-bar-sequences
|
||||
const SetIndeterminateProgressBar = "\x1b]9;4;3\x07"
|
||||
|
||||
// SetWarningProgressBar is a sequence that sets the progress bar to the
|
||||
// "Warning" state.
|
||||
//
|
||||
// OSC 9 ; 4 ; 4 Percentage BEL
|
||||
//
|
||||
// See: https://learn.microsoft.com/en-us/windows/terminal/tutorials/progress-bar-sequences
|
||||
func SetWarningProgressBar(percentage int) string {
|
||||
return "\x1b]9;4;4;" + strconv.Itoa(min(max(0, percentage), 100)) + "\x07"
|
||||
}
|
6
vendor/github.com/charmbracelet/x/ansi/winop.go
generated
vendored
6
vendor/github.com/charmbracelet/x/ansi/winop.go
generated
vendored
@ -8,16 +8,22 @@ import (
|
||||
const (
|
||||
// ResizeWindowWinOp is a window operation that resizes the terminal
|
||||
// window.
|
||||
//
|
||||
// Deprecated: Use constant number directly with [WindowOp].
|
||||
ResizeWindowWinOp = 4
|
||||
|
||||
// RequestWindowSizeWinOp is a window operation that requests a report of
|
||||
// the size of the terminal window in pixels. The response is in the form:
|
||||
// CSI 4 ; height ; width t
|
||||
//
|
||||
// Deprecated: Use constant number directly with [WindowOp].
|
||||
RequestWindowSizeWinOp = 14
|
||||
|
||||
// RequestCellSizeWinOp is a window operation that requests a report of
|
||||
// the size of the terminal cell size in pixels. The response is in the form:
|
||||
// CSI 6 ; height ; width t
|
||||
//
|
||||
// Deprecated: Use constant number directly with [WindowOp].
|
||||
RequestCellSizeWinOp = 16
|
||||
)
|
||||
|
||||
|
Reference in New Issue
Block a user