repo
stringlengths
6
47
file_url
stringlengths
77
269
file_path
stringlengths
5
186
content
stringlengths
0
32.8k
language
stringclasses
1 value
license
stringclasses
7 values
commit_sha
stringlengths
40
40
retrieved_at
stringdate
2026-01-07 08:35:43
2026-01-07 08:55:24
truncated
bool
2 classes
jesseduffield/lazydocker
https://github.com/jesseduffield/lazydocker/blob/f4fc3669ca8eb67aa350a76503397192bf26f057/vendor/github.com/gdamore/tcell/v2/terminfo/a/aixterm/term.go
vendor/github.com/gdamore/tcell/v2/terminfo/a/aixterm/term.go
// Generated automatically. DO NOT HAND-EDIT. package aixterm import "github.com/gdamore/tcell/v2/terminfo" func init() { // IBM Aixterm Terminal Emulator terminfo.AddTerminfo(&terminfo.Terminfo{ Name: "aixterm", Columns: 80, Lines: 25, Colors: 8, Bell: "\a", Clear: "\x1b[H\x1b[J", AttrOff: "\x1b[0;10m\x1b(B", Underline: "\x1b[4m", Bold: "\x1b[1m", Reverse: "\x1b[7m", SetFg: "\x1b[3%p1%dm", SetBg: "\x1b[4%p1%dm", SetFgBg: "\x1b[3%p1%d;4%p2%dm", ResetFgBg: "\x1b[32m\x1b[40m", PadChar: "\x00", AltChars: "jjkkllmmnnqqttuuvvwwxx", EnterAcs: "\x1b(0", ExitAcs: "\x1b(B", SetCursor: "\x1b[%i%p1%d;%p2%dH", CursorBack1: "\b", CursorUp1: "\x1b[A", KeyUp: "\x1b[A", KeyDown: "\x1b[B", KeyRight: "\x1b[C", KeyLeft: "\x1b[D", KeyInsert: "\x1b[139q", KeyDelete: "\x1b[P", KeyBackspace: "\b", KeyHome: "\x1b[H", KeyEnd: "\x1b[146q", KeyPgUp: "\x1b[150q", KeyPgDn: "\x1b[154q", KeyF1: "\x1b[001q", KeyF2: "\x1b[002q", KeyF3: "\x1b[003q", KeyF4: "\x1b[004q", KeyF5: "\x1b[005q", KeyF6: "\x1b[006q", KeyF7: "\x1b[007q", KeyF8: "\x1b[008q", KeyF9: "\x1b[009q", KeyF10: "\x1b[010q", KeyF11: "\x1b[011q", KeyF12: "\x1b[012q", KeyF13: "\x1b[013q", KeyF14: "\x1b[014q", KeyF15: "\x1b[015q", KeyF16: "\x1b[016q", KeyF17: "\x1b[017q", KeyF18: "\x1b[018q", KeyF19: "\x1b[019q", KeyF20: "\x1b[020q", KeyF21: "\x1b[021q", KeyF22: "\x1b[022q", KeyF23: "\x1b[023q", KeyF24: "\x1b[024q", KeyF25: "\x1b[025q", KeyF26: "\x1b[026q", KeyF27: "\x1b[027q", KeyF28: "\x1b[028q", KeyF29: "\x1b[029q", KeyF30: "\x1b[030q", KeyF31: "\x1b[031q", KeyF32: "\x1b[032q", KeyF33: "\x1b[033q", KeyF34: "\x1b[034q", KeyF35: "\x1b[035q", KeyF36: "\x1b[036q", KeyClear: "\x1b[144q", KeyBacktab: "\x1b[Z", AutoMargin: true, }) }
go
MIT
f4fc3669ca8eb67aa350a76503397192bf26f057
2026-01-07T08:35:43.570558Z
false
jesseduffield/lazydocker
https://github.com/jesseduffield/lazydocker/blob/f4fc3669ca8eb67aa350a76503397192bf26f057/vendor/github.com/gdamore/tcell/v2/terminfo/a/alacritty/term.go
vendor/github.com/gdamore/tcell/v2/terminfo/a/alacritty/term.go
// Generated automatically. DO NOT HAND-EDIT. package alacritty import "github.com/gdamore/tcell/v2/terminfo" func init() { // alacritty terminal emulator terminfo.AddTerminfo(&terminfo.Terminfo{ Name: "alacritty", Columns: 80, Lines: 24, Colors: 256, Bell: "\a", Clear: "\x1b[H\x1b[2J", EnterCA: "\x1b[?1049h\x1b[22;0;0t", ExitCA: "\x1b[?1049l\x1b[23;0;0t", ShowCursor: "\x1b[?12l\x1b[?25h", HideCursor: "\x1b[?25l", AttrOff: "\x1b(B\x1b[m", Underline: "\x1b[4m", Bold: "\x1b[1m", Dim: "\x1b[2m", Italic: "\x1b[3m", Blink: "\x1b[5m", Reverse: "\x1b[7m", EnterKeypad: "\x1b[?1h\x1b=", ExitKeypad: "\x1b[?1l\x1b>", SetFg: "\x1b[%?%p1%{8}%<%t3%p1%d%e%p1%{16}%<%t9%p1%{8}%-%d%e38;5;%p1%d%;m", SetBg: "\x1b[%?%p1%{8}%<%t4%p1%d%e%p1%{16}%<%t10%p1%{8}%-%d%e48;5;%p1%d%;m", SetFgBg: "\x1b[%?%p1%{8}%<%t3%p1%d%e%p1%{16}%<%t9%p1%{8}%-%d%e38;5;%p1%d%;;%?%p2%{8}%<%t4%p2%d%e%p2%{16}%<%t10%p2%{8}%-%d%e48;5;%p2%d%;m", ResetFgBg: "\x1b[39;49m", AltChars: "``aaffggiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~", EnterAcs: "\x1b(0", ExitAcs: "\x1b(B", EnableAutoMargin: "\x1b[?7h", DisableAutoMargin: "\x1b[?7l", StrikeThrough: "\x1b[9m", Mouse: "\x1b[<", SetCursor: "\x1b[%i%p1%d;%p2%dH", CursorBack1: "\b", CursorUp1: "\x1b[A", KeyUp: "\x1bOA", KeyDown: "\x1bOB", KeyRight: "\x1bOC", KeyLeft: "\x1bOD", KeyInsert: "\x1b[2~", KeyDelete: "\x1b[3~", KeyBackspace: "\x7f", KeyHome: "\x1bOH", KeyEnd: "\x1bOF", KeyPgUp: "\x1b[5~", KeyPgDn: "\x1b[6~", KeyF1: "\x1bOP", KeyF2: "\x1bOQ", KeyF3: "\x1bOR", KeyF4: "\x1bOS", KeyF5: "\x1b[15~", KeyF6: "\x1b[17~", KeyF7: "\x1b[18~", KeyF8: "\x1b[19~", KeyF9: "\x1b[20~", KeyF10: "\x1b[21~", KeyF11: "\x1b[23~", KeyF12: "\x1b[24~", KeyBacktab: "\x1b[Z", Modifiers: 1, AutoMargin: true, }) }
go
MIT
f4fc3669ca8eb67aa350a76503397192bf26f057
2026-01-07T08:35:43.570558Z
false
jesseduffield/lazydocker
https://github.com/jesseduffield/lazydocker/blob/f4fc3669ca8eb67aa350a76503397192bf26f057/vendor/github.com/gdamore/tcell/v2/terminfo/a/alacritty/direct.go
vendor/github.com/gdamore/tcell/v2/terminfo/a/alacritty/direct.go
// Generated automatically. DO NOT HAND-EDIT. package alacritty import "github.com/gdamore/tcell/v2/terminfo" func init() { // alacritty with direct color indexing terminfo.AddTerminfo(&terminfo.Terminfo{ Name: "alacritty-direct", Columns: 80, Lines: 24, Colors: 16777216, Bell: "\a", Clear: "\x1b[H\x1b[2J", EnterCA: "\x1b[?1049h\x1b[22;0;0t", ExitCA: "\x1b[?1049l\x1b[23;0;0t", ShowCursor: "\x1b[?12l\x1b[?25h", HideCursor: "\x1b[?25l", AttrOff: "\x1b(B\x1b[m", Underline: "\x1b[4m", Bold: "\x1b[1m", Dim: "\x1b[2m", Italic: "\x1b[3m", Reverse: "\x1b[7m", EnterKeypad: "\x1b[?1h\x1b=", ExitKeypad: "\x1b[?1l\x1b>", SetFg: "\x1b[%?%p1%{8}%<%t3%p1%d%e%p1%{16}%<%t9%p1%{8}%-%d%e38;5;%p1%d%;m", SetBg: "\x1b[%?%p1%{8}%<%t4%p1%d%e%p1%{16}%<%t10%p1%{8}%-%d%e48;5;%p1%d%;m", SetFgBg: "\x1b[%?%p1%{8}%<%t3%p1%d%e%p1%{16}%<%t9%p1%{8}%-%d%e38;5;%p1%d%;;%?%p2%{8}%<%t4%p2%d%e%p2%{16}%<%t10%p2%{8}%-%d%e48;5;%p2%d%;m", ResetFgBg: "\x1b[39;49m", AltChars: "``aaffggiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~", EnterAcs: "\x1b(0", ExitAcs: "\x1b(B", StrikeThrough: "\x1b[9m", Mouse: "\x1b[M", SetCursor: "\x1b[%i%p1%d;%p2%dH", CursorBack1: "\b", CursorUp1: "\x1b[A", KeyUp: "\x1bOA", KeyDown: "\x1bOB", KeyRight: "\x1bOC", KeyLeft: "\x1bOD", KeyInsert: "\x1b[2~", KeyDelete: "\x1b[3~", KeyBackspace: "\x7f", KeyHome: "\x1bOH", KeyEnd: "\x1bOF", KeyPgUp: "\x1b[5~", KeyPgDn: "\x1b[6~", KeyF1: "\x1bOP", KeyF2: "\x1bOQ", KeyF3: "\x1bOR", KeyF4: "\x1bOS", KeyF5: "\x1b[15~", KeyF6: "\x1b[17~", KeyF7: "\x1b[18~", KeyF8: "\x1b[19~", KeyF9: "\x1b[20~", KeyF10: "\x1b[21~", KeyF11: "\x1b[23~", KeyF12: "\x1b[24~", KeyBacktab: "\x1b[Z", Modifiers: 1, TrueColor: true, AutoMargin: true, }) }
go
MIT
f4fc3669ca8eb67aa350a76503397192bf26f057
2026-01-07T08:35:43.570558Z
false
jesseduffield/lazydocker
https://github.com/jesseduffield/lazydocker/blob/f4fc3669ca8eb67aa350a76503397192bf26f057/vendor/github.com/gdamore/tcell/v2/terminfo/a/ansi/term.go
vendor/github.com/gdamore/tcell/v2/terminfo/a/ansi/term.go
// Generated automatically. DO NOT HAND-EDIT. package ansi import "github.com/gdamore/tcell/v2/terminfo" func init() { // ansi/pc-term compatible with color terminfo.AddTerminfo(&terminfo.Terminfo{ Name: "ansi", Columns: 80, Lines: 24, Colors: 8, Bell: "\a", Clear: "\x1b[H\x1b[J", AttrOff: "\x1b[0;10m", Underline: "\x1b[4m", Bold: "\x1b[1m", Blink: "\x1b[5m", Reverse: "\x1b[7m", SetFg: "\x1b[3%p1%dm", SetBg: "\x1b[4%p1%dm", SetFgBg: "\x1b[3%p1%d;4%p2%dm", ResetFgBg: "\x1b[39;49m", PadChar: "\x00", AltChars: "+\x10,\x11-\x18.\x190\xdb`\x04a\xb1f\xf8g\xf1h\xb0j\xd9k\xbfl\xdam\xc0n\xc5o~p\xc4q\xc4r\xc4s_t\xc3u\xb4v\xc1w\xc2x\xb3y\xf3z\xf2{\xe3|\xd8}\x9c~\xfe", EnterAcs: "\x1b[11m", ExitAcs: "\x1b[10m", SetCursor: "\x1b[%i%p1%d;%p2%dH", CursorBack1: "\x1b[D", CursorUp1: "\x1b[A", KeyUp: "\x1b[A", KeyDown: "\x1b[B", KeyRight: "\x1b[C", KeyLeft: "\x1b[D", KeyInsert: "\x1b[L", KeyBackspace: "\b", KeyHome: "\x1b[H", KeyBacktab: "\x1b[Z", AutoMargin: true, }) }
go
MIT
f4fc3669ca8eb67aa350a76503397192bf26f057
2026-01-07T08:35:43.570558Z
false
jesseduffield/lazydocker
https://github.com/jesseduffield/lazydocker/blob/f4fc3669ca8eb67aa350a76503397192bf26f057/vendor/github.com/gdamore/tcell/v2/terminfo/r/rxvt/term.go
vendor/github.com/gdamore/tcell/v2/terminfo/r/rxvt/term.go
// Generated automatically. DO NOT HAND-EDIT. package rxvt import "github.com/gdamore/tcell/v2/terminfo" func init() { // rxvt terminal emulator (X Window System) terminfo.AddTerminfo(&terminfo.Terminfo{ Name: "rxvt", Aliases: []string{"rxvt-color"}, Columns: 80, Lines: 24, Colors: 8, Bell: "\a", Clear: "\x1b[H\x1b[2J", EnterCA: "\x1b7\x1b[?47h", ExitCA: "\x1b[2J\x1b[?47l\x1b8", ShowCursor: "\x1b[?25h", HideCursor: "\x1b[?25l", AttrOff: "\x1b[m\x0f", Underline: "\x1b[4m", Bold: "\x1b[1m", Blink: "\x1b[5m", Reverse: "\x1b[7m", EnterKeypad: "\x1b=", ExitKeypad: "\x1b>", SetFg: "\x1b[3%p1%dm", SetBg: "\x1b[4%p1%dm", SetFgBg: "\x1b[3%p1%d;4%p2%dm", ResetFgBg: "\x1b[39;49m", PadChar: "\x00", AltChars: "``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~", EnterAcs: "\x0e", ExitAcs: "\x0f", EnableAcs: "\x1b(B\x1b)0", Mouse: "\x1b[M", SetCursor: "\x1b[%i%p1%d;%p2%dH", CursorBack1: "\b", CursorUp1: "\x1b[A", KeyUp: "\x1b[A", KeyDown: "\x1b[B", KeyRight: "\x1b[C", KeyLeft: "\x1b[D", KeyInsert: "\x1b[2~", KeyDelete: "\x1b[3~", KeyBackspace: "\x7f", KeyHome: "\x1b[7~", KeyEnd: "\x1b[8~", KeyPgUp: "\x1b[5~", KeyPgDn: "\x1b[6~", KeyF1: "\x1b[11~", KeyF2: "\x1b[12~", KeyF3: "\x1b[13~", KeyF4: "\x1b[14~", KeyF5: "\x1b[15~", KeyF6: "\x1b[17~", KeyF7: "\x1b[18~", KeyF8: "\x1b[19~", KeyF9: "\x1b[20~", KeyF10: "\x1b[21~", KeyF11: "\x1b[23~", KeyF12: "\x1b[24~", KeyF13: "\x1b[25~", KeyF14: "\x1b[26~", KeyF15: "\x1b[28~", KeyF16: "\x1b[29~", KeyF17: "\x1b[31~", KeyF18: "\x1b[32~", KeyF19: "\x1b[33~", KeyF20: "\x1b[34~", KeyF21: "\x1b[23$", KeyF22: "\x1b[24$", KeyF23: "\x1b[11^", KeyF24: "\x1b[12^", KeyF25: "\x1b[13^", KeyF26: "\x1b[14^", KeyF27: "\x1b[15^", KeyF28: "\x1b[17^", KeyF29: "\x1b[18^", KeyF30: "\x1b[19^", KeyF31: "\x1b[20^", KeyF32: "\x1b[21^", KeyF33: "\x1b[23^", KeyF34: "\x1b[24^", KeyF35: "\x1b[25^", KeyF36: "\x1b[26^", KeyF37: "\x1b[28^", KeyF38: "\x1b[29^", KeyF39: "\x1b[31^", KeyF40: "\x1b[32^", KeyF41: "\x1b[33^", KeyF42: "\x1b[34^", KeyF43: "\x1b[23@", KeyF44: "\x1b[24@", KeyBacktab: "\x1b[Z", KeyShfLeft: "\x1b[d", KeyShfRight: "\x1b[c", KeyShfUp: "\x1b[a", KeyShfDown: "\x1b[b", KeyShfHome: "\x1b[7$", KeyShfEnd: "\x1b[8$", KeyShfInsert: "\x1b[2$", KeyShfDelete: "\x1b[3$", KeyCtrlUp: "\x1b[Oa", KeyCtrlDown: "\x1b[Ob", KeyCtrlRight: "\x1b[Oc", KeyCtrlLeft: "\x1b[Od", KeyCtrlHome: "\x1b[7^", KeyCtrlEnd: "\x1b[8^", AutoMargin: true, }) // rxvt 2.7.9 with xterm 256-colors terminfo.AddTerminfo(&terminfo.Terminfo{ Name: "rxvt-256color", Columns: 80, Lines: 24, Colors: 256, Bell: "\a", Clear: "\x1b[H\x1b[2J", EnterCA: "\x1b7\x1b[?47h", ExitCA: "\x1b[2J\x1b[?47l\x1b8", ShowCursor: "\x1b[?25h", HideCursor: "\x1b[?25l", AttrOff: "\x1b[m\x0f", Underline: "\x1b[4m", Bold: "\x1b[1m", Blink: "\x1b[5m", Reverse: "\x1b[7m", EnterKeypad: "\x1b=", ExitKeypad: "\x1b>", SetFg: "\x1b[%?%p1%{8}%<%t3%p1%d%e%p1%{16}%<%t9%p1%{8}%-%d%e38;5;%p1%d%;m", SetBg: "\x1b[%?%p1%{8}%<%t4%p1%d%e%p1%{16}%<%t10%p1%{8}%-%d%e48;5;%p1%d%;m", SetFgBg: "\x1b[%?%p1%{8}%<%t3%p1%d%e%p1%{16}%<%t9%p1%{8}%-%d%e38;5;%p1%d%;;%?%p2%{8}%<%t4%p2%d%e%p2%{16}%<%t10%p2%{8}%-%d%e48;5;%p2%d%;m", ResetFgBg: "\x1b[39;49m", PadChar: "\x00", AltChars: "``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~", EnterAcs: "\x0e", ExitAcs: "\x0f", EnableAcs: "\x1b(B\x1b)0", Mouse: "\x1b[M", SetCursor: "\x1b[%i%p1%d;%p2%dH", CursorBack1: "\b", CursorUp1: "\x1b[A", KeyUp: "\x1b[A", KeyDown: "\x1b[B", KeyRight: "\x1b[C", KeyLeft: "\x1b[D", KeyInsert: "\x1b[2~", KeyDelete: "\x1b[3~", KeyBackspace: "\x7f", KeyHome: "\x1b[7~", KeyEnd: "\x1b[8~", KeyPgUp: "\x1b[5~", KeyPgDn: "\x1b[6~", KeyF1: "\x1b[11~", KeyF2: "\x1b[12~", KeyF3: "\x1b[13~", KeyF4: "\x1b[14~", KeyF5: "\x1b[15~", KeyF6: "\x1b[17~", KeyF7: "\x1b[18~", KeyF8: "\x1b[19~", KeyF9: "\x1b[20~", KeyF10: "\x1b[21~", KeyF11: "\x1b[23~", KeyF12: "\x1b[24~", KeyF13: "\x1b[25~", KeyF14: "\x1b[26~", KeyF15: "\x1b[28~", KeyF16: "\x1b[29~", KeyF17: "\x1b[31~", KeyF18: "\x1b[32~", KeyF19: "\x1b[33~", KeyF20: "\x1b[34~", KeyF21: "\x1b[23$", KeyF22: "\x1b[24$", KeyF23: "\x1b[11^", KeyF24: "\x1b[12^", KeyF25: "\x1b[13^", KeyF26: "\x1b[14^", KeyF27: "\x1b[15^", KeyF28: "\x1b[17^", KeyF29: "\x1b[18^", KeyF30: "\x1b[19^", KeyF31: "\x1b[20^", KeyF32: "\x1b[21^", KeyF33: "\x1b[23^", KeyF34: "\x1b[24^", KeyF35: "\x1b[25^", KeyF36: "\x1b[26^", KeyF37: "\x1b[28^", KeyF38: "\x1b[29^", KeyF39: "\x1b[31^", KeyF40: "\x1b[32^", KeyF41: "\x1b[33^", KeyF42: "\x1b[34^", KeyF43: "\x1b[23@", KeyF44: "\x1b[24@", KeyBacktab: "\x1b[Z", KeyShfLeft: "\x1b[d", KeyShfRight: "\x1b[c", KeyShfUp: "\x1b[a", KeyShfDown: "\x1b[b", KeyShfHome: "\x1b[7$", KeyShfEnd: "\x1b[8$", KeyShfInsert: "\x1b[2$", KeyShfDelete: "\x1b[3$", KeyCtrlUp: "\x1b[Oa", KeyCtrlDown: "\x1b[Ob", KeyCtrlRight: "\x1b[Oc", KeyCtrlLeft: "\x1b[Od", KeyCtrlHome: "\x1b[7^", KeyCtrlEnd: "\x1b[8^", AutoMargin: true, }) // rxvt 2.7.9 with xterm 88-colors terminfo.AddTerminfo(&terminfo.Terminfo{ Name: "rxvt-88color", Columns: 80, Lines: 24, Colors: 88, Bell: "\a", Clear: "\x1b[H\x1b[2J", EnterCA: "\x1b7\x1b[?47h", ExitCA: "\x1b[2J\x1b[?47l\x1b8", ShowCursor: "\x1b[?25h", HideCursor: "\x1b[?25l", AttrOff: "\x1b[m\x0f", Underline: "\x1b[4m", Bold: "\x1b[1m", Blink: "\x1b[5m", Reverse: "\x1b[7m", EnterKeypad: "\x1b=", ExitKeypad: "\x1b>", SetFg: "\x1b[%?%p1%{8}%<%t3%p1%d%e%p1%{16}%<%t9%p1%{8}%-%d%e38;5;%p1%d%;m", SetBg: "\x1b[%?%p1%{8}%<%t4%p1%d%e%p1%{16}%<%t10%p1%{8}%-%d%e48;5;%p1%d%;m", SetFgBg: "\x1b[%?%p1%{8}%<%t3%p1%d%e%p1%{16}%<%t9%p1%{8}%-%d%e38;5;%p1%d%;;%?%p2%{8}%<%t4%p2%d%e%p2%{16}%<%t10%p2%{8}%-%d%e48;5;%p2%d%;m", ResetFgBg: "\x1b[39;49m", PadChar: "\x00", AltChars: "``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~", EnterAcs: "\x0e", ExitAcs: "\x0f", EnableAcs: "\x1b(B\x1b)0", Mouse: "\x1b[M", SetCursor: "\x1b[%i%p1%d;%p2%dH", CursorBack1: "\b", CursorUp1: "\x1b[A", KeyUp: "\x1b[A", KeyDown: "\x1b[B", KeyRight: "\x1b[C", KeyLeft: "\x1b[D", KeyInsert: "\x1b[2~", KeyDelete: "\x1b[3~", KeyBackspace: "\x7f", KeyHome: "\x1b[7~", KeyEnd: "\x1b[8~", KeyPgUp: "\x1b[5~", KeyPgDn: "\x1b[6~", KeyF1: "\x1b[11~", KeyF2: "\x1b[12~", KeyF3: "\x1b[13~", KeyF4: "\x1b[14~", KeyF5: "\x1b[15~", KeyF6: "\x1b[17~", KeyF7: "\x1b[18~", KeyF8: "\x1b[19~", KeyF9: "\x1b[20~", KeyF10: "\x1b[21~", KeyF11: "\x1b[23~", KeyF12: "\x1b[24~", KeyF13: "\x1b[25~", KeyF14: "\x1b[26~", KeyF15: "\x1b[28~", KeyF16: "\x1b[29~", KeyF17: "\x1b[31~", KeyF18: "\x1b[32~", KeyF19: "\x1b[33~", KeyF20: "\x1b[34~", KeyF21: "\x1b[23$", KeyF22: "\x1b[24$", KeyF23: "\x1b[11^", KeyF24: "\x1b[12^", KeyF25: "\x1b[13^", KeyF26: "\x1b[14^", KeyF27: "\x1b[15^", KeyF28: "\x1b[17^", KeyF29: "\x1b[18^", KeyF30: "\x1b[19^", KeyF31: "\x1b[20^", KeyF32: "\x1b[21^", KeyF33: "\x1b[23^", KeyF34: "\x1b[24^", KeyF35: "\x1b[25^", KeyF36: "\x1b[26^", KeyF37: "\x1b[28^", KeyF38: "\x1b[29^", KeyF39: "\x1b[31^", KeyF40: "\x1b[32^", KeyF41: "\x1b[33^", KeyF42: "\x1b[34^", KeyF43: "\x1b[23@", KeyF44: "\x1b[24@", KeyBacktab: "\x1b[Z", KeyShfLeft: "\x1b[d", KeyShfRight: "\x1b[c", KeyShfUp: "\x1b[a", KeyShfDown: "\x1b[b", KeyShfHome: "\x1b[7$", KeyShfEnd: "\x1b[8$", KeyShfInsert: "\x1b[2$", KeyShfDelete: "\x1b[3$", KeyCtrlUp: "\x1b[Oa", KeyCtrlDown: "\x1b[Ob", KeyCtrlRight: "\x1b[Oc", KeyCtrlLeft: "\x1b[Od", KeyCtrlHome: "\x1b[7^", KeyCtrlEnd: "\x1b[8^", AutoMargin: true, }) // rxvt-unicode terminal (X Window System) terminfo.AddTerminfo(&terminfo.Terminfo{ Name: "rxvt-unicode", Columns: 80, Lines: 24, Colors: 88, Bell: "\a", Clear: "\x1b[H\x1b[2J", EnterCA: "\x1b[?1049h", ExitCA: "\x1b[r\x1b[?1049l", ShowCursor: "\x1b[?12l\x1b[?25h", HideCursor: "\x1b[?25l", AttrOff: "\x1b[m\x1b(B", Underline: "\x1b[4m", Bold: "\x1b[1m", Italic: "\x1b[3m", Blink: "\x1b[5m", Reverse: "\x1b[7m", EnterKeypad: "\x1b=", ExitKeypad: "\x1b>", SetFg: "\x1b[38;5;%p1%dm", SetBg: "\x1b[48;5;%p1%dm", SetFgBg: "\x1b[38;5;%p1%d;48;5;%p2%dm", ResetFgBg: "\x1b[39;49m", AltChars: "+C,D-A.B0E``aaffgghFiGjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~", EnterAcs: "\x1b(0", ExitAcs: "\x1b(B", EnableAutoMargin: "\x1b[?7h", DisableAutoMargin: "\x1b[?7l", Mouse: "\x1b[M", SetCursor: "\x1b[%i%p1%d;%p2%dH", CursorBack1: "\b", CursorUp1: "\x1b[A", KeyUp: "\x1b[A", KeyDown: "\x1b[B", KeyRight: "\x1b[C", KeyLeft: "\x1b[D", KeyInsert: "\x1b[2~", KeyDelete: "\x1b[3~", KeyBackspace: "\x7f", KeyHome: "\x1b[7~", KeyEnd: "\x1b[8~", KeyPgUp: "\x1b[5~", KeyPgDn: "\x1b[6~", KeyF1: "\x1b[11~", KeyF2: "\x1b[12~", KeyF3: "\x1b[13~", KeyF4: "\x1b[14~", KeyF5: "\x1b[15~", KeyF6: "\x1b[17~", KeyF7: "\x1b[18~", KeyF8: "\x1b[19~", KeyF9: "\x1b[20~", KeyF10: "\x1b[21~", KeyF11: "\x1b[23~", KeyF12: "\x1b[24~", KeyF13: "\x1b[25~", KeyF14: "\x1b[26~", KeyF15: "\x1b[28~", KeyF16: "\x1b[29~", KeyF17: "\x1b[31~", KeyF18: "\x1b[32~", KeyF19: "\x1b[33~", KeyF20: "\x1b[34~", KeyBacktab: "\x1b[Z", KeyShfLeft: "\x1b[d", KeyShfRight: "\x1b[c", KeyShfUp: "\x1b[a", KeyShfDown: "\x1b[b", KeyShfHome: "\x1b[7$", KeyShfEnd: "\x1b[8$", KeyShfInsert: "\x1b[2$", KeyShfDelete: "\x1b[3$", KeyCtrlUp: "\x1b[Oa", KeyCtrlDown: "\x1b[Ob", KeyCtrlRight: "\x1b[Oc", KeyCtrlLeft: "\x1b[Od", KeyCtrlHome: "\x1b[7^", KeyCtrlEnd: "\x1b[8^", AutoMargin: true, InsertChar: "\x1b[@", }) // rxvt-unicode terminal with 256 colors (X Window System) terminfo.AddTerminfo(&terminfo.Terminfo{ Name: "rxvt-unicode-256color", Columns: 80, Lines: 24, Colors: 256, Bell: "\a", Clear: "\x1b[H\x1b[2J", EnterCA: "\x1b[?1049h", ExitCA: "\x1b[r\x1b[?1049l", ShowCursor: "\x1b[?12l\x1b[?25h", HideCursor: "\x1b[?25l", AttrOff: "\x1b[m\x1b(B", Underline: "\x1b[4m", Bold: "\x1b[1m", Italic: "\x1b[3m", Blink: "\x1b[5m", Reverse: "\x1b[7m", EnterKeypad: "\x1b=", ExitKeypad: "\x1b>", SetFg: "\x1b[38;5;%p1%dm", SetBg: "\x1b[48;5;%p1%dm", SetFgBg: "\x1b[38;5;%p1%d;48;5;%p2%dm", ResetFgBg: "\x1b[39;49m", AltChars: "+C,D-A.B0E``aaffgghFiGjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~", EnterAcs: "\x1b(0", ExitAcs: "\x1b(B", EnableAutoMargin: "\x1b[?7h", DisableAutoMargin: "\x1b[?7l", Mouse: "\x1b[M", SetCursor: "\x1b[%i%p1%d;%p2%dH", CursorBack1: "\b", CursorUp1: "\x1b[A", KeyUp: "\x1b[A", KeyDown: "\x1b[B", KeyRight: "\x1b[C", KeyLeft: "\x1b[D", KeyInsert: "\x1b[2~", KeyDelete: "\x1b[3~", KeyBackspace: "\x7f", KeyHome: "\x1b[7~", KeyEnd: "\x1b[8~", KeyPgUp: "\x1b[5~", KeyPgDn: "\x1b[6~", KeyF1: "\x1b[11~", KeyF2: "\x1b[12~", KeyF3: "\x1b[13~", KeyF4: "\x1b[14~", KeyF5: "\x1b[15~", KeyF6: "\x1b[17~", KeyF7: "\x1b[18~", KeyF8: "\x1b[19~", KeyF9: "\x1b[20~", KeyF10: "\x1b[21~", KeyF11: "\x1b[23~", KeyF12: "\x1b[24~", KeyF13: "\x1b[25~", KeyF14: "\x1b[26~", KeyF15: "\x1b[28~", KeyF16: "\x1b[29~", KeyF17: "\x1b[31~", KeyF18: "\x1b[32~", KeyF19: "\x1b[33~", KeyF20: "\x1b[34~", KeyBacktab: "\x1b[Z", KeyShfLeft: "\x1b[d", KeyShfRight: "\x1b[c", KeyShfUp: "\x1b[a", KeyShfDown: "\x1b[b", KeyShfHome: "\x1b[7$", KeyShfEnd: "\x1b[8$", KeyShfInsert: "\x1b[2$", KeyShfDelete: "\x1b[3$", KeyCtrlUp: "\x1b[Oa", KeyCtrlDown: "\x1b[Ob", KeyCtrlRight: "\x1b[Oc", KeyCtrlLeft: "\x1b[Od", KeyCtrlHome: "\x1b[7^", KeyCtrlEnd: "\x1b[8^", AutoMargin: true, InsertChar: "\x1b[@", }) }
go
MIT
f4fc3669ca8eb67aa350a76503397192bf26f057
2026-01-07T08:35:43.570558Z
false
jesseduffield/lazydocker
https://github.com/jesseduffield/lazydocker/blob/f4fc3669ca8eb67aa350a76503397192bf26f057/vendor/github.com/gdamore/tcell/v2/terminfo/x/xterm/term.go
vendor/github.com/gdamore/tcell/v2/terminfo/x/xterm/term.go
// Generated automatically. DO NOT HAND-EDIT. package xterm import "github.com/gdamore/tcell/v2/terminfo" func init() { // xterm terminal emulator (X Window System) terminfo.AddTerminfo(&terminfo.Terminfo{ Name: "xterm", Aliases: []string{"xterm-debian"}, Columns: 80, Lines: 24, Colors: 8, Bell: "\a", Clear: "\x1b[H\x1b[2J", EnterCA: "\x1b[?1049h\x1b[22;0;0t", ExitCA: "\x1b[?1049l\x1b[23;0;0t", ShowCursor: "\x1b[?12l\x1b[?25h", HideCursor: "\x1b[?25l", AttrOff: "\x1b(B\x1b[m", Underline: "\x1b[4m", Bold: "\x1b[1m", Dim: "\x1b[2m", Italic: "\x1b[3m", Blink: "\x1b[5m", Reverse: "\x1b[7m", EnterKeypad: "\x1b[?1h\x1b=", ExitKeypad: "\x1b[?1l\x1b>", SetFg: "\x1b[3%p1%dm", SetBg: "\x1b[4%p1%dm", SetFgBg: "\x1b[3%p1%d;4%p2%dm", ResetFgBg: "\x1b[39;49m", AltChars: "``aaffggiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~", EnterAcs: "\x1b(0", ExitAcs: "\x1b(B", EnableAutoMargin: "\x1b[?7h", DisableAutoMargin: "\x1b[?7l", StrikeThrough: "\x1b[9m", Mouse: "\x1b[<", SetCursor: "\x1b[%i%p1%d;%p2%dH", CursorBack1: "\b", CursorUp1: "\x1b[A", KeyUp: "\x1bOA", KeyDown: "\x1bOB", KeyRight: "\x1bOC", KeyLeft: "\x1bOD", KeyInsert: "\x1b[2~", KeyDelete: "\x1b[3~", KeyBackspace: "\x7f", KeyHome: "\x1bOH", KeyEnd: "\x1bOF", KeyPgUp: "\x1b[5~", KeyPgDn: "\x1b[6~", KeyF1: "\x1bOP", KeyF2: "\x1bOQ", KeyF3: "\x1bOR", KeyF4: "\x1bOS", KeyF5: "\x1b[15~", KeyF6: "\x1b[17~", KeyF7: "\x1b[18~", KeyF8: "\x1b[19~", KeyF9: "\x1b[20~", KeyF10: "\x1b[21~", KeyF11: "\x1b[23~", KeyF12: "\x1b[24~", KeyBacktab: "\x1b[Z", Modifiers: 1, AutoMargin: true, }) // xterm with 88 colors terminfo.AddTerminfo(&terminfo.Terminfo{ Name: "xterm-88color", Columns: 80, Lines: 24, Colors: 88, Bell: "\a", Clear: "\x1b[H\x1b[2J", EnterCA: "\x1b[?1049h\x1b[22;0;0t", ExitCA: "\x1b[?1049l\x1b[23;0;0t", ShowCursor: "\x1b[?12l\x1b[?25h", HideCursor: "\x1b[?25l", AttrOff: "\x1b(B\x1b[m", Underline: "\x1b[4m", Bold: "\x1b[1m", Dim: "\x1b[2m", Italic: "\x1b[3m", Blink: "\x1b[5m", Reverse: "\x1b[7m", EnterKeypad: "\x1b[?1h\x1b=", ExitKeypad: "\x1b[?1l\x1b>", SetFg: "\x1b[%?%p1%{8}%<%t3%p1%d%e%p1%{16}%<%t9%p1%{8}%-%d%e38;5;%p1%d%;m", SetBg: "\x1b[%?%p1%{8}%<%t4%p1%d%e%p1%{16}%<%t10%p1%{8}%-%d%e48;5;%p1%d%;m", SetFgBg: "\x1b[%?%p1%{8}%<%t3%p1%d%e%p1%{16}%<%t9%p1%{8}%-%d%e38;5;%p1%d%;;%?%p2%{8}%<%t4%p2%d%e%p2%{16}%<%t10%p2%{8}%-%d%e48;5;%p2%d%;m", ResetFgBg: "\x1b[39;49m", AltChars: "``aaffggiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~", EnterAcs: "\x1b(0", ExitAcs: "\x1b(B", EnableAutoMargin: "\x1b[?7h", DisableAutoMargin: "\x1b[?7l", StrikeThrough: "\x1b[9m", Mouse: "\x1b[<", SetCursor: "\x1b[%i%p1%d;%p2%dH", CursorBack1: "\b", CursorUp1: "\x1b[A", KeyUp: "\x1bOA", KeyDown: "\x1bOB", KeyRight: "\x1bOC", KeyLeft: "\x1bOD", KeyInsert: "\x1b[2~", KeyDelete: "\x1b[3~", KeyBackspace: "\x7f", KeyHome: "\x1bOH", KeyEnd: "\x1bOF", KeyPgUp: "\x1b[5~", KeyPgDn: "\x1b[6~", KeyF1: "\x1bOP", KeyF2: "\x1bOQ", KeyF3: "\x1bOR", KeyF4: "\x1bOS", KeyF5: "\x1b[15~", KeyF6: "\x1b[17~", KeyF7: "\x1b[18~", KeyF8: "\x1b[19~", KeyF9: "\x1b[20~", KeyF10: "\x1b[21~", KeyF11: "\x1b[23~", KeyF12: "\x1b[24~", KeyBacktab: "\x1b[Z", Modifiers: 1, AutoMargin: true, }) // xterm with 256 colors terminfo.AddTerminfo(&terminfo.Terminfo{ Name: "xterm-256color", Columns: 80, Lines: 24, Colors: 256, Bell: "\a", Clear: "\x1b[H\x1b[2J", EnterCA: "\x1b[?1049h\x1b[22;0;0t", ExitCA: "\x1b[?1049l\x1b[23;0;0t", ShowCursor: "\x1b[?12l\x1b[?25h", HideCursor: "\x1b[?25l", AttrOff: "\x1b(B\x1b[m", Underline: "\x1b[4m", Bold: "\x1b[1m", Dim: "\x1b[2m", Italic: "\x1b[3m", Blink: "\x1b[5m", Reverse: "\x1b[7m", EnterKeypad: "\x1b[?1h\x1b=", ExitKeypad: "\x1b[?1l\x1b>", SetFg: "\x1b[%?%p1%{8}%<%t3%p1%d%e%p1%{16}%<%t9%p1%{8}%-%d%e38;5;%p1%d%;m", SetBg: "\x1b[%?%p1%{8}%<%t4%p1%d%e%p1%{16}%<%t10%p1%{8}%-%d%e48;5;%p1%d%;m", SetFgBg: "\x1b[%?%p1%{8}%<%t3%p1%d%e%p1%{16}%<%t9%p1%{8}%-%d%e38;5;%p1%d%;;%?%p2%{8}%<%t4%p2%d%e%p2%{16}%<%t10%p2%{8}%-%d%e48;5;%p2%d%;m", ResetFgBg: "\x1b[39;49m", AltChars: "``aaffggiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~", EnterAcs: "\x1b(0", ExitAcs: "\x1b(B", EnableAutoMargin: "\x1b[?7h", DisableAutoMargin: "\x1b[?7l", StrikeThrough: "\x1b[9m", Mouse: "\x1b[<", SetCursor: "\x1b[%i%p1%d;%p2%dH", CursorBack1: "\b", CursorUp1: "\x1b[A", KeyUp: "\x1bOA", KeyDown: "\x1bOB", KeyRight: "\x1bOC", KeyLeft: "\x1bOD", KeyInsert: "\x1b[2~", KeyDelete: "\x1b[3~", KeyBackspace: "\x7f", KeyHome: "\x1bOH", KeyEnd: "\x1bOF", KeyPgUp: "\x1b[5~", KeyPgDn: "\x1b[6~", KeyF1: "\x1bOP", KeyF2: "\x1bOQ", KeyF3: "\x1bOR", KeyF4: "\x1bOS", KeyF5: "\x1b[15~", KeyF6: "\x1b[17~", KeyF7: "\x1b[18~", KeyF8: "\x1b[19~", KeyF9: "\x1b[20~", KeyF10: "\x1b[21~", KeyF11: "\x1b[23~", KeyF12: "\x1b[24~", KeyBacktab: "\x1b[Z", Modifiers: 1, AutoMargin: true, }) }
go
MIT
f4fc3669ca8eb67aa350a76503397192bf26f057
2026-01-07T08:35:43.570558Z
false
jesseduffield/lazydocker
https://github.com/jesseduffield/lazydocker/blob/f4fc3669ca8eb67aa350a76503397192bf26f057/vendor/github.com/gdamore/tcell/v2/terminfo/x/xterm/direct.go
vendor/github.com/gdamore/tcell/v2/terminfo/x/xterm/direct.go
// Copyright 2021 The TCell Authors // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use 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. // This terminal definition is derived from the xterm-256color definition, but // makes use of the RGB property these terminals have to support direct color. // The terminfo entry for this uses a new format for the color handling introduced // by ncurses 6.1 (and used by nobody else), so this override ensures we get // good handling even in the face of this. package xterm import "github.com/gdamore/tcell/v2/terminfo" func init() { // derived from xterm-256color, but adds full RGB support terminfo.AddTerminfo(&terminfo.Terminfo{ Name: "xterm-direct", Aliases: []string{"xterm-truecolor"}, Columns: 80, Lines: 24, Colors: 256, Bell: "\a", Clear: "\x1b[H\x1b[2J", EnterCA: "\x1b[?1049h\x1b[22;0;0t", ExitCA: "\x1b[?1049l\x1b[23;0;0t", ShowCursor: "\x1b[?12l\x1b[?25h", HideCursor: "\x1b[?25l", AttrOff: "\x1b(B\x1b[m", Underline: "\x1b[4m", Bold: "\x1b[1m", Dim: "\x1b[2m", Italic: "\x1b[3m", Blink: "\x1b[5m", Reverse: "\x1b[7m", EnterKeypad: "\x1b[?1h\x1b=", ExitKeypad: "\x1b[?1l\x1b>", SetFg: "\x1b[%?%p1%{8}%<%t3%p1%d%e%p1%{16}%<%t9%p1%{8}%-%d%e38;5;%p1%d%;m", SetBg: "\x1b[%?%p1%{8}%<%t4%p1%d%e%p1%{16}%<%t10%p1%{8}%-%d%e48;5;%p1%d%;m", SetFgBg: "\x1b[%?%p1%{8}%<%t3%p1%d%e%p1%{16}%<%t9%p1%{8}%-%d%e38;5;%p1%d%;;%?%p2%{8}%<%t4%p2%d%e%p2%{16}%<%t10%p2%{8}%-%d%e48;5;%p2%d%;m", SetFgRGB: "\x1b[38;2;%p1%d;%p2%d;%p3%dm", SetBgRGB: "\x1b[48;2;%p1%d;%p2%d;%p3%dm", SetFgBgRGB: "\x1b[38;2;%p1%d;%p2%d;%p3%d;48;2;%p4%d;%p5%d;%p6%dm", ResetFgBg: "\x1b[39;49m", AltChars: "``aaffggiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~", EnterAcs: "\x1b(0", ExitAcs: "\x1b(B", StrikeThrough: "\x1b[9m", Mouse: "\x1b[M", SetCursor: "\x1b[%i%p1%d;%p2%dH", CursorBack1: "\b", CursorUp1: "\x1b[A", KeyUp: "\x1bOA", KeyDown: "\x1bOB", KeyRight: "\x1bOC", KeyLeft: "\x1bOD", KeyInsert: "\x1b[2~", KeyDelete: "\x1b[3~", KeyBackspace: "\u007f", KeyHome: "\x1bOH", KeyEnd: "\x1bOF", KeyPgUp: "\x1b[5~", KeyPgDn: "\x1b[6~", KeyF1: "\x1bOP", KeyF2: "\x1bOQ", KeyF3: "\x1bOR", KeyF4: "\x1bOS", KeyF5: "\x1b[15~", KeyF6: "\x1b[17~", KeyF7: "\x1b[18~", KeyF8: "\x1b[19~", KeyF9: "\x1b[20~", KeyF10: "\x1b[21~", KeyF11: "\x1b[23~", KeyF12: "\x1b[24~", KeyBacktab: "\x1b[Z", Modifiers: 1, AutoMargin: true, TrueColor: true, }) }
go
MIT
f4fc3669ca8eb67aa350a76503397192bf26f057
2026-01-07T08:35:43.570558Z
false
jesseduffield/lazydocker
https://github.com/jesseduffield/lazydocker/blob/f4fc3669ca8eb67aa350a76503397192bf26f057/vendor/github.com/gdamore/tcell/v2/terminfo/x/xterm_kitty/term.go
vendor/github.com/gdamore/tcell/v2/terminfo/x/xterm_kitty/term.go
// Generated automatically. DO NOT HAND-EDIT. package xterm_kitty import "github.com/gdamore/tcell/v2/terminfo" func init() { // KovIdTTY terminfo.AddTerminfo(&terminfo.Terminfo{ Name: "xterm-kitty", Columns: 80, Lines: 24, Colors: 256, Bell: "\a", Clear: "\x1b[H\x1b[2J", EnterCA: "\x1b[?1049h", ExitCA: "\x1b[?1049l", ShowCursor: "\x1b[?12h\x1b[?25h", HideCursor: "\x1b[?25l", AttrOff: "\x1b(B\x1b[m", Underline: "\x1b[4m", Bold: "\x1b[1m", Dim: "\x1b[2m", Italic: "\x1b[3m", Reverse: "\x1b[7m", EnterKeypad: "\x1b[?1h", ExitKeypad: "\x1b[?1l", SetFg: "\x1b[%?%p1%{8}%<%t3%p1%d%e%p1%{16}%<%t9%p1%{8}%-%d%e38;5;%p1%d%;m", SetBg: "\x1b[%?%p1%{8}%<%t4%p1%d%e%p1%{16}%<%t10%p1%{8}%-%d%e48;5;%p1%d%;m", SetFgBg: "\x1b[%?%p1%{8}%<%t3%p1%d%e%p1%{16}%<%t9%p1%{8}%-%d%e38;5;%p1%d%;;%?%p2%{8}%<%t4%p2%d%e%p2%{16}%<%t10%p2%{8}%-%d%e48;5;%p2%d%;m", ResetFgBg: "\x1b[39;49m", AltChars: "++,,--..00``aaffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~", EnterAcs: "\x1b(0", ExitAcs: "\x1b(B", EnableAutoMargin: "\x1b[?7h", DisableAutoMargin: "\x1b[?7l", StrikeThrough: "\x1b[9m", Mouse: "\x1b[M", SetCursor: "\x1b[%i%p1%d;%p2%dH", CursorBack1: "\b", CursorUp1: "\x1b[A", KeyUp: "\x1bOA", KeyDown: "\x1bOB", KeyRight: "\x1bOC", KeyLeft: "\x1bOD", KeyInsert: "\x1b[2~", KeyDelete: "\x1b[3~", KeyBackspace: "\x7f", KeyHome: "\x1bOH", KeyEnd: "\x1bOF", KeyPgUp: "\x1b[5~", KeyPgDn: "\x1b[6~", KeyF1: "\x1bOP", KeyF2: "\x1bOQ", KeyF3: "\x1bOR", KeyF4: "\x1bOS", KeyF5: "\x1b[15~", KeyF6: "\x1b[17~", KeyF7: "\x1b[18~", KeyF8: "\x1b[19~", KeyF9: "\x1b[20~", KeyF10: "\x1b[21~", KeyF11: "\x1b[23~", KeyF12: "\x1b[24~", KeyBacktab: "\x1b[Z", Modifiers: 1, TrueColor: true, AutoMargin: true, }) }
go
MIT
f4fc3669ca8eb67aa350a76503397192bf26f057
2026-01-07T08:35:43.570558Z
false
jesseduffield/lazydocker
https://github.com/jesseduffield/lazydocker/blob/f4fc3669ca8eb67aa350a76503397192bf26f057/vendor/github.com/gdamore/tcell/v2/terminfo/x/xfce/term.go
vendor/github.com/gdamore/tcell/v2/terminfo/x/xfce/term.go
// Generated automatically. DO NOT HAND-EDIT. package xfce import "github.com/gdamore/tcell/v2/terminfo" func init() { // Xfce Terminal terminfo.AddTerminfo(&terminfo.Terminfo{ Name: "xfce", Columns: 80, Lines: 24, Colors: 8, Bell: "\a", Clear: "\x1b[H\x1b[2J", EnterCA: "\x1b7\x1b[?47h", ExitCA: "\x1b[2J\x1b[?47l\x1b8", ShowCursor: "\x1b[?25h", HideCursor: "\x1b[?25l", AttrOff: "\x1b[0m\x0f", Underline: "\x1b[4m", Bold: "\x1b[1m", Reverse: "\x1b[7m", EnterKeypad: "\x1b[?1h\x1b=", ExitKeypad: "\x1b[?1l\x1b>", SetFg: "\x1b[3%p1%dm", SetBg: "\x1b[4%p1%dm", SetFgBg: "\x1b[3%p1%d;4%p2%dm", ResetFgBg: "\x1b[39;49m", PadChar: "\x00", AltChars: "``aaffggiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~", EnterAcs: "\x0e", ExitAcs: "\x0f", EnableAcs: "\x1b)0", EnableAutoMargin: "\x1b[?7h", DisableAutoMargin: "\x1b[?7l", Mouse: "\x1b[M", SetCursor: "\x1b[%i%p1%d;%p2%dH", CursorBack1: "\b", CursorUp1: "\x1b[A", KeyUp: "\x1bOA", KeyDown: "\x1bOB", KeyRight: "\x1bOC", KeyLeft: "\x1bOD", KeyInsert: "\x1b[2~", KeyDelete: "\x1b[3~", KeyBackspace: "\x7f", KeyHome: "\x1bOH", KeyEnd: "\x1bOF", KeyPgUp: "\x1b[5~", KeyPgDn: "\x1b[6~", KeyF1: "\x1bOP", KeyF2: "\x1bOQ", KeyF3: "\x1bOR", KeyF4: "\x1bOS", KeyF5: "\x1b[15~", KeyF6: "\x1b[17~", KeyF7: "\x1b[18~", KeyF8: "\x1b[19~", KeyF9: "\x1b[20~", KeyF10: "\x1b[21~", KeyF11: "\x1b[23~", KeyF12: "\x1b[24~", KeyBacktab: "\x1b[Z", Modifiers: 1, AutoMargin: true, }) }
go
MIT
f4fc3669ca8eb67aa350a76503397192bf26f057
2026-01-07T08:35:43.570558Z
false
jesseduffield/lazydocker
https://github.com/jesseduffield/lazydocker/blob/f4fc3669ca8eb67aa350a76503397192bf26f057/vendor/github.com/gdamore/tcell/v2/terminfo/base/base.go
vendor/github.com/gdamore/tcell/v2/terminfo/base/base.go
// Copyright 2020 The TCell Authors // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use 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. // This is just a "minimalist" set of the base terminal descriptions. // It should be sufficient for most applications. // Package base contains the base terminal descriptions that are likely // to be needed by any stock application. It is imported by default in the // terminfo package, so terminal types listed here will be available to any // tcell application. package base import ( // The following imports just register themselves -- // thse are the terminal types we aggregate in this package. _ "github.com/gdamore/tcell/v2/terminfo/a/ansi" _ "github.com/gdamore/tcell/v2/terminfo/v/vt100" _ "github.com/gdamore/tcell/v2/terminfo/v/vt102" _ "github.com/gdamore/tcell/v2/terminfo/v/vt220" _ "github.com/gdamore/tcell/v2/terminfo/x/xterm" )
go
MIT
f4fc3669ca8eb67aa350a76503397192bf26f057
2026-01-07T08:35:43.570558Z
false
jesseduffield/lazydocker
https://github.com/jesseduffield/lazydocker/blob/f4fc3669ca8eb67aa350a76503397192bf26f057/vendor/github.com/gdamore/tcell/v2/terminfo/s/screen/term.go
vendor/github.com/gdamore/tcell/v2/terminfo/s/screen/term.go
// Generated automatically. DO NOT HAND-EDIT. package screen import "github.com/gdamore/tcell/v2/terminfo" func init() { // VT 100/ANSI X3.64 virtual terminal terminfo.AddTerminfo(&terminfo.Terminfo{ Name: "screen", Columns: 80, Lines: 24, Colors: 8, Bell: "\a", Clear: "\x1b[H\x1b[J", EnterCA: "\x1b[?1049h", ExitCA: "\x1b[?1049l", ShowCursor: "\x1b[34h\x1b[?25h", HideCursor: "\x1b[?25l", AttrOff: "\x1b[m\x0f", Underline: "\x1b[4m", Bold: "\x1b[1m", Dim: "\x1b[2m", Blink: "\x1b[5m", Reverse: "\x1b[7m", EnterKeypad: "\x1b[?1h\x1b=", ExitKeypad: "\x1b[?1l\x1b>", SetFg: "\x1b[3%p1%dm", SetBg: "\x1b[4%p1%dm", SetFgBg: "\x1b[3%p1%d;4%p2%dm", ResetFgBg: "\x1b[39;49m", PadChar: "\x00", AltChars: "++,,--..00``aaffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~", EnterAcs: "\x0e", ExitAcs: "\x0f", EnableAcs: "\x1b(B\x1b)0", Mouse: "\x1b[M", SetCursor: "\x1b[%i%p1%d;%p2%dH", CursorBack1: "\b", CursorUp1: "\x1bM", KeyUp: "\x1bOA", KeyDown: "\x1bOB", KeyRight: "\x1bOC", KeyLeft: "\x1bOD", KeyInsert: "\x1b[2~", KeyDelete: "\x1b[3~", KeyBackspace: "\x7f", KeyHome: "\x1b[1~", KeyEnd: "\x1b[4~", KeyPgUp: "\x1b[5~", KeyPgDn: "\x1b[6~", KeyF1: "\x1bOP", KeyF2: "\x1bOQ", KeyF3: "\x1bOR", KeyF4: "\x1bOS", KeyF5: "\x1b[15~", KeyF6: "\x1b[17~", KeyF7: "\x1b[18~", KeyF8: "\x1b[19~", KeyF9: "\x1b[20~", KeyF10: "\x1b[21~", KeyF11: "\x1b[23~", KeyF12: "\x1b[24~", KeyBacktab: "\x1b[Z", AutoMargin: true, }) // GNU Screen with 256 colors terminfo.AddTerminfo(&terminfo.Terminfo{ Name: "screen-256color", Columns: 80, Lines: 24, Colors: 256, Bell: "\a", Clear: "\x1b[H\x1b[J", EnterCA: "\x1b[?1049h", ExitCA: "\x1b[?1049l", ShowCursor: "\x1b[34h\x1b[?25h", HideCursor: "\x1b[?25l", AttrOff: "\x1b[m\x0f", Underline: "\x1b[4m", Bold: "\x1b[1m", Dim: "\x1b[2m", Blink: "\x1b[5m", Reverse: "\x1b[7m", EnterKeypad: "\x1b[?1h\x1b=", ExitKeypad: "\x1b[?1l\x1b>", SetFg: "\x1b[%?%p1%{8}%<%t3%p1%d%e%p1%{16}%<%t9%p1%{8}%-%d%e38;5;%p1%d%;m", SetBg: "\x1b[%?%p1%{8}%<%t4%p1%d%e%p1%{16}%<%t10%p1%{8}%-%d%e48;5;%p1%d%;m", SetFgBg: "\x1b[%?%p1%{8}%<%t3%p1%d%e%p1%{16}%<%t9%p1%{8}%-%d%e38;5;%p1%d%;;%?%p2%{8}%<%t4%p2%d%e%p2%{16}%<%t10%p2%{8}%-%d%e48;5;%p2%d%;m", ResetFgBg: "\x1b[39;49m", PadChar: "\x00", AltChars: "++,,--..00``aaffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~", EnterAcs: "\x0e", ExitAcs: "\x0f", EnableAcs: "\x1b(B\x1b)0", Mouse: "\x1b[M", SetCursor: "\x1b[%i%p1%d;%p2%dH", CursorBack1: "\b", CursorUp1: "\x1bM", KeyUp: "\x1bOA", KeyDown: "\x1bOB", KeyRight: "\x1bOC", KeyLeft: "\x1bOD", KeyInsert: "\x1b[2~", KeyDelete: "\x1b[3~", KeyBackspace: "\x7f", KeyHome: "\x1b[1~", KeyEnd: "\x1b[4~", KeyPgUp: "\x1b[5~", KeyPgDn: "\x1b[6~", KeyF1: "\x1bOP", KeyF2: "\x1bOQ", KeyF3: "\x1bOR", KeyF4: "\x1bOS", KeyF5: "\x1b[15~", KeyF6: "\x1b[17~", KeyF7: "\x1b[18~", KeyF8: "\x1b[19~", KeyF9: "\x1b[20~", KeyF10: "\x1b[21~", KeyF11: "\x1b[23~", KeyF12: "\x1b[24~", KeyBacktab: "\x1b[Z", AutoMargin: true, }) }
go
MIT
f4fc3669ca8eb67aa350a76503397192bf26f057
2026-01-07T08:35:43.570558Z
false
jesseduffield/lazydocker
https://github.com/jesseduffield/lazydocker/blob/f4fc3669ca8eb67aa350a76503397192bf26f057/vendor/github.com/gdamore/tcell/v2/terminfo/s/simpleterm/term.go
vendor/github.com/gdamore/tcell/v2/terminfo/s/simpleterm/term.go
// Generated automatically. DO NOT HAND-EDIT. package simpleterm import "github.com/gdamore/tcell/v2/terminfo" func init() { // aka simpleterm terminfo.AddTerminfo(&terminfo.Terminfo{ Name: "st", Aliases: []string{"stterm"}, Columns: 80, Lines: 24, Colors: 8, Bell: "\a", Clear: "\x1b[H\x1b[2J", EnterCA: "\x1b[?1049h", ExitCA: "\x1b[?1049l", ShowCursor: "\x1b[?25h", HideCursor: "\x1b[?25l", AttrOff: "\x1b[0m", Underline: "\x1b[4m", Bold: "\x1b[1m", Dim: "\x1b[2m", Italic: "\x1b[3m", Blink: "\x1b[5m", Reverse: "\x1b[7m", EnterKeypad: "\x1b[?1h\x1b=", ExitKeypad: "\x1b[?1l\x1b>", SetFg: "\x1b[3%p1%dm", SetBg: "\x1b[4%p1%dm", SetFgBg: "\x1b[3%p1%d;4%p2%dm", ResetFgBg: "\x1b[39;49m", AltChars: "+C,D-A.B0E``aaffgghFiGjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~", EnterAcs: "\x1b(0", ExitAcs: "\x1b(B", EnableAcs: "\x1b)0", StrikeThrough: "\x1b[9m", Mouse: "\x1b[M", SetCursor: "\x1b[%i%p1%d;%p2%dH", CursorBack1: "\b", CursorUp1: "\x1b[A", KeyUp: "\x1bOA", KeyDown: "\x1bOB", KeyRight: "\x1bOC", KeyLeft: "\x1bOD", KeyInsert: "\x1b[2~", KeyDelete: "\x1b[3~", KeyBackspace: "\x7f", KeyHome: "\x1b[1~", KeyEnd: "\x1b[4~", KeyPgUp: "\x1b[5~", KeyPgDn: "\x1b[6~", KeyF1: "\x1bOP", KeyF2: "\x1bOQ", KeyF3: "\x1bOR", KeyF4: "\x1bOS", KeyF5: "\x1b[15~", KeyF6: "\x1b[17~", KeyF7: "\x1b[18~", KeyF8: "\x1b[19~", KeyF9: "\x1b[20~", KeyF10: "\x1b[21~", KeyF11: "\x1b[23~", KeyF12: "\x1b[24~", KeyClear: "\x1b[3;5~", Modifiers: 1, AutoMargin: true, }) // simpleterm with 256 colors terminfo.AddTerminfo(&terminfo.Terminfo{ Name: "st-256color", Aliases: []string{"stterm-256color"}, Columns: 80, Lines: 24, Colors: 256, Bell: "\a", Clear: "\x1b[H\x1b[2J", EnterCA: "\x1b[?1049h", ExitCA: "\x1b[?1049l", ShowCursor: "\x1b[?25h", HideCursor: "\x1b[?25l", AttrOff: "\x1b[0m", Underline: "\x1b[4m", Bold: "\x1b[1m", Dim: "\x1b[2m", Italic: "\x1b[3m", Blink: "\x1b[5m", Reverse: "\x1b[7m", EnterKeypad: "\x1b[?1h\x1b=", ExitKeypad: "\x1b[?1l\x1b>", SetFg: "\x1b[%?%p1%{8}%<%t3%p1%d%e%p1%{16}%<%t9%p1%{8}%-%d%e38;5;%p1%d%;m", SetBg: "\x1b[%?%p1%{8}%<%t4%p1%d%e%p1%{16}%<%t10%p1%{8}%-%d%e48;5;%p1%d%;m", SetFgBg: "\x1b[%?%p1%{8}%<%t3%p1%d%e%p1%{16}%<%t9%p1%{8}%-%d%e38;5;%p1%d%;;%?%p2%{8}%<%t4%p2%d%e%p2%{16}%<%t10%p2%{8}%-%d%e48;5;%p2%d%;m", ResetFgBg: "\x1b[39;49m", AltChars: "+C,D-A.B0E``aaffgghFiGjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~", EnterAcs: "\x1b(0", ExitAcs: "\x1b(B", EnableAcs: "\x1b)0", StrikeThrough: "\x1b[9m", Mouse: "\x1b[M", SetCursor: "\x1b[%i%p1%d;%p2%dH", CursorBack1: "\b", CursorUp1: "\x1b[A", KeyUp: "\x1bOA", KeyDown: "\x1bOB", KeyRight: "\x1bOC", KeyLeft: "\x1bOD", KeyInsert: "\x1b[2~", KeyDelete: "\x1b[3~", KeyBackspace: "\x7f", KeyHome: "\x1b[1~", KeyEnd: "\x1b[4~", KeyPgUp: "\x1b[5~", KeyPgDn: "\x1b[6~", KeyF1: "\x1bOP", KeyF2: "\x1bOQ", KeyF3: "\x1bOR", KeyF4: "\x1bOS", KeyF5: "\x1b[15~", KeyF6: "\x1b[17~", KeyF7: "\x1b[18~", KeyF8: "\x1b[19~", KeyF9: "\x1b[20~", KeyF10: "\x1b[21~", KeyF11: "\x1b[23~", KeyF12: "\x1b[24~", KeyClear: "\x1b[3;5~", Modifiers: 1, AutoMargin: true, }) }
go
MIT
f4fc3669ca8eb67aa350a76503397192bf26f057
2026-01-07T08:35:43.570558Z
false
jesseduffield/lazydocker
https://github.com/jesseduffield/lazydocker/blob/f4fc3669ca8eb67aa350a76503397192bf26f057/vendor/github.com/gdamore/tcell/v2/terminfo/s/sun/term.go
vendor/github.com/gdamore/tcell/v2/terminfo/s/sun/term.go
// Copyright 2021 The TCell Authors // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use 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. // This terminal definition is hand-coded, as the default terminfo for // this terminal is busted with respect to color. Unlike pretty much every // other ANSI compliant terminal, this terminal cannot combine foreground and // background escapes. The default terminfo also only provides escapes for // 16-bit color. package sun import "github.com/gdamore/tcell/v2/terminfo" func init() { // Sun Microsystems Inc. workstation console terminfo.AddTerminfo(&terminfo.Terminfo{ Name: "sun", Aliases: []string{"sun1", "sun2"}, Columns: 80, Lines: 34, Bell: "\a", Clear: "\f", AttrOff: "\x1b[m", Reverse: "\x1b[7m", PadChar: "\x00", SetCursor: "\x1b[%i%p1%d;%p2%dH", CursorBack1: "\b", CursorUp1: "\x1b[A", KeyUp: "\x1b[A", KeyDown: "\x1b[B", KeyRight: "\x1b[C", KeyLeft: "\x1b[D", KeyInsert: "\x1b[247z", KeyDelete: "\u007f", KeyBackspace: "\b", KeyHome: "\x1b[214z", KeyEnd: "\x1b[220z", KeyPgUp: "\x1b[216z", KeyPgDn: "\x1b[222z", KeyF1: "\x1b[224z", KeyF2: "\x1b[225z", KeyF3: "\x1b[226z", KeyF4: "\x1b[227z", KeyF5: "\x1b[228z", KeyF6: "\x1b[229z", KeyF7: "\x1b[230z", KeyF8: "\x1b[231z", KeyF9: "\x1b[232z", KeyF10: "\x1b[233z", KeyF11: "\x1b[234z", KeyF12: "\x1b[235z", AutoMargin: true, InsertChar: "\x1b[@", }) // Sun Microsystems Workstation console with color support (IA systems) terminfo.AddTerminfo(&terminfo.Terminfo{ Name: "sun-color", Columns: 80, Lines: 34, Colors: 256, Bell: "\a", Clear: "\f", AttrOff: "\x1b[m", Bold: "\x1b[1m", Reverse: "\x1b[7m", SetFg: "\x1b[38;5;%p1%dm", SetBg: "\x1b[48;5;%p1%dm", ResetFgBg: "\x1b[0m", PadChar: "\x00", SetCursor: "\x1b[%i%p1%d;%p2%dH", CursorBack1: "\b", CursorUp1: "\x1b[A", KeyUp: "\x1b[A", KeyDown: "\x1b[B", KeyRight: "\x1b[C", KeyLeft: "\x1b[D", KeyInsert: "\x1b[247z", KeyDelete: "\u007f", KeyBackspace: "\b", KeyHome: "\x1b[214z", KeyEnd: "\x1b[220z", KeyPgUp: "\x1b[216z", KeyPgDn: "\x1b[222z", KeyF1: "\x1b[224z", KeyF2: "\x1b[225z", KeyF3: "\x1b[226z", KeyF4: "\x1b[227z", KeyF5: "\x1b[228z", KeyF6: "\x1b[229z", KeyF7: "\x1b[230z", KeyF8: "\x1b[231z", KeyF9: "\x1b[232z", KeyF10: "\x1b[233z", KeyF11: "\x1b[234z", KeyF12: "\x1b[235z", AutoMargin: true, InsertChar: "\x1b[@", }) }
go
MIT
f4fc3669ca8eb67aa350a76503397192bf26f057
2026-01-07T08:35:43.570558Z
false
jesseduffield/lazydocker
https://github.com/jesseduffield/lazydocker/blob/f4fc3669ca8eb67aa350a76503397192bf26f057/vendor/github.com/gdamore/tcell/v2/terminfo/g/gnome/term.go
vendor/github.com/gdamore/tcell/v2/terminfo/g/gnome/term.go
// Generated automatically. DO NOT HAND-EDIT. package gnome import "github.com/gdamore/tcell/v2/terminfo" func init() { // GNOME Terminal terminfo.AddTerminfo(&terminfo.Terminfo{ Name: "gnome", Columns: 80, Lines: 24, Colors: 8, Bell: "\a", Clear: "\x1b[H\x1b[2J", EnterCA: "\x1b7\x1b[?47h", ExitCA: "\x1b[2J\x1b[?47l\x1b8", ShowCursor: "\x1b[?25h", HideCursor: "\x1b[?25l", AttrOff: "\x1b[0m\x0f", Underline: "\x1b[4m", Bold: "\x1b[1m", Dim: "\x1b[2m", Italic: "\x1b[3m", Reverse: "\x1b[7m", EnterKeypad: "\x1b[?1h\x1b=", ExitKeypad: "\x1b[?1l\x1b>", SetFg: "\x1b[3%p1%dm", SetBg: "\x1b[4%p1%dm", SetFgBg: "\x1b[3%p1%d;4%p2%dm", ResetFgBg: "\x1b[39;49m", PadChar: "\x00", AltChars: "``aaffggiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~", EnterAcs: "\x0e", ExitAcs: "\x0f", EnableAcs: "\x1b)0", EnableAutoMargin: "\x1b[?7h", DisableAutoMargin: "\x1b[?7l", Mouse: "\x1b[M", SetCursor: "\x1b[%i%p1%d;%p2%dH", CursorBack1: "\b", CursorUp1: "\x1b[A", KeyUp: "\x1bOA", KeyDown: "\x1bOB", KeyRight: "\x1bOC", KeyLeft: "\x1bOD", KeyInsert: "\x1b[2~", KeyDelete: "\x1b[3~", KeyBackspace: "\x7f", KeyHome: "\x1bOH", KeyEnd: "\x1bOF", KeyPgUp: "\x1b[5~", KeyPgDn: "\x1b[6~", KeyF1: "\x1bOP", KeyF2: "\x1bOQ", KeyF3: "\x1bOR", KeyF4: "\x1bOS", KeyF5: "\x1b[15~", KeyF6: "\x1b[17~", KeyF7: "\x1b[18~", KeyF8: "\x1b[19~", KeyF9: "\x1b[20~", KeyF10: "\x1b[21~", KeyF11: "\x1b[23~", KeyF12: "\x1b[24~", KeyBacktab: "\x1b[Z", Modifiers: 1, AutoMargin: true, }) // GNOME Terminal with xterm 256-colors terminfo.AddTerminfo(&terminfo.Terminfo{ Name: "gnome-256color", Columns: 80, Lines: 24, Colors: 256, Bell: "\a", Clear: "\x1b[H\x1b[2J", EnterCA: "\x1b7\x1b[?47h", ExitCA: "\x1b[2J\x1b[?47l\x1b8", ShowCursor: "\x1b[?25h", HideCursor: "\x1b[?25l", AttrOff: "\x1b[0m\x0f", Underline: "\x1b[4m", Bold: "\x1b[1m", Dim: "\x1b[2m", Italic: "\x1b[3m", Reverse: "\x1b[7m", EnterKeypad: "\x1b[?1h\x1b=", ExitKeypad: "\x1b[?1l\x1b>", SetFg: "\x1b[%?%p1%{8}%<%t3%p1%d%e%p1%{16}%<%t9%p1%{8}%-%d%e38;5;%p1%d%;m", SetBg: "\x1b[%?%p1%{8}%<%t4%p1%d%e%p1%{16}%<%t10%p1%{8}%-%d%e48;5;%p1%d%;m", SetFgBg: "\x1b[%?%p1%{8}%<%t3%p1%d%e%p1%{16}%<%t9%p1%{8}%-%d%e38;5;%p1%d%;;%?%p2%{8}%<%t4%p2%d%e%p2%{16}%<%t10%p2%{8}%-%d%e48;5;%p2%d%;m", ResetFgBg: "\x1b[39;49m", PadChar: "\x00", AltChars: "``aaffggiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~", EnterAcs: "\x0e", ExitAcs: "\x0f", EnableAcs: "\x1b)0", EnableAutoMargin: "\x1b[?7h", DisableAutoMargin: "\x1b[?7l", Mouse: "\x1b[M", SetCursor: "\x1b[%i%p1%d;%p2%dH", CursorBack1: "\b", CursorUp1: "\x1b[A", KeyUp: "\x1bOA", KeyDown: "\x1bOB", KeyRight: "\x1bOC", KeyLeft: "\x1bOD", KeyInsert: "\x1b[2~", KeyDelete: "\x1b[3~", KeyBackspace: "\x7f", KeyHome: "\x1bOH", KeyEnd: "\x1bOF", KeyPgUp: "\x1b[5~", KeyPgDn: "\x1b[6~", KeyF1: "\x1bOP", KeyF2: "\x1bOQ", KeyF3: "\x1bOR", KeyF4: "\x1bOS", KeyF5: "\x1b[15~", KeyF6: "\x1b[17~", KeyF7: "\x1b[18~", KeyF8: "\x1b[19~", KeyF9: "\x1b[20~", KeyF10: "\x1b[21~", KeyF11: "\x1b[23~", KeyF12: "\x1b[24~", KeyBacktab: "\x1b[Z", Modifiers: 1, AutoMargin: true, }) }
go
MIT
f4fc3669ca8eb67aa350a76503397192bf26f057
2026-01-07T08:35:43.570558Z
false
jesseduffield/lazydocker
https://github.com/jesseduffield/lazydocker/blob/f4fc3669ca8eb67aa350a76503397192bf26f057/vendor/github.com/gdamore/tcell/v2/terminfo/dynamic/dynamic.go
vendor/github.com/gdamore/tcell/v2/terminfo/dynamic/dynamic.go
// Copyright 2021 The TCell Authors // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use 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. // The dynamic package is used to generate a terminal description dynamically, // using infocmp. This is really a method of last resort, as the performance // will be slow, and it requires a working infocmp. But, the hope is that it // will assist folks who have to deal with a terminal description that isn't // already built in. This requires infocmp to be in the user's path, and to // support reasonably the -1 option. package dynamic import ( "bytes" "errors" "os/exec" "regexp" "strconv" "strings" "github.com/gdamore/tcell/v2/terminfo" ) type termcap struct { name string desc string aliases []string bools map[string]bool nums map[string]int strs map[string]string } func (tc *termcap) getnum(s string) int { return (tc.nums[s]) } func (tc *termcap) getflag(s string) bool { return (tc.bools[s]) } func (tc *termcap) getstr(s string) string { return (tc.strs[s]) } const ( none = iota control escaped ) var errNotAddressable = errors.New("terminal not cursor addressable") func unescape(s string) string { // Various escapes are in \x format. Control codes are // encoded as ^M (carat followed by ASCII equivalent). // escapes are: \e, \E - escape // \0 NULL, \n \l \r \t \b \f \s for equivalent C escape. buf := &bytes.Buffer{} esc := none for i := 0; i < len(s); i++ { c := s[i] switch esc { case none: switch c { case '\\': esc = escaped case '^': esc = control default: buf.WriteByte(c) } case control: buf.WriteByte(c ^ 1<<6) esc = none case escaped: switch c { case 'E', 'e': buf.WriteByte(0x1b) case '0', '1', '2', '3', '4', '5', '6', '7': if i+2 < len(s) && s[i+1] >= '0' && s[i+1] <= '7' && s[i+2] >= '0' && s[i+2] <= '7' { buf.WriteByte(((c - '0') * 64) + ((s[i+1] - '0') * 8) + (s[i+2] - '0')) i = i + 2 } else if c == '0' { buf.WriteByte(0) } case 'n': buf.WriteByte('\n') case 'r': buf.WriteByte('\r') case 't': buf.WriteByte('\t') case 'b': buf.WriteByte('\b') case 'f': buf.WriteByte('\f') case 's': buf.WriteByte(' ') default: buf.WriteByte(c) } esc = none } } return (buf.String()) } func (tc *termcap) setupterm(name string) error { cmd := exec.Command("infocmp", "-1", name) output := &bytes.Buffer{} cmd.Stdout = output tc.strs = make(map[string]string) tc.bools = make(map[string]bool) tc.nums = make(map[string]int) if err := cmd.Run(); err != nil { return err } // Now parse the output. // We get comment lines (starting with "#"), followed by // a header line that looks like "<name>|<alias>|...|<desc>" // then capabilities, one per line, starting with a tab and ending // with a comma and newline. lines := strings.Split(output.String(), "\n") for len(lines) > 0 && strings.HasPrefix(lines[0], "#") { lines = lines[1:] } // Ditch trailing empty last line if lines[len(lines)-1] == "" { lines = lines[:len(lines)-1] } header := lines[0] if strings.HasSuffix(header, ",") { header = header[:len(header)-1] } names := strings.Split(header, "|") tc.name = names[0] names = names[1:] if len(names) > 0 { tc.desc = names[len(names)-1] names = names[:len(names)-1] } tc.aliases = names for _, val := range lines[1:] { if (!strings.HasPrefix(val, "\t")) || (!strings.HasSuffix(val, ",")) { return (errors.New("malformed infocmp: " + val)) } val = val[1:] val = val[:len(val)-1] if k := strings.SplitN(val, "=", 2); len(k) == 2 { tc.strs[k[0]] = unescape(k[1]) } else if k := strings.SplitN(val, "#", 2); len(k) == 2 { u, err := strconv.ParseUint(k[1], 0, 0) if err != nil { return (err) } tc.nums[k[0]] = int(u) } else { tc.bools[val] = true } } return nil } // LoadTerminfo creates a Terminfo by for named terminal by attempting to parse // the output from infocmp. This returns the terminfo entry, a description of // the terminal, and either nil or an error. func LoadTerminfo(name string) (*terminfo.Terminfo, string, error) { var tc termcap if err := tc.setupterm(name); err != nil { return nil, "", err } t := &terminfo.Terminfo{} t.Name = tc.name t.Aliases = tc.aliases t.Colors = tc.getnum("colors") t.Columns = tc.getnum("cols") t.Lines = tc.getnum("lines") t.Bell = tc.getstr("bel") t.Clear = tc.getstr("clear") t.EnterCA = tc.getstr("smcup") t.ExitCA = tc.getstr("rmcup") t.ShowCursor = tc.getstr("cnorm") t.HideCursor = tc.getstr("civis") t.AttrOff = tc.getstr("sgr0") t.Underline = tc.getstr("smul") t.Bold = tc.getstr("bold") t.Blink = tc.getstr("blink") t.Dim = tc.getstr("dim") t.Italic = tc.getstr("sitm") t.Reverse = tc.getstr("rev") t.EnterKeypad = tc.getstr("smkx") t.ExitKeypad = tc.getstr("rmkx") t.SetFg = tc.getstr("setaf") t.SetBg = tc.getstr("setab") t.SetCursor = tc.getstr("cup") t.CursorBack1 = tc.getstr("cub1") t.CursorUp1 = tc.getstr("cuu1") t.KeyF1 = tc.getstr("kf1") t.KeyF2 = tc.getstr("kf2") t.KeyF3 = tc.getstr("kf3") t.KeyF4 = tc.getstr("kf4") t.KeyF5 = tc.getstr("kf5") t.KeyF6 = tc.getstr("kf6") t.KeyF7 = tc.getstr("kf7") t.KeyF8 = tc.getstr("kf8") t.KeyF9 = tc.getstr("kf9") t.KeyF10 = tc.getstr("kf10") t.KeyF11 = tc.getstr("kf11") t.KeyF12 = tc.getstr("kf12") t.KeyF13 = tc.getstr("kf13") t.KeyF14 = tc.getstr("kf14") t.KeyF15 = tc.getstr("kf15") t.KeyF16 = tc.getstr("kf16") t.KeyF17 = tc.getstr("kf17") t.KeyF18 = tc.getstr("kf18") t.KeyF19 = tc.getstr("kf19") t.KeyF20 = tc.getstr("kf20") t.KeyF21 = tc.getstr("kf21") t.KeyF22 = tc.getstr("kf22") t.KeyF23 = tc.getstr("kf23") t.KeyF24 = tc.getstr("kf24") t.KeyF25 = tc.getstr("kf25") t.KeyF26 = tc.getstr("kf26") t.KeyF27 = tc.getstr("kf27") t.KeyF28 = tc.getstr("kf28") t.KeyF29 = tc.getstr("kf29") t.KeyF30 = tc.getstr("kf30") t.KeyF31 = tc.getstr("kf31") t.KeyF32 = tc.getstr("kf32") t.KeyF33 = tc.getstr("kf33") t.KeyF34 = tc.getstr("kf34") t.KeyF35 = tc.getstr("kf35") t.KeyF36 = tc.getstr("kf36") t.KeyF37 = tc.getstr("kf37") t.KeyF38 = tc.getstr("kf38") t.KeyF39 = tc.getstr("kf39") t.KeyF40 = tc.getstr("kf40") t.KeyF41 = tc.getstr("kf41") t.KeyF42 = tc.getstr("kf42") t.KeyF43 = tc.getstr("kf43") t.KeyF44 = tc.getstr("kf44") t.KeyF45 = tc.getstr("kf45") t.KeyF46 = tc.getstr("kf46") t.KeyF47 = tc.getstr("kf47") t.KeyF48 = tc.getstr("kf48") t.KeyF49 = tc.getstr("kf49") t.KeyF50 = tc.getstr("kf50") t.KeyF51 = tc.getstr("kf51") t.KeyF52 = tc.getstr("kf52") t.KeyF53 = tc.getstr("kf53") t.KeyF54 = tc.getstr("kf54") t.KeyF55 = tc.getstr("kf55") t.KeyF56 = tc.getstr("kf56") t.KeyF57 = tc.getstr("kf57") t.KeyF58 = tc.getstr("kf58") t.KeyF59 = tc.getstr("kf59") t.KeyF60 = tc.getstr("kf60") t.KeyF61 = tc.getstr("kf61") t.KeyF62 = tc.getstr("kf62") t.KeyF63 = tc.getstr("kf63") t.KeyF64 = tc.getstr("kf64") t.KeyInsert = tc.getstr("kich1") t.KeyDelete = tc.getstr("kdch1") t.KeyBackspace = tc.getstr("kbs") t.KeyHome = tc.getstr("khome") t.KeyEnd = tc.getstr("kend") t.KeyUp = tc.getstr("kcuu1") t.KeyDown = tc.getstr("kcud1") t.KeyRight = tc.getstr("kcuf1") t.KeyLeft = tc.getstr("kcub1") t.KeyPgDn = tc.getstr("knp") t.KeyPgUp = tc.getstr("kpp") t.KeyBacktab = tc.getstr("kcbt") t.KeyExit = tc.getstr("kext") t.KeyCancel = tc.getstr("kcan") t.KeyPrint = tc.getstr("kprt") t.KeyHelp = tc.getstr("khlp") t.KeyClear = tc.getstr("kclr") t.AltChars = tc.getstr("acsc") t.EnterAcs = tc.getstr("smacs") t.ExitAcs = tc.getstr("rmacs") t.EnableAcs = tc.getstr("enacs") t.Mouse = tc.getstr("kmous") t.KeyShfRight = tc.getstr("kRIT") t.KeyShfLeft = tc.getstr("kLFT") t.KeyShfHome = tc.getstr("kHOM") t.KeyShfEnd = tc.getstr("kEND") // Terminfo lacks descriptions for a bunch of modified keys, // but modern XTerm and emulators often have them. Let's add them, // if the shifted right and left arrows are defined. if t.KeyShfRight == "\x1b[1;2C" && t.KeyShfLeft == "\x1b[1;2D" { t.Modifiers = terminfo.ModifiersXTerm t.KeyShfUp = "\x1b[1;2A" t.KeyShfDown = "\x1b[1;2B" t.KeyMetaUp = "\x1b[1;9A" t.KeyMetaDown = "\x1b[1;9B" t.KeyMetaRight = "\x1b[1;9C" t.KeyMetaLeft = "\x1b[1;9D" t.KeyAltUp = "\x1b[1;3A" t.KeyAltDown = "\x1b[1;3B" t.KeyAltRight = "\x1b[1;3C" t.KeyAltLeft = "\x1b[1;3D" t.KeyCtrlUp = "\x1b[1;5A" t.KeyCtrlDown = "\x1b[1;5B" t.KeyCtrlRight = "\x1b[1;5C" t.KeyCtrlLeft = "\x1b[1;5D" t.KeyAltShfUp = "\x1b[1;4A" t.KeyAltShfDown = "\x1b[1;4B" t.KeyAltShfRight = "\x1b[1;4C" t.KeyAltShfLeft = "\x1b[1;4D" t.KeyMetaShfUp = "\x1b[1;10A" t.KeyMetaShfDown = "\x1b[1;10B" t.KeyMetaShfRight = "\x1b[1;10C" t.KeyMetaShfLeft = "\x1b[1;10D" t.KeyCtrlShfUp = "\x1b[1;6A" t.KeyCtrlShfDown = "\x1b[1;6B" t.KeyCtrlShfRight = "\x1b[1;6C" t.KeyCtrlShfLeft = "\x1b[1;6D" t.KeyShfPgUp = "\x1b[5;2~" t.KeyShfPgDn = "\x1b[6;2~" } // And also for Home and End if t.KeyShfHome == "\x1b[1;2H" && t.KeyShfEnd == "\x1b[1;2F" { t.KeyCtrlHome = "\x1b[1;5H" t.KeyCtrlEnd = "\x1b[1;5F" t.KeyAltHome = "\x1b[1;9H" t.KeyAltEnd = "\x1b[1;9F" t.KeyCtrlShfHome = "\x1b[1;6H" t.KeyCtrlShfEnd = "\x1b[1;6F" t.KeyAltShfHome = "\x1b[1;4H" t.KeyAltShfEnd = "\x1b[1;4F" t.KeyMetaShfHome = "\x1b[1;10H" t.KeyMetaShfEnd = "\x1b[1;10F" } // And the same thing for rxvt and workalikes (Eterm, aterm, etc.) // It seems that urxvt at least send escaped as ALT prefix for these, // although some places seem to indicate a separate ALT key sesquence. if t.KeyShfRight == "\x1b[c" && t.KeyShfLeft == "\x1b[d" { t.KeyShfUp = "\x1b[a" t.KeyShfDown = "\x1b[b" t.KeyCtrlUp = "\x1b[Oa" t.KeyCtrlDown = "\x1b[Ob" t.KeyCtrlRight = "\x1b[Oc" t.KeyCtrlLeft = "\x1b[Od" } if t.KeyShfHome == "\x1b[7$" && t.KeyShfEnd == "\x1b[8$" { t.KeyCtrlHome = "\x1b[7^" t.KeyCtrlEnd = "\x1b[8^" } // Technically the RGB flag that is provided for xterm-direct is not // quite right. The problem is that the -direct flag that was introduced // with ncurses 6.1 requires a parsing for the parameters that we lack. // For this case we'll just assume it's XTerm compatible. Someday this // may be incorrect, but right now it is correct, and nobody uses it // anyway. if tc.getflag("Tc") { // This presumes XTerm 24-bit true color. t.TrueColor = true } else if tc.getflag("RGB") { // This is for xterm-direct, which uses a different scheme entirely. // (ncurses went a very different direction from everyone else, and // so it's unlikely anything is using this definition.) t.TrueColor = true t.SetBg = "\x1b[%?%p1%{8}%<%t4%p1%d%e%p1%{16}%<%t10%p1%{8}%-%d%e48;5;%p1%d%;m" t.SetFg = "\x1b[%?%p1%{8}%<%t3%p1%d%e%p1%{16}%<%t9%p1%{8}%-%d%e38;5;%p1%d%;m" } // We only support colors in ANSI 8 or 256 color mode. if t.Colors < 8 || t.SetFg == "" { t.Colors = 0 } if t.SetCursor == "" { return nil, "", errNotAddressable } // For padding, we lookup the pad char. If that isn't present, // and npc is *not* set, then we assume a null byte. t.PadChar = tc.getstr("pad") if t.PadChar == "" { if !tc.getflag("npc") { t.PadChar = "\u0000" } } // For terminals that use "standard" SGR sequences, lets combine the // foreground and background together. if strings.HasPrefix(t.SetFg, "\x1b[") && strings.HasPrefix(t.SetBg, "\x1b[") && strings.HasSuffix(t.SetFg, "m") && strings.HasSuffix(t.SetBg, "m") { fg := t.SetFg[:len(t.SetFg)-1] r := regexp.MustCompile("%p1") bg := r.ReplaceAllString(t.SetBg[2:], "%p2") t.SetFgBg = fg + ";" + bg } return t, tc.desc, nil }
go
MIT
f4fc3669ca8eb67aa350a76503397192bf26f057
2026-01-07T08:35:43.570558Z
false
jesseduffield/lazydocker
https://github.com/jesseduffield/lazydocker/blob/f4fc3669ca8eb67aa350a76503397192bf26f057/vendor/github.com/gdamore/tcell/v2/terminfo/l/linux/term.go
vendor/github.com/gdamore/tcell/v2/terminfo/l/linux/term.go
// Generated automatically. DO NOT HAND-EDIT. package linux import "github.com/gdamore/tcell/v2/terminfo" func init() { // Linux console terminfo.AddTerminfo(&terminfo.Terminfo{ Name: "linux", Colors: 8, Bell: "\a", Clear: "\x1b[H\x1b[J", ShowCursor: "\x1b[?25h\x1b[?0c", HideCursor: "\x1b[?25l\x1b[?1c", AttrOff: "\x1b[m\x0f", Underline: "\x1b[4m", Bold: "\x1b[1m", Dim: "\x1b[2m", Blink: "\x1b[5m", Reverse: "\x1b[7m", SetFg: "\x1b[3%p1%dm", SetBg: "\x1b[4%p1%dm", SetFgBg: "\x1b[3%p1%d;4%p2%dm", ResetFgBg: "\x1b[39;49m", PadChar: "\x00", AltChars: "++,,--..00``aaffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~", EnterAcs: "\x0e", ExitAcs: "\x0f", EnableAcs: "\x1b)0", EnableAutoMargin: "\x1b[?7h", DisableAutoMargin: "\x1b[?7l", Mouse: "\x1b[M", SetCursor: "\x1b[%i%p1%d;%p2%dH", CursorBack1: "\b", CursorUp1: "\x1b[A", KeyUp: "\x1b[A", KeyDown: "\x1b[B", KeyRight: "\x1b[C", KeyLeft: "\x1b[D", KeyInsert: "\x1b[2~", KeyDelete: "\x1b[3~", KeyBackspace: "\x7f", KeyHome: "\x1b[1~", KeyEnd: "\x1b[4~", KeyPgUp: "\x1b[5~", KeyPgDn: "\x1b[6~", KeyF1: "\x1b[[A", KeyF2: "\x1b[[B", KeyF3: "\x1b[[C", KeyF4: "\x1b[[D", KeyF5: "\x1b[[E", KeyF6: "\x1b[17~", KeyF7: "\x1b[18~", KeyF8: "\x1b[19~", KeyF9: "\x1b[20~", KeyF10: "\x1b[21~", KeyF11: "\x1b[23~", KeyF12: "\x1b[24~", KeyF13: "\x1b[25~", KeyF14: "\x1b[26~", KeyF15: "\x1b[28~", KeyF16: "\x1b[29~", KeyF17: "\x1b[31~", KeyF18: "\x1b[32~", KeyF19: "\x1b[33~", KeyF20: "\x1b[34~", KeyBacktab: "\x1b\t", AutoMargin: true, InsertChar: "\x1b[@", }) }
go
MIT
f4fc3669ca8eb67aa350a76503397192bf26f057
2026-01-07T08:35:43.570558Z
false
jesseduffield/lazydocker
https://github.com/jesseduffield/lazydocker/blob/f4fc3669ca8eb67aa350a76503397192bf26f057/vendor/github.com/gdamore/tcell/v2/terminfo/p/pcansi/term.go
vendor/github.com/gdamore/tcell/v2/terminfo/p/pcansi/term.go
// Generated automatically. DO NOT HAND-EDIT. package pcansi import "github.com/gdamore/tcell/v2/terminfo" func init() { // ibm-pc terminal programs claiming to be ANSI terminfo.AddTerminfo(&terminfo.Terminfo{ Name: "pcansi", Columns: 80, Lines: 24, Colors: 8, Bell: "\a", Clear: "\x1b[H\x1b[J", AttrOff: "\x1b[0;10m", Underline: "\x1b[4m", Bold: "\x1b[1m", Blink: "\x1b[5m", Reverse: "\x1b[7m", SetFg: "\x1b[3%p1%dm", SetBg: "\x1b[4%p1%dm", SetFgBg: "\x1b[3%p1%d;4%p2%dm", ResetFgBg: "\x1b[37;40m", PadChar: "\x00", AltChars: "+\x10,\x11-\x18.\x190\xdb`\x04a\xb1f\xf8g\xf1h\xb0j\xd9k\xbfl\xdam\xc0n\xc5o~p\xc4q\xc4r\xc4s_t\xc3u\xb4v\xc1w\xc2x\xb3y\xf3z\xf2{\xe3|\xd8}\x9c~\xfe", EnterAcs: "\x1b[12m", ExitAcs: "\x1b[10m", SetCursor: "\x1b[%i%p1%d;%p2%dH", CursorBack1: "\x1b[D", CursorUp1: "\x1b[A", KeyUp: "\x1b[A", KeyDown: "\x1b[B", KeyRight: "\x1b[C", KeyLeft: "\x1b[D", KeyBackspace: "\b", KeyHome: "\x1b[H", AutoMargin: true, }) }
go
MIT
f4fc3669ca8eb67aa350a76503397192bf26f057
2026-01-07T08:35:43.570558Z
false
jesseduffield/lazydocker
https://github.com/jesseduffield/lazydocker/blob/f4fc3669ca8eb67aa350a76503397192bf26f057/vendor/github.com/gdamore/tcell/v2/terminfo/v/vt102/term.go
vendor/github.com/gdamore/tcell/v2/terminfo/v/vt102/term.go
// Generated automatically. DO NOT HAND-EDIT. package vt102 import "github.com/gdamore/tcell/v2/terminfo" func init() { // DEC VT102 terminfo.AddTerminfo(&terminfo.Terminfo{ Name: "vt102", Columns: 80, Lines: 24, Bell: "\a", Clear: "\x1b[H\x1b[J$<50>", AttrOff: "\x1b[m\x0f$<2>", Underline: "\x1b[4m$<2>", Bold: "\x1b[1m$<2>", Blink: "\x1b[5m$<2>", Reverse: "\x1b[7m$<2>", EnterKeypad: "\x1b[?1h\x1b=", ExitKeypad: "\x1b[?1l\x1b>", PadChar: "\x00", AltChars: "``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~", EnterAcs: "\x0e", ExitAcs: "\x0f", EnableAcs: "\x1b(B\x1b)0", EnableAutoMargin: "\x1b[?7h", DisableAutoMargin: "\x1b[?7l", SetCursor: "\x1b[%i%p1%d;%p2%dH$<5>", CursorBack1: "\b", CursorUp1: "\x1b[A$<2>", KeyUp: "\x1bOA", KeyDown: "\x1bOB", KeyRight: "\x1bOC", KeyLeft: "\x1bOD", KeyBackspace: "\b", KeyF1: "\x1bOP", KeyF2: "\x1bOQ", KeyF3: "\x1bOR", KeyF4: "\x1bOS", KeyF5: "\x1bOt", KeyF6: "\x1bOu", KeyF7: "\x1bOv", KeyF8: "\x1bOl", KeyF9: "\x1bOw", KeyF10: "\x1bOx", AutoMargin: true, }) }
go
MIT
f4fc3669ca8eb67aa350a76503397192bf26f057
2026-01-07T08:35:43.570558Z
false
jesseduffield/lazydocker
https://github.com/jesseduffield/lazydocker/blob/f4fc3669ca8eb67aa350a76503397192bf26f057/vendor/github.com/gdamore/tcell/v2/terminfo/v/vt220/term.go
vendor/github.com/gdamore/tcell/v2/terminfo/v/vt220/term.go
// Generated automatically. DO NOT HAND-EDIT. package vt220 import "github.com/gdamore/tcell/v2/terminfo" func init() { // DEC VT220 terminfo.AddTerminfo(&terminfo.Terminfo{ Name: "vt220", Aliases: []string{"vt200"}, Columns: 80, Lines: 24, Bell: "\a", Clear: "\x1b[H\x1b[J", ShowCursor: "\x1b[?25h", HideCursor: "\x1b[?25l", AttrOff: "\x1b[m\x1b(B", Underline: "\x1b[4m", Bold: "\x1b[1m", Blink: "\x1b[5m", Reverse: "\x1b[7m", PadChar: "\x00", AltChars: "``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~", EnterAcs: "\x1b(0$<2>", ExitAcs: "\x1b(B$<4>", EnableAcs: "\x1b)0", EnableAutoMargin: "\x1b[?7h", DisableAutoMargin: "\x1b[?7l", SetCursor: "\x1b[%i%p1%d;%p2%dH", CursorBack1: "\b", CursorUp1: "\x1b[A", KeyUp: "\x1b[A", KeyDown: "\x1b[B", KeyRight: "\x1b[C", KeyLeft: "\x1b[D", KeyInsert: "\x1b[2~", KeyDelete: "\x1b[3~", KeyBackspace: "\b", KeyPgUp: "\x1b[5~", KeyPgDn: "\x1b[6~", KeyF1: "\x1bOP", KeyF2: "\x1bOQ", KeyF3: "\x1bOR", KeyF4: "\x1bOS", KeyF6: "\x1b[17~", KeyF7: "\x1b[18~", KeyF8: "\x1b[19~", KeyF9: "\x1b[20~", KeyF10: "\x1b[21~", KeyF11: "\x1b[23~", KeyF12: "\x1b[24~", KeyF13: "\x1b[25~", KeyF14: "\x1b[26~", KeyF17: "\x1b[31~", KeyF18: "\x1b[32~", KeyF19: "\x1b[33~", KeyF20: "\x1b[34~", KeyHelp: "\x1b[28~", AutoMargin: true, }) }
go
MIT
f4fc3669ca8eb67aa350a76503397192bf26f057
2026-01-07T08:35:43.570558Z
false
jesseduffield/lazydocker
https://github.com/jesseduffield/lazydocker/blob/f4fc3669ca8eb67aa350a76503397192bf26f057/vendor/github.com/gdamore/tcell/v2/terminfo/v/vt420/term.go
vendor/github.com/gdamore/tcell/v2/terminfo/v/vt420/term.go
// Generated automatically. DO NOT HAND-EDIT. package vt420 import "github.com/gdamore/tcell/v2/terminfo" func init() { // DEC VT420 terminfo.AddTerminfo(&terminfo.Terminfo{ Name: "vt420", Columns: 80, Lines: 24, Bell: "\a", Clear: "\x1b[H\x1b[2J$<50>", ShowCursor: "\x1b[?25h", HideCursor: "\x1b[?25l", AttrOff: "\x1b[m\x1b(B$<2>", Underline: "\x1b[4m", Bold: "\x1b[1m$<2>", Blink: "\x1b[5m$<2>", Reverse: "\x1b[7m$<2>", EnterKeypad: "\x1b=", ExitKeypad: "\x1b>", PadChar: "\x00", AltChars: "``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~", EnterAcs: "\x1b(0$<2>", ExitAcs: "\x1b(B$<4>", EnableAcs: "\x1b)0", EnableAutoMargin: "\x1b[?7h", DisableAutoMargin: "\x1b[?7l", SetCursor: "\x1b[%i%p1%d;%p2%dH$<10>", CursorBack1: "\b", CursorUp1: "\x1b[A", KeyUp: "\x1b[A", KeyDown: "\x1b[B", KeyRight: "\x1b[C", KeyLeft: "\x1b[D", KeyInsert: "\x1b[2~", KeyDelete: "\x1b[3~", KeyBackspace: "\b", KeyPgUp: "\x1b[5~", KeyPgDn: "\x1b[6~", KeyF1: "\x1bOP", KeyF2: "\x1bOQ", KeyF3: "\x1bOR", KeyF4: "\x1bOS", KeyF5: "\x1b[17~", KeyF6: "\x1b[18~", KeyF7: "\x1b[19~", KeyF8: "\x1b[20~", KeyF9: "\x1b[21~", KeyF10: "\x1b[29~", AutoMargin: true, }) }
go
MIT
f4fc3669ca8eb67aa350a76503397192bf26f057
2026-01-07T08:35:43.570558Z
false
jesseduffield/lazydocker
https://github.com/jesseduffield/lazydocker/blob/f4fc3669ca8eb67aa350a76503397192bf26f057/vendor/github.com/gdamore/tcell/v2/terminfo/v/vt52/term.go
vendor/github.com/gdamore/tcell/v2/terminfo/v/vt52/term.go
// Generated automatically. DO NOT HAND-EDIT. package vt52 import "github.com/gdamore/tcell/v2/terminfo" func init() { // DEC VT52 terminfo.AddTerminfo(&terminfo.Terminfo{ Name: "vt52", Columns: 80, Lines: 24, Bell: "\a", Clear: "\x1bH\x1bJ", EnterKeypad: "\x1b=", ExitKeypad: "\x1b>", PadChar: "\x00", AltChars: "+h.k0affggolpnqprrss", EnterAcs: "\x1bF", ExitAcs: "\x1bG", SetCursor: "\x1bY%p1%' '%+%c%p2%' '%+%c", CursorBack1: "\x1bD", CursorUp1: "\x1bA", KeyUp: "\x1bA", KeyDown: "\x1bB", KeyRight: "\x1bC", KeyLeft: "\x1bD", KeyBackspace: "\b", KeyF1: "\x1bP", KeyF2: "\x1bQ", KeyF3: "\x1bR", KeyF5: "\x1b?t", KeyF6: "\x1b?u", KeyF7: "\x1b?v", KeyF8: "\x1b?w", KeyF9: "\x1b?x", }) }
go
MIT
f4fc3669ca8eb67aa350a76503397192bf26f057
2026-01-07T08:35:43.570558Z
false
jesseduffield/lazydocker
https://github.com/jesseduffield/lazydocker/blob/f4fc3669ca8eb67aa350a76503397192bf26f057/vendor/github.com/gdamore/tcell/v2/terminfo/v/vt100/term.go
vendor/github.com/gdamore/tcell/v2/terminfo/v/vt100/term.go
// Generated automatically. DO NOT HAND-EDIT. package vt100 import "github.com/gdamore/tcell/v2/terminfo" func init() { // DEC VT100 (w/advanced video) terminfo.AddTerminfo(&terminfo.Terminfo{ Name: "vt100", Aliases: []string{"vt100-am"}, Columns: 80, Lines: 24, Bell: "\a", Clear: "\x1b[H\x1b[J$<50>", AttrOff: "\x1b[m\x0f$<2>", Underline: "\x1b[4m$<2>", Bold: "\x1b[1m$<2>", Blink: "\x1b[5m$<2>", Reverse: "\x1b[7m$<2>", EnterKeypad: "\x1b[?1h\x1b=", ExitKeypad: "\x1b[?1l\x1b>", PadChar: "\x00", AltChars: "``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~", EnterAcs: "\x0e", ExitAcs: "\x0f", EnableAcs: "\x1b(B\x1b)0", EnableAutoMargin: "\x1b[?7h", DisableAutoMargin: "\x1b[?7l", SetCursor: "\x1b[%i%p1%d;%p2%dH$<5>", CursorBack1: "\b", CursorUp1: "\x1b[A$<2>", KeyUp: "\x1bOA", KeyDown: "\x1bOB", KeyRight: "\x1bOC", KeyLeft: "\x1bOD", KeyBackspace: "\b", KeyF1: "\x1bOP", KeyF2: "\x1bOQ", KeyF3: "\x1bOR", KeyF4: "\x1bOS", KeyF5: "\x1bOt", KeyF6: "\x1bOu", KeyF7: "\x1bOv", KeyF8: "\x1bOl", KeyF9: "\x1bOw", KeyF10: "\x1bOx", AutoMargin: true, }) }
go
MIT
f4fc3669ca8eb67aa350a76503397192bf26f057
2026-01-07T08:35:43.570558Z
false
jesseduffield/lazydocker
https://github.com/jesseduffield/lazydocker/blob/f4fc3669ca8eb67aa350a76503397192bf26f057/vendor/github.com/gdamore/tcell/v2/terminfo/v/vt320/term.go
vendor/github.com/gdamore/tcell/v2/terminfo/v/vt320/term.go
// Generated automatically. DO NOT HAND-EDIT. package vt320 import "github.com/gdamore/tcell/v2/terminfo" func init() { // DEC VT320 7 bit terminal terminfo.AddTerminfo(&terminfo.Terminfo{ Name: "vt320", Aliases: []string{"vt300"}, Columns: 80, Lines: 24, Bell: "\a", Clear: "\x1b[H\x1b[2J", ShowCursor: "\x1b[?25h", HideCursor: "\x1b[?25l", AttrOff: "\x1b[m\x1b(B", Underline: "\x1b[4m", Bold: "\x1b[1m", Blink: "\x1b[5m", Reverse: "\x1b[7m", EnterKeypad: "\x1b[?1h\x1b=", ExitKeypad: "\x1b[?1l\x1b>", PadChar: "\x00", AltChars: "``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~", EnterAcs: "\x1b(0", ExitAcs: "\x1b(B", EnableAutoMargin: "\x1b[?7h", DisableAutoMargin: "\x1b[?7l", SetCursor: "\x1b[%i%p1%d;%p2%dH", CursorBack1: "\b", CursorUp1: "\x1b[A", KeyUp: "\x1bOA", KeyDown: "\x1bOB", KeyRight: "\x1bOC", KeyLeft: "\x1bOD", KeyInsert: "\x1b[2~", KeyDelete: "\x1b[3~", KeyBackspace: "\x7f", KeyHome: "\x1b[1~", KeyPgUp: "\x1b[5~", KeyPgDn: "\x1b[6~", KeyF1: "\x1bOP", KeyF2: "\x1bOQ", KeyF3: "\x1bOR", KeyF4: "\x1bOS", KeyF6: "\x1b[17~", KeyF7: "\x1b[18~", KeyF8: "\x1b[19~", KeyF9: "\x1b[20~", KeyF10: "\x1b[21~", KeyF11: "\x1b[23~", KeyF12: "\x1b[24~", KeyF13: "\x1b[25~", KeyF14: "\x1b[26~", KeyF15: "\x1b[28~", KeyF16: "\x1b[29~", KeyF17: "\x1b[31~", KeyF18: "\x1b[32~", KeyF19: "\x1b[33~", KeyF20: "\x1b[34~", AutoMargin: true, }) }
go
MIT
f4fc3669ca8eb67aa350a76503397192bf26f057
2026-01-07T08:35:43.570558Z
false
jesseduffield/lazydocker
https://github.com/jesseduffield/lazydocker/blob/f4fc3669ca8eb67aa350a76503397192bf26f057/vendor/github.com/gdamore/tcell/v2/terminfo/v/vt400/term.go
vendor/github.com/gdamore/tcell/v2/terminfo/v/vt400/term.go
// Generated automatically. DO NOT HAND-EDIT. package vt400 import "github.com/gdamore/tcell/v2/terminfo" func init() { // DEC VT400 24x80 column autowrap terminfo.AddTerminfo(&terminfo.Terminfo{ Name: "vt400", Aliases: []string{"vt400-24", "dec-vt400"}, Columns: 80, Lines: 24, Clear: "\x1b[H\x1b[J$<10/>", ShowCursor: "\x1b[?25h", HideCursor: "\x1b[?25l", AttrOff: "\x1b[m\x1b(B", Underline: "\x1b[4m", Bold: "\x1b[1m", Blink: "\x1b[5m", Reverse: "\x1b[7m", EnterKeypad: "\x1b[?1h\x1b=", ExitKeypad: "\x1b[?1l\x1b>", PadChar: "\x00", AltChars: "``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~", EnterAcs: "\x1b(0", ExitAcs: "\x1b(B", EnableAutoMargin: "\x1b[?7h", DisableAutoMargin: "\x1b[?7l", SetCursor: "\x1b[%i%p1%d;%p2%dH", CursorBack1: "\b", CursorUp1: "\x1b[A", KeyUp: "\x1bOA", KeyDown: "\x1bOB", KeyRight: "\x1bOC", KeyLeft: "\x1bOD", KeyBackspace: "\b", KeyF1: "\x1bOP", KeyF2: "\x1bOQ", KeyF3: "\x1bOR", KeyF4: "\x1bOS", KeyF6: "\x1b[17~", KeyF7: "\x1b[18~", KeyF8: "\x1b[19~", KeyF9: "\x1b[20~", AutoMargin: true, InsertChar: "\x1b[@", }) }
go
MIT
f4fc3669ca8eb67aa350a76503397192bf26f057
2026-01-07T08:35:43.570558Z
false
jesseduffield/lazydocker
https://github.com/jesseduffield/lazydocker/blob/f4fc3669ca8eb67aa350a76503397192bf26f057/vendor/github.com/gdamore/tcell/v2/terminfo/k/konsole/term.go
vendor/github.com/gdamore/tcell/v2/terminfo/k/konsole/term.go
// Generated automatically. DO NOT HAND-EDIT. package konsole import "github.com/gdamore/tcell/v2/terminfo" func init() { // KDE console window terminfo.AddTerminfo(&terminfo.Terminfo{ Name: "konsole", Columns: 80, Lines: 24, Colors: 8, Bell: "\a", Clear: "\x1b[H\x1b[2J", EnterCA: "\x1b7\x1b[?47h", ExitCA: "\x1b[2J\x1b[?47l\x1b8", ShowCursor: "\x1b[?25h", HideCursor: "\x1b[?25l", AttrOff: "\x1b[0m\x0f", Underline: "\x1b[4m", Bold: "\x1b[1m", Dim: "\x1b[2m", Italic: "\x1b[3m", Blink: "\x1b[5m", Reverse: "\x1b[7m", EnterKeypad: "\x1b[?1h\x1b=", ExitKeypad: "\x1b[?1l\x1b>", SetFg: "\x1b[3%p1%dm", SetBg: "\x1b[4%p1%dm", SetFgBg: "\x1b[3%p1%d;4%p2%dm", ResetFgBg: "\x1b[39;49m", AltChars: "``aaffggiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~", EnterAcs: "\x0e", ExitAcs: "\x0f", EnableAcs: "\x1b)0", EnableAutoMargin: "\x1b[?7h", DisableAutoMargin: "\x1b[?7l", StrikeThrough: "\x1b[9m", Mouse: "\x1b[<", SetCursor: "\x1b[%i%p1%d;%p2%dH", CursorBack1: "\b", CursorUp1: "\x1b[A", KeyUp: "\x1bOA", KeyDown: "\x1bOB", KeyRight: "\x1bOC", KeyLeft: "\x1bOD", KeyInsert: "\x1b[2~", KeyDelete: "\x1b[3~", KeyBackspace: "\x7f", KeyHome: "\x1bOH", KeyEnd: "\x1bOF", KeyPgUp: "\x1b[5~", KeyPgDn: "\x1b[6~", KeyF1: "\x1bOP", KeyF2: "\x1bOQ", KeyF3: "\x1bOR", KeyF4: "\x1bOS", KeyF5: "\x1b[15~", KeyF6: "\x1b[17~", KeyF7: "\x1b[18~", KeyF8: "\x1b[19~", KeyF9: "\x1b[20~", KeyF10: "\x1b[21~", KeyF11: "\x1b[23~", KeyF12: "\x1b[24~", KeyBacktab: "\x1b[Z", Modifiers: 1, AutoMargin: true, }) // KDE console window with xterm 256-colors terminfo.AddTerminfo(&terminfo.Terminfo{ Name: "konsole-256color", Columns: 80, Lines: 24, Colors: 256, Bell: "\a", Clear: "\x1b[H\x1b[2J", EnterCA: "\x1b7\x1b[?47h", ExitCA: "\x1b[2J\x1b[?47l\x1b8", ShowCursor: "\x1b[?25h", HideCursor: "\x1b[?25l", AttrOff: "\x1b[0m\x0f", Underline: "\x1b[4m", Bold: "\x1b[1m", Dim: "\x1b[2m", Italic: "\x1b[3m", Blink: "\x1b[5m", Reverse: "\x1b[7m", EnterKeypad: "\x1b[?1h\x1b=", ExitKeypad: "\x1b[?1l\x1b>", SetFg: "\x1b[%?%p1%{8}%<%t3%p1%d%e%p1%{16}%<%t9%p1%{8}%-%d%e38;5;%p1%d%;m", SetBg: "\x1b[%?%p1%{8}%<%t4%p1%d%e%p1%{16}%<%t10%p1%{8}%-%d%e48;5;%p1%d%;m", SetFgBg: "\x1b[%?%p1%{8}%<%t3%p1%d%e%p1%{16}%<%t9%p1%{8}%-%d%e38;5;%p1%d%;;%?%p2%{8}%<%t4%p2%d%e%p2%{16}%<%t10%p2%{8}%-%d%e48;5;%p2%d%;m", ResetFgBg: "\x1b[39;49m", AltChars: "``aaffggiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~", EnterAcs: "\x0e", ExitAcs: "\x0f", EnableAcs: "\x1b)0", EnableAutoMargin: "\x1b[?7h", DisableAutoMargin: "\x1b[?7l", StrikeThrough: "\x1b[9m", Mouse: "\x1b[<", SetCursor: "\x1b[%i%p1%d;%p2%dH", CursorBack1: "\b", CursorUp1: "\x1b[A", KeyUp: "\x1bOA", KeyDown: "\x1bOB", KeyRight: "\x1bOC", KeyLeft: "\x1bOD", KeyInsert: "\x1b[2~", KeyDelete: "\x1b[3~", KeyBackspace: "\x7f", KeyHome: "\x1bOH", KeyEnd: "\x1bOF", KeyPgUp: "\x1b[5~", KeyPgDn: "\x1b[6~", KeyF1: "\x1bOP", KeyF2: "\x1bOQ", KeyF3: "\x1bOR", KeyF4: "\x1bOS", KeyF5: "\x1b[15~", KeyF6: "\x1b[17~", KeyF7: "\x1b[18~", KeyF8: "\x1b[19~", KeyF9: "\x1b[20~", KeyF10: "\x1b[21~", KeyF11: "\x1b[23~", KeyF12: "\x1b[24~", KeyBacktab: "\x1b[Z", Modifiers: 1, AutoMargin: true, }) }
go
MIT
f4fc3669ca8eb67aa350a76503397192bf26f057
2026-01-07T08:35:43.570558Z
false
jesseduffield/lazydocker
https://github.com/jesseduffield/lazydocker/blob/f4fc3669ca8eb67aa350a76503397192bf26f057/vendor/github.com/gdamore/tcell/v2/terminfo/k/kterm/term.go
vendor/github.com/gdamore/tcell/v2/terminfo/k/kterm/term.go
// Generated automatically. DO NOT HAND-EDIT. package kterm import "github.com/gdamore/tcell/v2/terminfo" func init() { // kterm kanji terminal emulator (X window system) terminfo.AddTerminfo(&terminfo.Terminfo{ Name: "kterm", Columns: 80, Lines: 24, Colors: 8, Bell: "\a", Clear: "\x1b[H\x1b[2J", EnterCA: "\x1b7\x1b[?47h", ExitCA: "\x1b[2J\x1b[?47l\x1b8", AttrOff: "\x1b[m\x1b(B", Underline: "\x1b[4m", Bold: "\x1b[1m", Reverse: "\x1b[7m", EnterKeypad: "\x1b[?1h\x1b=", ExitKeypad: "\x1b[?1l\x1b>", SetFg: "\x1b[3%p1%dm", SetBg: "\x1b[4%p1%dm", SetFgBg: "\x1b[3%p1%d;4%p2%dm", ResetFgBg: "\x1b[39;49m", PadChar: "\x00", AltChars: "``aajjkkllmmnnooppqqrrssttuuvvwwxx~~", EnterAcs: "\x1b(0", ExitAcs: "\x1b(B", EnableAutoMargin: "\x1b[?7h", DisableAutoMargin: "\x1b[?7l", Mouse: "\x1b[M", SetCursor: "\x1b[%i%p1%d;%p2%dH", CursorBack1: "\b", CursorUp1: "\x1b[A", KeyUp: "\x1bOA", KeyDown: "\x1bOB", KeyRight: "\x1bOC", KeyLeft: "\x1bOD", KeyInsert: "\x1b[2~", KeyDelete: "\x1b[3~", KeyBackspace: "\x7f", KeyPgUp: "\x1b[5~", KeyPgDn: "\x1b[6~", KeyF1: "\x1b[11~", KeyF2: "\x1b[12~", KeyF3: "\x1b[13~", KeyF4: "\x1b[14~", KeyF5: "\x1b[15~", KeyF6: "\x1b[17~", KeyF7: "\x1b[18~", KeyF8: "\x1b[19~", KeyF9: "\x1b[20~", KeyF10: "\x1b[21~", KeyF11: "\x1b[23~", KeyF12: "\x1b[24~", KeyF13: "\x1b[25~", KeyF14: "\x1b[26~", KeyF15: "\x1b[28~", KeyF16: "\x1b[29~", KeyF17: "\x1b[31~", KeyF18: "\x1b[32~", KeyF19: "\x1b[33~", KeyF20: "\x1b[34~", AutoMargin: true, }) }
go
MIT
f4fc3669ca8eb67aa350a76503397192bf26f057
2026-01-07T08:35:43.570558Z
false
jesseduffield/lazydocker
https://github.com/jesseduffield/lazydocker/blob/f4fc3669ca8eb67aa350a76503397192bf26f057/vendor/github.com/gdamore/tcell/v2/terminfo/d/dtterm/term.go
vendor/github.com/gdamore/tcell/v2/terminfo/d/dtterm/term.go
// Generated automatically. DO NOT HAND-EDIT. package dtterm import "github.com/gdamore/tcell/v2/terminfo" func init() { // CDE desktop terminal terminfo.AddTerminfo(&terminfo.Terminfo{ Name: "dtterm", Columns: 80, Lines: 24, Colors: 8, Bell: "\a", Clear: "\x1b[H\x1b[J", ShowCursor: "\x1b[?25h", HideCursor: "\x1b[?25l", AttrOff: "\x1b[m\x0f", Underline: "\x1b[4m", Bold: "\x1b[1m", Dim: "\x1b[2m", Blink: "\x1b[5m", Reverse: "\x1b[7m", SetFg: "\x1b[3%p1%dm", SetBg: "\x1b[4%p1%dm", SetFgBg: "\x1b[3%p1%d;4%p2%dm", ResetFgBg: "\x1b[39;49m", PadChar: "\x00", AltChars: "``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~", EnterAcs: "\x0e", ExitAcs: "\x0f", EnableAcs: "\x1b(B\x1b)0", EnableAutoMargin: "\x1b[?7h", DisableAutoMargin: "\x1b[?7l", SetCursor: "\x1b[%i%p1%d;%p2%dH", CursorBack1: "\b", CursorUp1: "\x1b[A", KeyUp: "\x1b[A", KeyDown: "\x1b[B", KeyRight: "\x1b[C", KeyLeft: "\x1b[D", KeyInsert: "\x1b[2~", KeyDelete: "\x1b[3~", KeyBackspace: "\b", KeyPgUp: "\x1b[5~", KeyPgDn: "\x1b[6~", KeyF1: "\x1b[11~", KeyF2: "\x1b[12~", KeyF3: "\x1b[13~", KeyF4: "\x1b[14~", KeyF5: "\x1b[15~", KeyF6: "\x1b[17~", KeyF7: "\x1b[18~", KeyF8: "\x1b[19~", KeyF9: "\x1b[20~", KeyF10: "\x1b[21~", KeyF11: "\x1b[23~", KeyF12: "\x1b[24~", KeyF13: "\x1b[25~", KeyF14: "\x1b[26~", KeyF15: "\x1b[28~", KeyF16: "\x1b[29~", KeyF17: "\x1b[31~", KeyF18: "\x1b[32~", KeyF19: "\x1b[33~", KeyF20: "\x1b[34~", KeyHelp: "\x1b[28~", AutoMargin: true, }) }
go
MIT
f4fc3669ca8eb67aa350a76503397192bf26f057
2026-01-07T08:35:43.570558Z
false
jesseduffield/lazydocker
https://github.com/jesseduffield/lazydocker/blob/f4fc3669ca8eb67aa350a76503397192bf26f057/vendor/github.com/gdamore/tcell/v2/terminfo/extended/extended.go
vendor/github.com/gdamore/tcell/v2/terminfo/extended/extended.go
// Copyright 2024 The TCell Authors // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use 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. // Package extended contains an extended set of terminal descriptions. // Applications desiring to have a better chance of Just Working by // default should include this package. This will significantly increase // the size of the program. package extended import ( // The following imports just register themselves -- // these are the terminal types we aggregate in this package. _ "github.com/gdamore/tcell/v2/terminfo/a/aixterm" _ "github.com/gdamore/tcell/v2/terminfo/a/alacritty" _ "github.com/gdamore/tcell/v2/terminfo/a/ansi" _ "github.com/gdamore/tcell/v2/terminfo/b/beterm" _ "github.com/gdamore/tcell/v2/terminfo/c/cygwin" _ "github.com/gdamore/tcell/v2/terminfo/d/dtterm" _ "github.com/gdamore/tcell/v2/terminfo/e/emacs" _ "github.com/gdamore/tcell/v2/terminfo/f/foot" _ "github.com/gdamore/tcell/v2/terminfo/g/gnome" _ "github.com/gdamore/tcell/v2/terminfo/h/hpterm" _ "github.com/gdamore/tcell/v2/terminfo/k/konsole" _ "github.com/gdamore/tcell/v2/terminfo/k/kterm" _ "github.com/gdamore/tcell/v2/terminfo/l/linux" _ "github.com/gdamore/tcell/v2/terminfo/p/pcansi" _ "github.com/gdamore/tcell/v2/terminfo/r/rxvt" _ "github.com/gdamore/tcell/v2/terminfo/s/screen" _ "github.com/gdamore/tcell/v2/terminfo/s/simpleterm" _ "github.com/gdamore/tcell/v2/terminfo/s/sun" _ "github.com/gdamore/tcell/v2/terminfo/t/tmux" _ "github.com/gdamore/tcell/v2/terminfo/v/vt100" _ "github.com/gdamore/tcell/v2/terminfo/v/vt102" _ "github.com/gdamore/tcell/v2/terminfo/v/vt220" _ "github.com/gdamore/tcell/v2/terminfo/v/vt320" _ "github.com/gdamore/tcell/v2/terminfo/v/vt400" _ "github.com/gdamore/tcell/v2/terminfo/v/vt420" _ "github.com/gdamore/tcell/v2/terminfo/v/vt52" _ "github.com/gdamore/tcell/v2/terminfo/w/wy50" _ "github.com/gdamore/tcell/v2/terminfo/w/wy60" _ "github.com/gdamore/tcell/v2/terminfo/w/wy99_ansi" _ "github.com/gdamore/tcell/v2/terminfo/x/xfce" _ "github.com/gdamore/tcell/v2/terminfo/x/xterm" _ "github.com/gdamore/tcell/v2/terminfo/x/xterm_kitty" )
go
MIT
f4fc3669ca8eb67aa350a76503397192bf26f057
2026-01-07T08:35:43.570558Z
false
jesseduffield/lazydocker
https://github.com/jesseduffield/lazydocker/blob/f4fc3669ca8eb67aa350a76503397192bf26f057/vendor/github.com/gdamore/tcell/v2/terminfo/t/tmux/term.go
vendor/github.com/gdamore/tcell/v2/terminfo/t/tmux/term.go
// Generated automatically. DO NOT HAND-EDIT. package tmux import "github.com/gdamore/tcell/v2/terminfo" func init() { // tmux terminal multiplexer terminfo.AddTerminfo(&terminfo.Terminfo{ Name: "tmux", Columns: 80, Lines: 24, Colors: 8, Bell: "\a", Clear: "\x1b[H\x1b[J", EnterCA: "\x1b[?1049h", ExitCA: "\x1b[?1049l", ShowCursor: "\x1b[34h\x1b[?25h", HideCursor: "\x1b[?25l", AttrOff: "\x1b[m\x0f", Underline: "\x1b[4m", Bold: "\x1b[1m", Dim: "\x1b[2m", Italic: "\x1b[3m", Blink: "\x1b[5m", Reverse: "\x1b[7m", EnterKeypad: "\x1b[?1h\x1b=", ExitKeypad: "\x1b[?1l\x1b>", SetFg: "\x1b[3%p1%dm", SetBg: "\x1b[4%p1%dm", SetFgBg: "\x1b[3%p1%d;4%p2%dm", ResetFgBg: "\x1b[39;49m", PadChar: "\x00", AltChars: "++,,--..00``aaffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~", EnterAcs: "\x0e", ExitAcs: "\x0f", EnableAcs: "\x1b(B\x1b)0", StrikeThrough: "\x1b[9m", Mouse: "\x1b[M", SetCursor: "\x1b[%i%p1%d;%p2%dH", CursorBack1: "\b", CursorUp1: "\x1bM", KeyUp: "\x1bOA", KeyDown: "\x1bOB", KeyRight: "\x1bOC", KeyLeft: "\x1bOD", KeyInsert: "\x1b[2~", KeyDelete: "\x1b[3~", KeyBackspace: "\x7f", KeyHome: "\x1b[1~", KeyEnd: "\x1b[4~", KeyPgUp: "\x1b[5~", KeyPgDn: "\x1b[6~", KeyF1: "\x1bOP", KeyF2: "\x1bOQ", KeyF3: "\x1bOR", KeyF4: "\x1bOS", KeyF5: "\x1b[15~", KeyF6: "\x1b[17~", KeyF7: "\x1b[18~", KeyF8: "\x1b[19~", KeyF9: "\x1b[20~", KeyF10: "\x1b[21~", KeyF11: "\x1b[23~", KeyF12: "\x1b[24~", KeyBacktab: "\x1b[Z", Modifiers: 1, AutoMargin: true, }) }
go
MIT
f4fc3669ca8eb67aa350a76503397192bf26f057
2026-01-07T08:35:43.570558Z
false
jesseduffield/lazydocker
https://github.com/jesseduffield/lazydocker/blob/f4fc3669ca8eb67aa350a76503397192bf26f057/vendor/github.com/gdamore/tcell/v2/terminfo/c/cygwin/term.go
vendor/github.com/gdamore/tcell/v2/terminfo/c/cygwin/term.go
// Generated automatically. DO NOT HAND-EDIT. package cygwin import "github.com/gdamore/tcell/v2/terminfo" func init() { // ANSI emulation for Cygwin terminfo.AddTerminfo(&terminfo.Terminfo{ Name: "cygwin", Colors: 8, Bell: "\a", Clear: "\x1b[H\x1b[J", EnterCA: "\x1b7\x1b[?47h", ExitCA: "\x1b[2J\x1b[?47l\x1b8", AttrOff: "\x1b[0;10m", Underline: "\x1b[4m", Bold: "\x1b[1m", Reverse: "\x1b[7m", SetFg: "\x1b[3%p1%dm", SetBg: "\x1b[4%p1%dm", SetFgBg: "\x1b[3%p1%d;4%p2%dm", ResetFgBg: "\x1b[39;49m", PadChar: "\x00", AltChars: "+\x10,\x11-\x18.\x190\xdb`\x04a\xb1f\xf8g\xf1h\xb0j\xd9k\xbfl\xdam\xc0n\xc5o~p\xc4q\xc4r\xc4s_t\xc3u\xb4v\xc1w\xc2x\xb3y\xf3z\xf2{\xe3|\xd8}\x9c~\xfe", EnterAcs: "\x1b[11m", ExitAcs: "\x1b[10m", SetCursor: "\x1b[%i%p1%d;%p2%dH", CursorBack1: "\b", CursorUp1: "\x1b[A", KeyUp: "\x1b[A", KeyDown: "\x1b[B", KeyRight: "\x1b[C", KeyLeft: "\x1b[D", KeyInsert: "\x1b[2~", KeyDelete: "\x1b[3~", KeyBackspace: "\b", KeyHome: "\x1b[1~", KeyEnd: "\x1b[4~", KeyPgUp: "\x1b[5~", KeyPgDn: "\x1b[6~", KeyF1: "\x1b[[A", KeyF2: "\x1b[[B", KeyF3: "\x1b[[C", KeyF4: "\x1b[[D", KeyF5: "\x1b[[E", KeyF6: "\x1b[17~", KeyF7: "\x1b[18~", KeyF8: "\x1b[19~", KeyF9: "\x1b[20~", KeyF10: "\x1b[21~", KeyF11: "\x1b[23~", KeyF12: "\x1b[24~", KeyF13: "\x1b[25~", KeyF14: "\x1b[26~", KeyF15: "\x1b[28~", KeyF16: "\x1b[29~", KeyF17: "\x1b[31~", KeyF18: "\x1b[32~", KeyF19: "\x1b[33~", KeyF20: "\x1b[34~", AutoMargin: true, InsertChar: "\x1b[@", }) }
go
MIT
f4fc3669ca8eb67aa350a76503397192bf26f057
2026-01-07T08:35:43.570558Z
false
jesseduffield/lazydocker
https://github.com/jesseduffield/lazydocker/blob/f4fc3669ca8eb67aa350a76503397192bf26f057/vendor/github.com/gdamore/tcell/v2/terminfo/b/beterm/term.go
vendor/github.com/gdamore/tcell/v2/terminfo/b/beterm/term.go
// Generated automatically. DO NOT HAND-EDIT. package beterm import "github.com/gdamore/tcell/v2/terminfo" func init() { // BeOS Terminal terminfo.AddTerminfo(&terminfo.Terminfo{ Name: "beterm", Columns: 80, Lines: 25, Colors: 8, Bell: "\a", Clear: "\x1b[H\x1b[J", AttrOff: "\x1b[0;10m", Underline: "\x1b[4m", Bold: "\x1b[1m", Reverse: "\x1b[7m", EnterKeypad: "\x1b[?4h", ExitKeypad: "\x1b[?4l", SetFg: "\x1b[3%p1%dm", SetBg: "\x1b[4%p1%dm", SetFgBg: "\x1b[3%p1%d;4%p2%dm", ResetFgBg: "\x1b[m", PadChar: "\x00", SetCursor: "\x1b[%i%p1%d;%p2%dH", CursorBack1: "\b", CursorUp1: "\x1b[A", KeyUp: "\x1b[A", KeyDown: "\x1b[B", KeyRight: "\x1b[C", KeyLeft: "\x1b[D", KeyInsert: "\x1b[2~", KeyDelete: "\x1b[3~", KeyBackspace: "\b", KeyHome: "\x1b[1~", KeyEnd: "\x1b[4~", KeyPgUp: "\x1b[5~", KeyPgDn: "\x1b[6~", KeyF1: "\x1b[11~", KeyF2: "\x1b[12~", KeyF3: "\x1b[13~", KeyF4: "\x1b[14~", KeyF5: "\x1b[15~", KeyF6: "\x1b[16~", KeyF7: "\x1b[17~", KeyF8: "\x1b[18~", KeyF9: "\x1b[19~", KeyF10: "\x1b[20~", KeyF11: "\x1b[21~", KeyF12: "\x1b[22~", AutoMargin: true, InsertChar: "\x1b[@", }) }
go
MIT
f4fc3669ca8eb67aa350a76503397192bf26f057
2026-01-07T08:35:43.570558Z
false
jesseduffield/lazydocker
https://github.com/jesseduffield/lazydocker/blob/f4fc3669ca8eb67aa350a76503397192bf26f057/vendor/github.com/gdamore/tcell/v2/terminfo/w/wy99_ansi/term.go
vendor/github.com/gdamore/tcell/v2/terminfo/w/wy99_ansi/term.go
// Generated automatically. DO NOT HAND-EDIT. package wy99_ansi import "github.com/gdamore/tcell/v2/terminfo" func init() { // Wyse WY-99GT in ANSI mode (int'l PC keyboard) terminfo.AddTerminfo(&terminfo.Terminfo{ Name: "wy99-ansi", Columns: 80, Lines: 25, Bell: "\a", Clear: "\x1b[H\x1b[J$<200>", ShowCursor: "\x1b[34h\x1b[?25h", HideCursor: "\x1b[?25l", AttrOff: "\x1b[m\x0f\x1b[\"q", Underline: "\x1b[4m", Bold: "\x1b[1m", Dim: "\x1b[2m", Blink: "\x1b[5m", Reverse: "\x1b[7m", EnterKeypad: "\x1b[?1h", ExitKeypad: "\x1b[?1l", PadChar: "\x00", AltChars: "``aaffggjjkkllmmnnooqqssttuuvvwwxx{{||}}~~", EnterAcs: "\x0e", ExitAcs: "\x0f", EnableAcs: "\x1b)0", EnableAutoMargin: "\x1b[?7h", DisableAutoMargin: "\x1b[?7l", SetCursor: "\x1b[%i%p1%d;%p2%dH", CursorBack1: "\b$<1>", CursorUp1: "\x1bM", KeyUp: "\x1bOA", KeyDown: "\x1bOB", KeyRight: "\x1bOC", KeyLeft: "\x1bOD", KeyBackspace: "\b", KeyF1: "\x1bOP", KeyF2: "\x1bOQ", KeyF3: "\x1bOR", KeyF4: "\x1bOS", KeyF5: "\x1b[M", KeyF6: "\x1b[17~", KeyF7: "\x1b[18~", KeyF8: "\x1b[19~", KeyF9: "\x1b[20~", KeyF10: "\x1b[21~", KeyF11: "\x1b[23~", KeyF12: "\x1b[24~", KeyF17: "\x1b[K", KeyF18: "\x1b[31~", KeyF19: "\x1b[32~", KeyF20: "\x1b[33~", KeyF21: "\x1b[34~", KeyF22: "\x1b[35~", KeyF23: "\x1b[1~", KeyF24: "\x1b[2~", KeyBacktab: "\x1b[z", AutoMargin: true, }) // Wyse WY-99GT in ANSI mode (US PC keyboard) terminfo.AddTerminfo(&terminfo.Terminfo{ Name: "wy99a-ansi", Columns: 80, Lines: 25, Bell: "\a", Clear: "\x1b[H\x1b[J$<200>", ShowCursor: "\x1b[34h\x1b[?25h", HideCursor: "\x1b[?25l", AttrOff: "\x1b[m\x0f\x1b[\"q", Underline: "\x1b[4m", Bold: "\x1b[1m", Dim: "\x1b[2m", Blink: "\x1b[5m", Reverse: "\x1b[7m", EnterKeypad: "\x1b[?1h", ExitKeypad: "\x1b[?1l", PadChar: "\x00", AltChars: "``aaffggjjkkllmmnnooqqssttuuvvwwxx{{||}}~~", EnterAcs: "\x0e", ExitAcs: "\x0f", EnableAcs: "\x1b)0", EnableAutoMargin: "\x1b[?7h", DisableAutoMargin: "\x1b[?7l", SetCursor: "\x1b[%i%p1%d;%p2%dH", CursorBack1: "\b$<1>", CursorUp1: "\x1bM", KeyUp: "\x1bOA", KeyDown: "\x1bOB", KeyRight: "\x1bOC", KeyLeft: "\x1bOD", KeyBackspace: "\b", KeyF1: "\x1bOP", KeyF2: "\x1bOQ", KeyF3: "\x1bOR", KeyF4: "\x1bOS", KeyF5: "\x1b[M", KeyF6: "\x1b[17~", KeyF7: "\x1b[18~", KeyF8: "\x1b[19~", KeyF9: "\x1b[20~", KeyF10: "\x1b[21~", KeyF11: "\x1b[23~", KeyF12: "\x1b[24~", KeyF17: "\x1b[K", KeyF18: "\x1b[31~", KeyF19: "\x1b[32~", KeyF20: "\x1b[33~", KeyF21: "\x1b[34~", KeyF22: "\x1b[35~", KeyF23: "\x1b[1~", KeyF24: "\x1b[2~", KeyBacktab: "\x1b[z", AutoMargin: true, }) }
go
MIT
f4fc3669ca8eb67aa350a76503397192bf26f057
2026-01-07T08:35:43.570558Z
false
jesseduffield/lazydocker
https://github.com/jesseduffield/lazydocker/blob/f4fc3669ca8eb67aa350a76503397192bf26f057/vendor/github.com/gdamore/tcell/v2/terminfo/w/wy50/term.go
vendor/github.com/gdamore/tcell/v2/terminfo/w/wy50/term.go
// Generated automatically. DO NOT HAND-EDIT. package wy50 import "github.com/gdamore/tcell/v2/terminfo" func init() { // Wyse 50 terminfo.AddTerminfo(&terminfo.Terminfo{ Name: "wy50", Aliases: []string{"wyse50"}, Columns: 80, Lines: 24, Bell: "\a", Clear: "\x1b+$<20>", ShowCursor: "\x1b`1", HideCursor: "\x1b`0", AttrOff: "\x1b(\x1bH\x03", Dim: "\x1b`7\x1b)", Reverse: "\x1b`6\x1b)", PadChar: "\x00", AltChars: "a;j5k3l2m1n8q:t4u9v=w0x6", EnterAcs: "\x1bH\x02", ExitAcs: "\x1bH\x03", SetCursor: "\x1b=%p1%' '%+%c%p2%' '%+%c", CursorBack1: "\b", CursorUp1: "\v", KeyUp: "\v", KeyDown: "\n", KeyRight: "\f", KeyLeft: "\b", KeyInsert: "\x1bQ", KeyDelete: "\x1bW", KeyBackspace: "\b", KeyHome: "\x1e", KeyPgUp: "\x1bJ", KeyPgDn: "\x1bK", KeyF1: "\x01@\r", KeyF2: "\x01A\r", KeyF3: "\x01B\r", KeyF4: "\x01C\r", KeyF5: "\x01D\r", KeyF6: "\x01E\r", KeyF7: "\x01F\r", KeyF8: "\x01G\r", KeyF9: "\x01H\r", KeyF10: "\x01I\r", KeyF11: "\x01J\r", KeyF12: "\x01K\r", KeyF13: "\x01L\r", KeyF14: "\x01M\r", KeyF15: "\x01N\r", KeyF16: "\x01O\r", KeyPrint: "\x1bP", KeyBacktab: "\x1bI", KeyShfHome: "\x1b{", AutoMargin: true, }) }
go
MIT
f4fc3669ca8eb67aa350a76503397192bf26f057
2026-01-07T08:35:43.570558Z
false
jesseduffield/lazydocker
https://github.com/jesseduffield/lazydocker/blob/f4fc3669ca8eb67aa350a76503397192bf26f057/vendor/github.com/gdamore/tcell/v2/terminfo/w/wy60/term.go
vendor/github.com/gdamore/tcell/v2/terminfo/w/wy60/term.go
// Generated automatically. DO NOT HAND-EDIT. package wy60 import "github.com/gdamore/tcell/v2/terminfo" func init() { // Wyse 60 terminfo.AddTerminfo(&terminfo.Terminfo{ Name: "wy60", Aliases: []string{"wyse60"}, Columns: 80, Lines: 24, Bell: "\a", Clear: "\x1b+$<100>", EnterCA: "\x1bw0", ExitCA: "\x1bw1", ShowCursor: "\x1b`1", HideCursor: "\x1b`0", AttrOff: "\x1b(\x1bH\x03\x1bG0\x1bcD", Underline: "\x1bG8", Dim: "\x1bGp", Blink: "\x1bG2", Reverse: "\x1bG4", PadChar: "\x00", AltChars: "+/,.0[a2fxgqh1ihjYk?lZm@nEqDtCu4vAwBx3yszr{c~~", EnterAcs: "\x1bcE", ExitAcs: "\x1bcD", EnableAutoMargin: "\x1bd/", DisableAutoMargin: "\x1bd.", SetCursor: "\x1b=%p1%' '%+%c%p2%' '%+%c", CursorBack1: "\b", CursorUp1: "\v", KeyUp: "\v", KeyDown: "\n", KeyRight: "\f", KeyLeft: "\b", KeyInsert: "\x1bQ", KeyDelete: "\x1bW", KeyBackspace: "\b", KeyHome: "\x1e", KeyPgUp: "\x1bJ", KeyPgDn: "\x1bK", KeyF1: "\x01@\r", KeyF2: "\x01A\r", KeyF3: "\x01B\r", KeyF4: "\x01C\r", KeyF5: "\x01D\r", KeyF6: "\x01E\r", KeyF7: "\x01F\r", KeyF8: "\x01G\r", KeyF9: "\x01H\r", KeyF10: "\x01I\r", KeyF11: "\x01J\r", KeyF12: "\x01K\r", KeyF13: "\x01L\r", KeyF14: "\x01M\r", KeyF15: "\x01N\r", KeyF16: "\x01O\r", KeyPrint: "\x1bP", KeyBacktab: "\x1bI", KeyShfHome: "\x1b{", AutoMargin: true, }) }
go
MIT
f4fc3669ca8eb67aa350a76503397192bf26f057
2026-01-07T08:35:43.570558Z
false
jesseduffield/lazydocker
https://github.com/jesseduffield/lazydocker/blob/f4fc3669ca8eb67aa350a76503397192bf26f057/vendor/github.com/gdamore/tcell/v2/terminfo/e/emacs/term.go
vendor/github.com/gdamore/tcell/v2/terminfo/e/emacs/term.go
// Generated automatically. DO NOT HAND-EDIT. package emacs import "github.com/gdamore/tcell/v2/terminfo" func init() { // GNU Emacs term.el terminal emulation terminfo.AddTerminfo(&terminfo.Terminfo{ Name: "eterm", Columns: 80, Lines: 24, Bell: "\a", Clear: "\x1b[H\x1b[J", EnterCA: "\x1b7\x1b[?47h", ExitCA: "\x1b[2J\x1b[?47l\x1b8", AttrOff: "\x1b[m", Underline: "\x1b[4m", Bold: "\x1b[1m", Reverse: "\x1b[7m", PadChar: "\x00", SetCursor: "\x1b[%i%p1%d;%p2%dH", CursorBack1: "\b", CursorUp1: "\x1b[A", AutoMargin: true, }) // Emacs term.el terminal emulator term-protocol-version 0.96 terminfo.AddTerminfo(&terminfo.Terminfo{ Name: "eterm-color", Columns: 80, Lines: 24, Colors: 8, Bell: "\a", Clear: "\x1b[H\x1b[J", EnterCA: "\x1b7\x1b[?47h", ExitCA: "\x1b[2J\x1b[?47l\x1b8", AttrOff: "\x1b[m", Underline: "\x1b[4m", Bold: "\x1b[1m", Blink: "\x1b[5m", Reverse: "\x1b[7m", SetFg: "\x1b[%p1%{30}%+%dm", SetBg: "\x1b[%p1%'('%+%dm", SetFgBg: "\x1b[%p1%{30}%+%d;%p2%'('%+%dm", ResetFgBg: "\x1b[39;49m", PadChar: "\x00", SetCursor: "\x1b[%i%p1%d;%p2%dH", CursorBack1: "\b", CursorUp1: "\x1b[A", KeyUp: "\x1bOA", KeyDown: "\x1bOB", KeyRight: "\x1bOC", KeyLeft: "\x1bOD", KeyInsert: "\x1b[2~", KeyDelete: "\x1b[3~", KeyBackspace: "\x7f", KeyHome: "\x1b[1~", KeyEnd: "\x1b[4~", KeyPgUp: "\x1b[5~", KeyPgDn: "\x1b[6~", AutoMargin: true, }) }
go
MIT
f4fc3669ca8eb67aa350a76503397192bf26f057
2026-01-07T08:35:43.570558Z
false
jesseduffield/lazydocker
https://github.com/jesseduffield/lazydocker/blob/f4fc3669ca8eb67aa350a76503397192bf26f057/vendor/github.com/gdamore/tcell/v2/terminfo/h/hpterm/term.go
vendor/github.com/gdamore/tcell/v2/terminfo/h/hpterm/term.go
// Generated automatically. DO NOT HAND-EDIT. package hpterm import "github.com/gdamore/tcell/v2/terminfo" func init() { // HP X11 terminal emulator (old) terminfo.AddTerminfo(&terminfo.Terminfo{ Name: "hpterm", Aliases: []string{"X-hpterm"}, Columns: 80, Lines: 24, Bell: "\a", Clear: "\x1b&a0y0C\x1bJ", AttrOff: "\x1b&d@\x0f", Underline: "\x1b&dD", Bold: "\x1b&dB", Dim: "\x1b&dH", Reverse: "\x1b&dB", EnterKeypad: "\x1b&s1A", ExitKeypad: "\x1b&s0A", PadChar: "\x00", EnterAcs: "\x0e", ExitAcs: "\x0f", SetCursor: "\x1b&a%p1%dy%p2%dC", CursorBack1: "\b", CursorUp1: "\x1bA", KeyUp: "\x1bA", KeyDown: "\x1bB", KeyRight: "\x1bC", KeyLeft: "\x1bD", KeyInsert: "\x1bQ", KeyDelete: "\x1bP", KeyBackspace: "\b", KeyHome: "\x1bh", KeyPgUp: "\x1bV", KeyPgDn: "\x1bU", KeyF1: "\x1bp", KeyF2: "\x1bq", KeyF3: "\x1br", KeyF4: "\x1bs", KeyF5: "\x1bt", KeyF6: "\x1bu", KeyF7: "\x1bv", KeyF8: "\x1bw", KeyClear: "\x1bJ", AutoMargin: true, }) }
go
MIT
f4fc3669ca8eb67aa350a76503397192bf26f057
2026-01-07T08:35:43.570558Z
false
jesseduffield/lazydocker
https://github.com/jesseduffield/lazydocker/blob/f4fc3669ca8eb67aa350a76503397192bf26f057/vendor/github.com/spkg/bom/discard_go14.go
vendor/github.com/spkg/bom/discard_go14.go
// +build !go1.5 package bom import "bufio" func discardBytes(buf *bufio.Reader, n int) { // cannot use the buf.Discard method as it was introduced in Go 1.5 for i := 0; i < n; i++ { buf.ReadByte() } }
go
MIT
f4fc3669ca8eb67aa350a76503397192bf26f057
2026-01-07T08:35:43.570558Z
false
jesseduffield/lazydocker
https://github.com/jesseduffield/lazydocker/blob/f4fc3669ca8eb67aa350a76503397192bf26f057/vendor/github.com/spkg/bom/bom.go
vendor/github.com/spkg/bom/bom.go
// Package bom is used to clean up UTF-8 Byte Order Marks. package bom import ( "bufio" "io" ) const ( bom0 = 0xef bom1 = 0xbb bom2 = 0xbf ) // Clean returns b with the 3 byte BOM stripped off the front if it is present. // If the BOM is not present, then b is returned. func Clean(b []byte) []byte { if len(b) >= 3 && b[0] == bom0 && b[1] == bom1 && b[2] == bom2 { return b[3:] } return b } // NewReader returns an io.Reader that will skip over initial UTF-8 byte order marks. func NewReader(r io.Reader) io.Reader { buf := bufio.NewReader(r) b, err := buf.Peek(3) if err != nil { // not enough bytes return buf } if b[0] == bom0 && b[1] == bom1 && b[2] == bom2 { discardBytes(buf, 3) } return buf }
go
MIT
f4fc3669ca8eb67aa350a76503397192bf26f057
2026-01-07T08:35:43.570558Z
false
jesseduffield/lazydocker
https://github.com/jesseduffield/lazydocker/blob/f4fc3669ca8eb67aa350a76503397192bf26f057/vendor/github.com/spkg/bom/discard_go15.go
vendor/github.com/spkg/bom/discard_go15.go
// +build go1.5 package bom import "bufio" func discardBytes(buf *bufio.Reader, n int) { // the Discard method was introduced in Go 1.5 buf.Discard(n) }
go
MIT
f4fc3669ca8eb67aa350a76503397192bf26f057
2026-01-07T08:35:43.570558Z
false
jesseduffield/lazydocker
https://github.com/jesseduffield/lazydocker/blob/f4fc3669ca8eb67aa350a76503397192bf26f057/vendor/github.com/xo/terminfo/terminfo.go
vendor/github.com/xo/terminfo/terminfo.go
// Package terminfo implements reading terminfo files in pure go. package terminfo import ( "io" "io/ioutil" "path" "strconv" "strings" ) // Error is a terminfo error. type Error string // Error satisfies the error interface. func (err Error) Error() string { return string(err) } const ( // ErrInvalidFileSize is the invalid file size error. ErrInvalidFileSize Error = "invalid file size" // ErrUnexpectedFileEnd is the unexpected file end error. ErrUnexpectedFileEnd Error = "unexpected file end" // ErrInvalidStringTable is the invalid string table error. ErrInvalidStringTable Error = "invalid string table" // ErrInvalidMagic is the invalid magic error. ErrInvalidMagic Error = "invalid magic" // ErrInvalidHeader is the invalid header error. ErrInvalidHeader Error = "invalid header" // ErrInvalidNames is the invalid names error. ErrInvalidNames Error = "invalid names" // ErrInvalidExtendedHeader is the invalid extended header error. ErrInvalidExtendedHeader Error = "invalid extended header" // ErrEmptyTermName is the empty term name error. ErrEmptyTermName Error = "empty term name" // ErrDatabaseDirectoryNotFound is the database directory not found error. ErrDatabaseDirectoryNotFound Error = "database directory not found" // ErrFileNotFound is the file not found error. ErrFileNotFound Error = "file not found" // ErrInvalidTermProgramVersion is the invalid TERM_PROGRAM_VERSION error. ErrInvalidTermProgramVersion Error = "invalid TERM_PROGRAM_VERSION" ) // Terminfo describes a terminal's capabilities. type Terminfo struct { // File is the original source file. File string // Names are the provided cap names. Names []string // Bools are the bool capabilities. Bools map[int]bool // BoolsM are the missing bool capabilities. BoolsM map[int]bool // Nums are the num capabilities. Nums map[int]int // NumsM are the missing num capabilities. NumsM map[int]bool // Strings are the string capabilities. Strings map[int][]byte // StringsM are the missing string capabilities. StringsM map[int]bool // ExtBools are the extended bool capabilities. ExtBools map[int]bool // ExtBoolsNames is the map of extended bool capabilities to their index. ExtBoolNames map[int][]byte // ExtNums are the extended num capabilities. ExtNums map[int]int // ExtNumsNames is the map of extended num capabilities to their index. ExtNumNames map[int][]byte // ExtStrings are the extended string capabilities. ExtStrings map[int][]byte // ExtStringsNames is the map of extended string capabilities to their index. ExtStringNames map[int][]byte } // Decode decodes the terminfo data contained in buf. func Decode(buf []byte) (*Terminfo, error) { var err error // check max file length if len(buf) >= maxFileLength { return nil, ErrInvalidFileSize } d := &decoder{ buf: buf, len: len(buf), } // read header h, err := d.readInts(6, 16) if err != nil { return nil, err } var numWidth int // check magic if h[fieldMagic] == magic { numWidth = 16 } else if h[fieldMagic] == magicExtended { numWidth = 32 } else { return nil, ErrInvalidMagic } // check header if hasInvalidCaps(h) { return nil, ErrInvalidHeader } // check remaining length if d.len-d.pos < capLength(h) { return nil, ErrUnexpectedFileEnd } // read names names, err := d.readBytes(h[fieldNameSize]) if err != nil { return nil, err } // check name is terminated properly i := findNull(names, 0) if i == -1 { return nil, ErrInvalidNames } names = names[:i] // read bool caps bools, boolsM, err := d.readBools(h[fieldBoolCount]) if err != nil { return nil, err } // read num caps nums, numsM, err := d.readNums(h[fieldNumCount], numWidth) if err != nil { return nil, err } // read string caps strs, strsM, err := d.readStrings(h[fieldStringCount], h[fieldTableSize]) if err != nil { return nil, err } ti := &Terminfo{ Names: strings.Split(string(names), "|"), Bools: bools, BoolsM: boolsM, Nums: nums, NumsM: numsM, Strings: strs, StringsM: strsM, } // at the end of file, so no extended caps if d.pos >= d.len { return ti, nil } // decode extended header eh, err := d.readInts(5, 16) if err != nil { return nil, err } // check extended offset field if hasInvalidExtOffset(eh) { return nil, ErrInvalidExtendedHeader } // check extended cap lengths if d.len-d.pos != extCapLength(eh, numWidth) { return nil, ErrInvalidExtendedHeader } // read extended bool caps ti.ExtBools, _, err = d.readBools(eh[fieldExtBoolCount]) if err != nil { return nil, err } // read extended num caps ti.ExtNums, _, err = d.readNums(eh[fieldExtNumCount], numWidth) if err != nil { return nil, err } // read extended string data table indexes extIndexes, err := d.readInts(eh[fieldExtOffsetCount], 16) if err != nil { return nil, err } // read string data table extData, err := d.readBytes(eh[fieldExtTableSize]) if err != nil { return nil, err } // precautionary check that exactly at end of file if d.pos != d.len { return nil, ErrUnexpectedFileEnd } var last int // read extended string caps ti.ExtStrings, last, err = readStrings(extIndexes, extData, eh[fieldExtStringCount]) if err != nil { return nil, err } extIndexes, extData = extIndexes[eh[fieldExtStringCount]:], extData[last:] // read extended bool names ti.ExtBoolNames, _, err = readStrings(extIndexes, extData, eh[fieldExtBoolCount]) if err != nil { return nil, err } extIndexes = extIndexes[eh[fieldExtBoolCount]:] // read extended num names ti.ExtNumNames, _, err = readStrings(extIndexes, extData, eh[fieldExtNumCount]) if err != nil { return nil, err } extIndexes = extIndexes[eh[fieldExtNumCount]:] // read extended string names ti.ExtStringNames, _, err = readStrings(extIndexes, extData, eh[fieldExtStringCount]) if err != nil { return nil, err } //extIndexes = extIndexes[eh[fieldExtStringCount]:] return ti, nil } // Open reads the terminfo file name from the specified directory dir. func Open(dir, name string) (*Terminfo, error) { var err error var buf []byte var filename string for _, f := range []string{ path.Join(dir, name[0:1], name), path.Join(dir, strconv.FormatUint(uint64(name[0]), 16), name), } { buf, err = ioutil.ReadFile(f) if err == nil { filename = f break } } if buf == nil { return nil, ErrFileNotFound } // decode ti, err := Decode(buf) if err != nil { return nil, err } // save original file name ti.File = filename // add to cache termCache.Lock() for _, n := range ti.Names { termCache.db[n] = ti } termCache.Unlock() return ti, nil } // boolCaps returns all bool and extended capabilities using f to format the // index key. func (ti *Terminfo) boolCaps(f func(int) string, extended bool) map[string]bool { m := make(map[string]bool, len(ti.Bools)+len(ti.ExtBools)) if !extended { for k, v := range ti.Bools { m[f(k)] = v } } else { for k, v := range ti.ExtBools { m[string(ti.ExtBoolNames[k])] = v } } return m } // BoolCaps returns all bool capabilities. func (ti *Terminfo) BoolCaps() map[string]bool { return ti.boolCaps(BoolCapName, false) } // BoolCapsShort returns all bool capabilities, using the short name as the // index. func (ti *Terminfo) BoolCapsShort() map[string]bool { return ti.boolCaps(BoolCapNameShort, false) } // ExtBoolCaps returns all extended bool capabilities. func (ti *Terminfo) ExtBoolCaps() map[string]bool { return ti.boolCaps(BoolCapName, true) } // ExtBoolCapsShort returns all extended bool capabilities, using the short // name as the index. func (ti *Terminfo) ExtBoolCapsShort() map[string]bool { return ti.boolCaps(BoolCapNameShort, true) } // numCaps returns all num and extended capabilities using f to format the // index key. func (ti *Terminfo) numCaps(f func(int) string, extended bool) map[string]int { m := make(map[string]int, len(ti.Nums)+len(ti.ExtNums)) if !extended { for k, v := range ti.Nums { m[f(k)] = v } } else { for k, v := range ti.ExtNums { m[string(ti.ExtNumNames[k])] = v } } return m } // NumCaps returns all num capabilities. func (ti *Terminfo) NumCaps() map[string]int { return ti.numCaps(NumCapName, false) } // NumCapsShort returns all num capabilities, using the short name as the // index. func (ti *Terminfo) NumCapsShort() map[string]int { return ti.numCaps(NumCapNameShort, false) } // ExtNumCaps returns all extended num capabilities. func (ti *Terminfo) ExtNumCaps() map[string]int { return ti.numCaps(NumCapName, true) } // ExtNumCapsShort returns all extended num capabilities, using the short // name as the index. func (ti *Terminfo) ExtNumCapsShort() map[string]int { return ti.numCaps(NumCapNameShort, true) } // stringCaps returns all string and extended capabilities using f to format the // index key. func (ti *Terminfo) stringCaps(f func(int) string, extended bool) map[string][]byte { m := make(map[string][]byte, len(ti.Strings)+len(ti.ExtStrings)) if !extended { for k, v := range ti.Strings { m[f(k)] = v } } else { for k, v := range ti.ExtStrings { m[string(ti.ExtStringNames[k])] = v } } return m } // StringCaps returns all string capabilities. func (ti *Terminfo) StringCaps() map[string][]byte { return ti.stringCaps(StringCapName, false) } // StringCapsShort returns all string capabilities, using the short name as the // index. func (ti *Terminfo) StringCapsShort() map[string][]byte { return ti.stringCaps(StringCapNameShort, false) } // ExtStringCaps returns all extended string capabilities. func (ti *Terminfo) ExtStringCaps() map[string][]byte { return ti.stringCaps(StringCapName, true) } // ExtStringCapsShort returns all extended string capabilities, using the short // name as the index. func (ti *Terminfo) ExtStringCapsShort() map[string][]byte { return ti.stringCaps(StringCapNameShort, true) } // Has determines if the bool cap i is present. func (ti *Terminfo) Has(i int) bool { return ti.Bools[i] } // Num returns the num cap i, or -1 if not present. func (ti *Terminfo) Num(i int) int { n, ok := ti.Nums[i] if !ok { return -1 } return n } // Printf formats the string cap i, interpolating parameters v. func (ti *Terminfo) Printf(i int, v ...interface{}) string { return Printf(ti.Strings[i], v...) } // Fprintf prints the string cap i to writer w, interpolating parameters v. func (ti *Terminfo) Fprintf(w io.Writer, i int, v ...interface{}) { Fprintf(w, ti.Strings[i], v...) } // Color takes a foreground and background color and returns string that sets // them for this terminal. func (ti *Terminfo) Colorf(fg, bg int, str string) string { maxColors := int(ti.Nums[MaxColors]) // map bright colors to lower versions if the color table only holds 8. if maxColors == 8 { if fg > 7 && fg < 16 { fg -= 8 } if bg > 7 && bg < 16 { bg -= 8 } } var s string if maxColors > fg && fg >= 0 { s += ti.Printf(SetAForeground, fg) } if maxColors > bg && bg >= 0 { s += ti.Printf(SetABackground, bg) } return s + str + ti.Printf(ExitAttributeMode) } // Goto returns a string suitable for addressing the cursor at the given // row and column. The origin 0, 0 is in the upper left corner of the screen. func (ti *Terminfo) Goto(row, col int) string { return Printf(ti.Strings[CursorAddress], row, col) } // Puts emits the string to the writer, but expands inline padding indications // (of the form $<[delay]> where [delay] is msec) to a suitable number of // padding characters (usually null bytes) based upon the supplied baud. At // high baud rates, more padding characters will be inserted. /*func (ti *Terminfo) Puts(w io.Writer, s string, lines, baud int) (int, error) { var err error for { start := strings.Index(s, "$<") if start == -1 { // most strings don't need padding, which is good news! return io.WriteString(w, s) } end := strings.Index(s, ">") if end == -1 { // unterminated... just emit bytes unadulterated. return io.WriteString(w, "$<"+s) } var c int c, err = io.WriteString(w, s[:start]) if err != nil { return n + c, err } n += c s = s[start+2:] val := s[:end] s = s[end+1:] var ms int var dot, mandatory, asterisk bool unit := 1000 for _, ch := range val { switch { case ch >= '0' && ch <= '9': ms = (ms * 10) + int(ch-'0') if dot { unit *= 10 } case ch == '.' && !dot: dot = true case ch == '*' && !asterisk: ms *= lines asterisk = true case ch == '/': mandatory = true default: break } } z, pad := ((baud/8)/unit)*ms, ti.Strings[PadChar] b := make([]byte, len(pad)*z) for bp := copy(b, pad); bp < len(b); bp *= 2 { copy(b[bp:], b[:bp]) } if (!ti.Bools[XonXoff] && baud > int(ti.Nums[PaddingBaudRate])) || mandatory { c, err = w.Write(b) if err != nil { return n + c, err } n += c } } return n, nil }*/
go
MIT
f4fc3669ca8eb67aa350a76503397192bf26f057
2026-01-07T08:35:43.570558Z
false
jesseduffield/lazydocker
https://github.com/jesseduffield/lazydocker/blob/f4fc3669ca8eb67aa350a76503397192bf26f057/vendor/github.com/xo/terminfo/capvals.go
vendor/github.com/xo/terminfo/capvals.go
package terminfo // Code generated by gen.go. DO NOT EDIT. // Bool capabilities. const ( // The AutoLeftMargin [auto_left_margin, bw] bool capability indicates cub1 wraps from column 0 to last column. AutoLeftMargin = iota // The AutoRightMargin [auto_right_margin, am] bool capability indicates terminal has automatic margins. AutoRightMargin // The NoEscCtlc [no_esc_ctlc, xsb] bool capability indicates beehive (f1=escape, f2=ctrl C). NoEscCtlc // The CeolStandoutGlitch [ceol_standout_glitch, xhp] bool capability indicates standout not erased by overwriting (hp). CeolStandoutGlitch // The EatNewlineGlitch [eat_newline_glitch, xenl] bool capability indicates newline ignored after 80 cols (concept). EatNewlineGlitch // The EraseOverstrike [erase_overstrike, eo] bool capability indicates can erase overstrikes with a blank. EraseOverstrike // The GenericType [generic_type, gn] bool capability indicates generic line type. GenericType // The HardCopy [hard_copy, hc] bool capability indicates hardcopy terminal. HardCopy // The HasMetaKey [has_meta_key, km] bool capability indicates Has a meta key (i.e., sets 8th-bit). HasMetaKey // The HasStatusLine [has_status_line, hs] bool capability indicates has extra status line. HasStatusLine // The InsertNullGlitch [insert_null_glitch, in] bool capability indicates insert mode distinguishes nulls. InsertNullGlitch // The MemoryAbove [memory_above, da] bool capability indicates display may be retained above the screen. MemoryAbove // The MemoryBelow [memory_below, db] bool capability indicates display may be retained below the screen. MemoryBelow // The MoveInsertMode [move_insert_mode, mir] bool capability indicates safe to move while in insert mode. MoveInsertMode // The MoveStandoutMode [move_standout_mode, msgr] bool capability indicates safe to move while in standout mode. MoveStandoutMode // The OverStrike [over_strike, os] bool capability indicates terminal can overstrike. OverStrike // The StatusLineEscOk [status_line_esc_ok, eslok] bool capability indicates escape can be used on the status line. StatusLineEscOk // The DestTabsMagicSmso [dest_tabs_magic_smso, xt] bool capability indicates tabs destructive, magic so char (t1061). DestTabsMagicSmso // The TildeGlitch [tilde_glitch, hz] bool capability indicates cannot print ~'s (Hazeltine). TildeGlitch // The TransparentUnderline [transparent_underline, ul] bool capability indicates underline character overstrikes. TransparentUnderline // The XonXoff [xon_xoff, xon] bool capability indicates terminal uses xon/xoff handshaking. XonXoff // The NeedsXonXoff [needs_xon_xoff, nxon] bool capability indicates padding will not work, xon/xoff required. NeedsXonXoff // The PrtrSilent [prtr_silent, mc5i] bool capability indicates printer will not echo on screen. PrtrSilent // The HardCursor [hard_cursor, chts] bool capability indicates cursor is hard to see. HardCursor // The NonRevRmcup [non_rev_rmcup, nrrmc] bool capability indicates smcup does not reverse rmcup. NonRevRmcup // The NoPadChar [no_pad_char, npc] bool capability indicates pad character does not exist. NoPadChar // The NonDestScrollRegion [non_dest_scroll_region, ndscr] bool capability indicates scrolling region is non-destructive. NonDestScrollRegion // The CanChange [can_change, ccc] bool capability indicates terminal can re-define existing colors. CanChange // The BackColorErase [back_color_erase, bce] bool capability indicates screen erased with background color. BackColorErase // The HueLightnessSaturation [hue_lightness_saturation, hls] bool capability indicates terminal uses only HLS color notation (Tektronix). HueLightnessSaturation // The ColAddrGlitch [col_addr_glitch, xhpa] bool capability indicates only positive motion for hpa/mhpa caps. ColAddrGlitch // The CrCancelsMicroMode [cr_cancels_micro_mode, crxm] bool capability indicates using cr turns off micro mode. CrCancelsMicroMode // The HasPrintWheel [has_print_wheel, daisy] bool capability indicates printer needs operator to change character set. HasPrintWheel // The RowAddrGlitch [row_addr_glitch, xvpa] bool capability indicates only positive motion for vpa/mvpa caps. RowAddrGlitch // The SemiAutoRightMargin [semi_auto_right_margin, sam] bool capability indicates printing in last column causes cr. SemiAutoRightMargin // The CpiChangesRes [cpi_changes_res, cpix] bool capability indicates changing character pitch changes resolution. CpiChangesRes // The LpiChangesRes [lpi_changes_res, lpix] bool capability indicates changing line pitch changes resolution. LpiChangesRes // The BackspacesWithBs [backspaces_with_bs, OTbs] bool capability indicates uses ^H to move left. BackspacesWithBs // The CrtNoScrolling [crt_no_scrolling, OTns] bool capability indicates crt cannot scroll. CrtNoScrolling // The NoCorrectlyWorkingCr [no_correctly_working_cr, OTnc] bool capability indicates no way to go to start of line. NoCorrectlyWorkingCr // The GnuHasMetaKey [gnu_has_meta_key, OTMT] bool capability indicates has meta key. GnuHasMetaKey // The LinefeedIsNewline [linefeed_is_newline, OTNL] bool capability indicates move down with \n. LinefeedIsNewline // The HasHardwareTabs [has_hardware_tabs, OTpt] bool capability indicates has 8-char tabs invoked with ^I. HasHardwareTabs // The ReturnDoesClrEol [return_does_clr_eol, OTxr] bool capability indicates return clears the line. ReturnDoesClrEol ) // Num capabilities. const ( // The Columns [columns, cols] num capability is number of columns in a line. Columns = iota // The InitTabs [init_tabs, it] num capability is tabs initially every # spaces. InitTabs // The Lines [lines, lines] num capability is number of lines on screen or page. Lines // The LinesOfMemory [lines_of_memory, lm] num capability is lines of memory if > line. 0 means varies. LinesOfMemory // The MagicCookieGlitch [magic_cookie_glitch, xmc] num capability is number of blank characters left by smso or rmso. MagicCookieGlitch // The PaddingBaudRate [padding_baud_rate, pb] num capability is lowest baud rate where padding needed. PaddingBaudRate // The VirtualTerminal [virtual_terminal, vt] num capability is virtual terminal number (CB/unix). VirtualTerminal // The WidthStatusLine [width_status_line, wsl] num capability is number of columns in status line. WidthStatusLine // The NumLabels [num_labels, nlab] num capability is number of labels on screen. NumLabels // The LabelHeight [label_height, lh] num capability is rows in each label. LabelHeight // The LabelWidth [label_width, lw] num capability is columns in each label. LabelWidth // The MaxAttributes [max_attributes, ma] num capability is maximum combined attributes terminal can handle. MaxAttributes // The MaximumWindows [maximum_windows, wnum] num capability is maximum number of definable windows. MaximumWindows // The MaxColors [max_colors, colors] num capability is maximum number of colors on screen. MaxColors // The MaxPairs [max_pairs, pairs] num capability is maximum number of color-pairs on the screen. MaxPairs // The NoColorVideo [no_color_video, ncv] num capability is video attributes that cannot be used with colors. NoColorVideo // The BufferCapacity [buffer_capacity, bufsz] num capability is numbers of bytes buffered before printing. BufferCapacity // The DotVertSpacing [dot_vert_spacing, spinv] num capability is spacing of pins vertically in pins per inch. DotVertSpacing // The DotHorzSpacing [dot_horz_spacing, spinh] num capability is spacing of dots horizontally in dots per inch. DotHorzSpacing // The MaxMicroAddress [max_micro_address, maddr] num capability is maximum value in micro_..._address. MaxMicroAddress // The MaxMicroJump [max_micro_jump, mjump] num capability is maximum value in parm_..._micro. MaxMicroJump // The MicroColSize [micro_col_size, mcs] num capability is character step size when in micro mode. MicroColSize // The MicroLineSize [micro_line_size, mls] num capability is line step size when in micro mode. MicroLineSize // The NumberOfPins [number_of_pins, npins] num capability is numbers of pins in print-head. NumberOfPins // The OutputResChar [output_res_char, orc] num capability is horizontal resolution in units per line. OutputResChar // The OutputResLine [output_res_line, orl] num capability is vertical resolution in units per line. OutputResLine // The OutputResHorzInch [output_res_horz_inch, orhi] num capability is horizontal resolution in units per inch. OutputResHorzInch // The OutputResVertInch [output_res_vert_inch, orvi] num capability is vertical resolution in units per inch. OutputResVertInch // The PrintRate [print_rate, cps] num capability is print rate in characters per second. PrintRate // The WideCharSize [wide_char_size, widcs] num capability is character step size when in double wide mode. WideCharSize // The Buttons [buttons, btns] num capability is number of buttons on mouse. Buttons // The BitImageEntwining [bit_image_entwining, bitwin] num capability is number of passes for each bit-image row. BitImageEntwining // The BitImageType [bit_image_type, bitype] num capability is type of bit-image device. BitImageType // The MagicCookieGlitchUl [magic_cookie_glitch_ul, OTug] num capability is number of blanks left by ul. MagicCookieGlitchUl // The CarriageReturnDelay [carriage_return_delay, OTdC] num capability is pad needed for CR. CarriageReturnDelay // The NewLineDelay [new_line_delay, OTdN] num capability is pad needed for LF. NewLineDelay // The BackspaceDelay [backspace_delay, OTdB] num capability is padding required for ^H. BackspaceDelay // The HorizontalTabDelay [horizontal_tab_delay, OTdT] num capability is padding required for ^I. HorizontalTabDelay // The NumberOfFunctionKeys [number_of_function_keys, OTkn] num capability is count of function keys. NumberOfFunctionKeys ) // String capabilities. const ( // The BackTab [back_tab, cbt] string capability is the back tab (P). BackTab = iota // The Bell [bell, bel] string capability is the audible signal (bell) (P). Bell // The CarriageReturn [carriage_return, cr] string capability is the carriage return (P*) (P*). CarriageReturn // The ChangeScrollRegion [change_scroll_region, csr] string capability is the change region to line #1 to line #2 (P). ChangeScrollRegion // The ClearAllTabs [clear_all_tabs, tbc] string capability is the clear all tab stops (P). ClearAllTabs // The ClearScreen [clear_screen, clear] string capability is the clear screen and home cursor (P*). ClearScreen // The ClrEol [clr_eol, el] string capability is the clear to end of line (P). ClrEol // The ClrEos [clr_eos, ed] string capability is the clear to end of screen (P*). ClrEos // The ColumnAddress [column_address, hpa] string capability is the horizontal position #1, absolute (P). ColumnAddress // The CommandCharacter [command_character, cmdch] string capability is the terminal settable cmd character in prototype !?. CommandCharacter // The CursorAddress [cursor_address, cup] string capability is the move to row #1 columns #2. CursorAddress // The CursorDown [cursor_down, cud1] string capability is the down one line. CursorDown // The CursorHome [cursor_home, home] string capability is the home cursor (if no cup). CursorHome // The CursorInvisible [cursor_invisible, civis] string capability is the make cursor invisible. CursorInvisible // The CursorLeft [cursor_left, cub1] string capability is the move left one space. CursorLeft // The CursorMemAddress [cursor_mem_address, mrcup] string capability is the memory relative cursor addressing, move to row #1 columns #2. CursorMemAddress // The CursorNormal [cursor_normal, cnorm] string capability is the make cursor appear normal (undo civis/cvvis). CursorNormal // The CursorRight [cursor_right, cuf1] string capability is the non-destructive space (move right one space). CursorRight // The CursorToLl [cursor_to_ll, ll] string capability is the last line, first column (if no cup). CursorToLl // The CursorUp [cursor_up, cuu1] string capability is the up one line. CursorUp // The CursorVisible [cursor_visible, cvvis] string capability is the make cursor very visible. CursorVisible // The DeleteCharacter [delete_character, dch1] string capability is the delete character (P*). DeleteCharacter // The DeleteLine [delete_line, dl1] string capability is the delete line (P*). DeleteLine // The DisStatusLine [dis_status_line, dsl] string capability is the disable status line. DisStatusLine // The DownHalfLine [down_half_line, hd] string capability is the half a line down. DownHalfLine // The EnterAltCharsetMode [enter_alt_charset_mode, smacs] string capability is the start alternate character set (P). EnterAltCharsetMode // The EnterBlinkMode [enter_blink_mode, blink] string capability is the turn on blinking. EnterBlinkMode // The EnterBoldMode [enter_bold_mode, bold] string capability is the turn on bold (extra bright) mode. EnterBoldMode // The EnterCaMode [enter_ca_mode, smcup] string capability is the string to start programs using cup. EnterCaMode // The EnterDeleteMode [enter_delete_mode, smdc] string capability is the enter delete mode. EnterDeleteMode // The EnterDimMode [enter_dim_mode, dim] string capability is the turn on half-bright mode. EnterDimMode // The EnterInsertMode [enter_insert_mode, smir] string capability is the enter insert mode. EnterInsertMode // The EnterSecureMode [enter_secure_mode, invis] string capability is the turn on blank mode (characters invisible). EnterSecureMode // The EnterProtectedMode [enter_protected_mode, prot] string capability is the turn on protected mode. EnterProtectedMode // The EnterReverseMode [enter_reverse_mode, rev] string capability is the turn on reverse video mode. EnterReverseMode // The EnterStandoutMode [enter_standout_mode, smso] string capability is the begin standout mode. EnterStandoutMode // The EnterUnderlineMode [enter_underline_mode, smul] string capability is the begin underline mode. EnterUnderlineMode // The EraseChars [erase_chars, ech] string capability is the erase #1 characters (P). EraseChars // The ExitAltCharsetMode [exit_alt_charset_mode, rmacs] string capability is the end alternate character set (P). ExitAltCharsetMode // The ExitAttributeMode [exit_attribute_mode, sgr0] string capability is the turn off all attributes. ExitAttributeMode // The ExitCaMode [exit_ca_mode, rmcup] string capability is the strings to end programs using cup. ExitCaMode // The ExitDeleteMode [exit_delete_mode, rmdc] string capability is the end delete mode. ExitDeleteMode // The ExitInsertMode [exit_insert_mode, rmir] string capability is the exit insert mode. ExitInsertMode // The ExitStandoutMode [exit_standout_mode, rmso] string capability is the exit standout mode. ExitStandoutMode // The ExitUnderlineMode [exit_underline_mode, rmul] string capability is the exit underline mode. ExitUnderlineMode // The FlashScreen [flash_screen, flash] string capability is the visible bell (may not move cursor). FlashScreen // The FormFeed [form_feed, ff] string capability is the hardcopy terminal page eject (P*). FormFeed // The FromStatusLine [from_status_line, fsl] string capability is the return from status line. FromStatusLine // The Init1string [init_1string, is1] string capability is the initialization string. Init1string // The Init2string [init_2string, is2] string capability is the initialization string. Init2string // The Init3string [init_3string, is3] string capability is the initialization string. Init3string // The InitFile [init_file, if] string capability is the name of initialization file. InitFile // The InsertCharacter [insert_character, ich1] string capability is the insert character (P). InsertCharacter // The InsertLine [insert_line, il1] string capability is the insert line (P*). InsertLine // The InsertPadding [insert_padding, ip] string capability is the insert padding after inserted character. InsertPadding // The KeyBackspace [key_backspace, kbs] string capability is the backspace key. KeyBackspace // The KeyCatab [key_catab, ktbc] string capability is the clear-all-tabs key. KeyCatab // The KeyClear [key_clear, kclr] string capability is the clear-screen or erase key. KeyClear // The KeyCtab [key_ctab, kctab] string capability is the clear-tab key. KeyCtab // The KeyDc [key_dc, kdch1] string capability is the delete-character key. KeyDc // The KeyDl [key_dl, kdl1] string capability is the delete-line key. KeyDl // The KeyDown [key_down, kcud1] string capability is the down-arrow key. KeyDown // The KeyEic [key_eic, krmir] string capability is the sent by rmir or smir in insert mode. KeyEic // The KeyEol [key_eol, kel] string capability is the clear-to-end-of-line key. KeyEol // The KeyEos [key_eos, ked] string capability is the clear-to-end-of-screen key. KeyEos // The KeyF0 [key_f0, kf0] string capability is the F0 function key. KeyF0 // The KeyF1 [key_f1, kf1] string capability is the F1 function key. KeyF1 // The KeyF10 [key_f10, kf10] string capability is the F10 function key. KeyF10 // The KeyF2 [key_f2, kf2] string capability is the F2 function key. KeyF2 // The KeyF3 [key_f3, kf3] string capability is the F3 function key. KeyF3 // The KeyF4 [key_f4, kf4] string capability is the F4 function key. KeyF4 // The KeyF5 [key_f5, kf5] string capability is the F5 function key. KeyF5 // The KeyF6 [key_f6, kf6] string capability is the F6 function key. KeyF6 // The KeyF7 [key_f7, kf7] string capability is the F7 function key. KeyF7 // The KeyF8 [key_f8, kf8] string capability is the F8 function key. KeyF8 // The KeyF9 [key_f9, kf9] string capability is the F9 function key. KeyF9 // The KeyHome [key_home, khome] string capability is the home key. KeyHome // The KeyIc [key_ic, kich1] string capability is the insert-character key. KeyIc // The KeyIl [key_il, kil1] string capability is the insert-line key. KeyIl // The KeyLeft [key_left, kcub1] string capability is the left-arrow key. KeyLeft // The KeyLl [key_ll, kll] string capability is the lower-left key (home down). KeyLl // The KeyNpage [key_npage, knp] string capability is the next-page key. KeyNpage // The KeyPpage [key_ppage, kpp] string capability is the previous-page key. KeyPpage // The KeyRight [key_right, kcuf1] string capability is the right-arrow key. KeyRight // The KeySf [key_sf, kind] string capability is the scroll-forward key. KeySf // The KeySr [key_sr, kri] string capability is the scroll-backward key. KeySr // The KeyStab [key_stab, khts] string capability is the set-tab key. KeyStab // The KeyUp [key_up, kcuu1] string capability is the up-arrow key. KeyUp // The KeypadLocal [keypad_local, rmkx] string capability is the leave 'keyboard_transmit' mode. KeypadLocal // The KeypadXmit [keypad_xmit, smkx] string capability is the enter 'keyboard_transmit' mode. KeypadXmit // The LabF0 [lab_f0, lf0] string capability is the label on function key f0 if not f0. LabF0 // The LabF1 [lab_f1, lf1] string capability is the label on function key f1 if not f1. LabF1 // The LabF10 [lab_f10, lf10] string capability is the label on function key f10 if not f10. LabF10 // The LabF2 [lab_f2, lf2] string capability is the label on function key f2 if not f2. LabF2 // The LabF3 [lab_f3, lf3] string capability is the label on function key f3 if not f3. LabF3 // The LabF4 [lab_f4, lf4] string capability is the label on function key f4 if not f4. LabF4 // The LabF5 [lab_f5, lf5] string capability is the label on function key f5 if not f5. LabF5 // The LabF6 [lab_f6, lf6] string capability is the label on function key f6 if not f6. LabF6 // The LabF7 [lab_f7, lf7] string capability is the label on function key f7 if not f7. LabF7 // The LabF8 [lab_f8, lf8] string capability is the label on function key f8 if not f8. LabF8 // The LabF9 [lab_f9, lf9] string capability is the label on function key f9 if not f9. LabF9 // The MetaOff [meta_off, rmm] string capability is the turn off meta mode. MetaOff // The MetaOn [meta_on, smm] string capability is the turn on meta mode (8th-bit on). MetaOn // The Newline [newline, nel] string capability is the newline (behave like cr followed by lf). Newline // The PadChar [pad_char, pad] string capability is the padding char (instead of null). PadChar // The ParmDch [parm_dch, dch] string capability is the delete #1 characters (P*). ParmDch // The ParmDeleteLine [parm_delete_line, dl] string capability is the delete #1 lines (P*). ParmDeleteLine // The ParmDownCursor [parm_down_cursor, cud] string capability is the down #1 lines (P*). ParmDownCursor // The ParmIch [parm_ich, ich] string capability is the insert #1 characters (P*). ParmIch // The ParmIndex [parm_index, indn] string capability is the scroll forward #1 lines (P). ParmIndex // The ParmInsertLine [parm_insert_line, il] string capability is the insert #1 lines (P*). ParmInsertLine // The ParmLeftCursor [parm_left_cursor, cub] string capability is the move #1 characters to the left (P). ParmLeftCursor // The ParmRightCursor [parm_right_cursor, cuf] string capability is the move #1 characters to the right (P*). ParmRightCursor // The ParmRindex [parm_rindex, rin] string capability is the scroll back #1 lines (P). ParmRindex // The ParmUpCursor [parm_up_cursor, cuu] string capability is the up #1 lines (P*). ParmUpCursor // The PkeyKey [pkey_key, pfkey] string capability is the program function key #1 to type string #2. PkeyKey // The PkeyLocal [pkey_local, pfloc] string capability is the program function key #1 to execute string #2. PkeyLocal // The PkeyXmit [pkey_xmit, pfx] string capability is the program function key #1 to transmit string #2. PkeyXmit // The PrintScreen [print_screen, mc0] string capability is the print contents of screen. PrintScreen // The PrtrOff [prtr_off, mc4] string capability is the turn off printer. PrtrOff // The PrtrOn [prtr_on, mc5] string capability is the turn on printer. PrtrOn // The RepeatChar [repeat_char, rep] string capability is the repeat char #1 #2 times (P*). RepeatChar // The Reset1string [reset_1string, rs1] string capability is the reset string. Reset1string // The Reset2string [reset_2string, rs2] string capability is the reset string. Reset2string // The Reset3string [reset_3string, rs3] string capability is the reset string. Reset3string // The ResetFile [reset_file, rf] string capability is the name of reset file. ResetFile // The RestoreCursor [restore_cursor, rc] string capability is the restore cursor to position of last save_cursor. RestoreCursor // The RowAddress [row_address, vpa] string capability is the vertical position #1 absolute (P). RowAddress // The SaveCursor [save_cursor, sc] string capability is the save current cursor position (P). SaveCursor // The ScrollForward [scroll_forward, ind] string capability is the scroll text up (P). ScrollForward // The ScrollReverse [scroll_reverse, ri] string capability is the scroll text down (P). ScrollReverse // The SetAttributes [set_attributes, sgr] string capability is the define video attributes #1-#9 (PG9). SetAttributes // The SetTab [set_tab, hts] string capability is the set a tab in every row, current columns. SetTab // The SetWindow [set_window, wind] string capability is the current window is lines #1-#2 cols #3-#4. SetWindow // The Tab [tab, ht] string capability is the tab to next 8-space hardware tab stop. Tab // The ToStatusLine [to_status_line, tsl] string capability is the move to status line, column #1. ToStatusLine // The UnderlineChar [underline_char, uc] string capability is the underline char and move past it. UnderlineChar // The UpHalfLine [up_half_line, hu] string capability is the half a line up. UpHalfLine // The InitProg [init_prog, iprog] string capability is the path name of program for initialization. InitProg // The KeyA1 [key_a1, ka1] string capability is the upper left of keypad. KeyA1 // The KeyA3 [key_a3, ka3] string capability is the upper right of keypad. KeyA3 // The KeyB2 [key_b2, kb2] string capability is the center of keypad. KeyB2 // The KeyC1 [key_c1, kc1] string capability is the lower left of keypad. KeyC1 // The KeyC3 [key_c3, kc3] string capability is the lower right of keypad. KeyC3 // The PrtrNon [prtr_non, mc5p] string capability is the turn on printer for #1 bytes. PrtrNon // The CharPadding [char_padding, rmp] string capability is the like ip but when in insert mode. CharPadding // The AcsChars [acs_chars, acsc] string capability is the graphics charset pairs, based on vt100. AcsChars // The PlabNorm [plab_norm, pln] string capability is the program label #1 to show string #2. PlabNorm // The KeyBtab [key_btab, kcbt] string capability is the back-tab key. KeyBtab // The EnterXonMode [enter_xon_mode, smxon] string capability is the turn on xon/xoff handshaking. EnterXonMode // The ExitXonMode [exit_xon_mode, rmxon] string capability is the turn off xon/xoff handshaking. ExitXonMode // The EnterAmMode [enter_am_mode, smam] string capability is the turn on automatic margins. EnterAmMode // The ExitAmMode [exit_am_mode, rmam] string capability is the turn off automatic margins. ExitAmMode // The XonCharacter [xon_character, xonc] string capability is the XON character. XonCharacter // The XoffCharacter [xoff_character, xoffc] string capability is the XOFF character. XoffCharacter // The EnaAcs [ena_acs, enacs] string capability is the enable alternate char set. EnaAcs // The LabelOn [label_on, smln] string capability is the turn on soft labels. LabelOn // The LabelOff [label_off, rmln] string capability is the turn off soft labels. LabelOff // The KeyBeg [key_beg, kbeg] string capability is the begin key. KeyBeg // The KeyCancel [key_cancel, kcan] string capability is the cancel key. KeyCancel // The KeyClose [key_close, kclo] string capability is the close key. KeyClose // The KeyCommand [key_command, kcmd] string capability is the command key. KeyCommand // The KeyCopy [key_copy, kcpy] string capability is the copy key. KeyCopy // The KeyCreate [key_create, kcrt] string capability is the create key. KeyCreate // The KeyEnd [key_end, kend] string capability is the end key. KeyEnd // The KeyEnter [key_enter, kent] string capability is the enter/send key. KeyEnter // The KeyExit [key_exit, kext] string capability is the exit key. KeyExit // The KeyFind [key_find, kfnd] string capability is the find key. KeyFind // The KeyHelp [key_help, khlp] string capability is the help key. KeyHelp // The KeyMark [key_mark, kmrk] string capability is the mark key. KeyMark // The KeyMessage [key_message, kmsg] string capability is the message key. KeyMessage // The KeyMove [key_move, kmov] string capability is the move key. KeyMove // The KeyNext [key_next, knxt] string capability is the next key. KeyNext // The KeyOpen [key_open, kopn] string capability is the open key. KeyOpen // The KeyOptions [key_options, kopt] string capability is the options key. KeyOptions // The KeyPrevious [key_previous, kprv] string capability is the previous key. KeyPrevious // The KeyPrint [key_print, kprt] string capability is the print key. KeyPrint // The KeyRedo [key_redo, krdo] string capability is the redo key. KeyRedo // The KeyReference [key_reference, kref] string capability is the reference key. KeyReference // The KeyRefresh [key_refresh, krfr] string capability is the refresh key. KeyRefresh // The KeyReplace [key_replace, krpl] string capability is the replace key. KeyReplace // The KeyRestart [key_restart, krst] string capability is the restart key. KeyRestart // The KeyResume [key_resume, kres] string capability is the resume key. KeyResume // The KeySave [key_save, ksav] string capability is the save key. KeySave // The KeySuspend [key_suspend, kspd] string capability is the suspend key. KeySuspend // The KeyUndo [key_undo, kund] string capability is the undo key. KeyUndo // The KeySbeg [key_sbeg, kBEG] string capability is the shifted begin key. KeySbeg // The KeyScancel [key_scancel, kCAN] string capability is the shifted cancel key. KeyScancel // The KeyScommand [key_scommand, kCMD] string capability is the shifted command key. KeyScommand // The KeyScopy [key_scopy, kCPY] string capability is the shifted copy key. KeyScopy // The KeyScreate [key_screate, kCRT] string capability is the shifted create key. KeyScreate // The KeySdc [key_sdc, kDC] string capability is the shifted delete-character key. KeySdc // The KeySdl [key_sdl, kDL] string capability is the shifted delete-line key. KeySdl // The KeySelect [key_select, kslt] string capability is the select key. KeySelect // The KeySend [key_send, kEND] string capability is the shifted end key. KeySend // The KeySeol [key_seol, kEOL] string capability is the shifted clear-to-end-of-line key. KeySeol // The KeySexit [key_sexit, kEXT] string capability is the shifted exit key. KeySexit // The KeySfind [key_sfind, kFND] string capability is the shifted find key. KeySfind // The KeyShelp [key_shelp, kHLP] string capability is the shifted help key. KeyShelp // The KeyShome [key_shome, kHOM] string capability is the shifted home key. KeyShome // The KeySic [key_sic, kIC] string capability is the shifted insert-character key. KeySic // The KeySleft [key_sleft, kLFT] string capability is the shifted left-arrow key. KeySleft // The KeySmessage [key_smessage, kMSG] string capability is the shifted message key. KeySmessage // The KeySmove [key_smove, kMOV] string capability is the shifted move key. KeySmove // The KeySnext [key_snext, kNXT] string capability is the shifted next key. KeySnext // The KeySoptions [key_soptions, kOPT] string capability is the shifted options key. KeySoptions // The KeySprevious [key_sprevious, kPRV] string capability is the shifted previous key. KeySprevious // The KeySprint [key_sprint, kPRT] string capability is the shifted print key. KeySprint // The KeySredo [key_sredo, kRDO] string capability is the shifted redo key. KeySredo // The KeySreplace [key_sreplace, kRPL] string capability is the shifted replace key. KeySreplace // The KeySright [key_sright, kRIT] string capability is the shifted right-arrow key. KeySright // The KeySrsume [key_srsume, kRES] string capability is the shifted resume key. KeySrsume // The KeySsave [key_ssave, kSAV] string capability is the shifted save key. KeySsave // The KeySsuspend [key_ssuspend, kSPD] string capability is the shifted suspend key. KeySsuspend // The KeySundo [key_sundo, kUND] string capability is the shifted undo key. KeySundo // The ReqForInput [req_for_input, rfi] string capability is the send next input char (for ptys). ReqForInput // The KeyF11 [key_f11, kf11] string capability is the F11 function key. KeyF11 // The KeyF12 [key_f12, kf12] string capability is the F12 function key. KeyF12 // The KeyF13 [key_f13, kf13] string capability is the F13 function key. KeyF13 // The KeyF14 [key_f14, kf14] string capability is the F14 function key. KeyF14 // The KeyF15 [key_f15, kf15] string capability is the F15 function key. KeyF15 // The KeyF16 [key_f16, kf16] string capability is the F16 function key. KeyF16 // The KeyF17 [key_f17, kf17] string capability is the F17 function key. KeyF17 // The KeyF18 [key_f18, kf18] string capability is the F18 function key. KeyF18 // The KeyF19 [key_f19, kf19] string capability is the F19 function key. KeyF19 // The KeyF20 [key_f20, kf20] string capability is the F20 function key. KeyF20 // The KeyF21 [key_f21, kf21] string capability is the F21 function key. KeyF21 // The KeyF22 [key_f22, kf22] string capability is the F22 function key. KeyF22 // The KeyF23 [key_f23, kf23] string capability is the F23 function key. KeyF23 // The KeyF24 [key_f24, kf24] string capability is the F24 function key. KeyF24 // The KeyF25 [key_f25, kf25] string capability is the F25 function key. KeyF25 // The KeyF26 [key_f26, kf26] string capability is the F26 function key. KeyF26 // The KeyF27 [key_f27, kf27] string capability is the F27 function key. KeyF27
go
MIT
f4fc3669ca8eb67aa350a76503397192bf26f057
2026-01-07T08:35:43.570558Z
true
jesseduffield/lazydocker
https://github.com/jesseduffield/lazydocker/blob/f4fc3669ca8eb67aa350a76503397192bf26f057/vendor/github.com/xo/terminfo/util.go
vendor/github.com/xo/terminfo/util.go
package terminfo import ( "sort" ) const ( // maxFileLength is the max file length. maxFileLength = 4096 // magic is the file magic for terminfo files. magic = 0432 // magicExtended is the file magic for terminfo files with the extended number format. magicExtended = 01036 ) // header fields. const ( fieldMagic = iota fieldNameSize fieldBoolCount fieldNumCount fieldStringCount fieldTableSize ) // header extended fields. const ( fieldExtBoolCount = iota fieldExtNumCount fieldExtStringCount fieldExtOffsetCount fieldExtTableSize ) // hasInvalidCaps determines if the capabilities in h are invalid. func hasInvalidCaps(h []int) bool { return h[fieldBoolCount] > CapCountBool || h[fieldNumCount] > CapCountNum || h[fieldStringCount] > CapCountString } // capLength returns the total length of the capabilities in bytes. func capLength(h []int) int { return h[fieldNameSize] + h[fieldBoolCount] + (h[fieldNameSize]+h[fieldBoolCount])%2 + // account for word align h[fieldNumCount]*2 + h[fieldStringCount]*2 + h[fieldTableSize] } // hasInvalidExtOffset determines if the extended offset field is valid. func hasInvalidExtOffset(h []int) bool { return h[fieldExtBoolCount]+ h[fieldExtNumCount]+ h[fieldExtStringCount]*2 != h[fieldExtOffsetCount] } // extCapLength returns the total length of extended capabilities in bytes. func extCapLength(h []int, numWidth int) int { return h[fieldExtBoolCount] + h[fieldExtBoolCount]%2 + // account for word align h[fieldExtNumCount]*(numWidth/8) + h[fieldExtOffsetCount]*2 + h[fieldExtTableSize] } // findNull finds the position of null in buf. func findNull(buf []byte, i int) int { for ; i < len(buf); i++ { if buf[i] == 0 { return i } } return -1 } // readStrings decodes n strings from string data table buf using the indexes in idx. func readStrings(idx []int, buf []byte, n int) (map[int][]byte, int, error) { var last int m := make(map[int][]byte) for i := 0; i < n; i++ { start := idx[i] if start < 0 { continue } if end := findNull(buf, start); end != -1 { m[i], last = buf[start:end], end+1 } else { return nil, 0, ErrInvalidStringTable } } return m, last, nil } // decoder holds state info while decoding a terminfo file. type decoder struct { buf []byte pos int len int } // readBytes reads the next n bytes of buf, incrementing pos by n. func (d *decoder) readBytes(n int) ([]byte, error) { if d.len < d.pos+n { return nil, ErrUnexpectedFileEnd } n, d.pos = d.pos, d.pos+n return d.buf[n:d.pos], nil } // readInts reads n number of ints with width w. func (d *decoder) readInts(n, w int) ([]int, error) { w /= 8 l := n * w buf, err := d.readBytes(l) if err != nil { return nil, err } // align d.pos += d.pos % 2 z := make([]int, n) for i, j := 0, 0; i < l; i, j = i+w, j+1 { switch w { case 1: z[i] = int(buf[i]) case 2: z[j] = int(int16(buf[i+1])<<8 | int16(buf[i])) case 4: z[j] = int(buf[i+3])<<24 | int(buf[i+2])<<16 | int(buf[i+1])<<8 | int(buf[i]) } } return z, nil } // readBools reads the next n bools. func (d *decoder) readBools(n int) (map[int]bool, map[int]bool, error) { buf, err := d.readInts(n, 8) if err != nil { return nil, nil, err } // process bools, boolsM := make(map[int]bool), make(map[int]bool) for i, b := range buf { bools[i] = b == 1 if int8(b) == -2 { boolsM[i] = true } } return bools, boolsM, nil } // readNums reads the next n nums. func (d *decoder) readNums(n, w int) (map[int]int, map[int]bool, error) { buf, err := d.readInts(n, w) if err != nil { return nil, nil, err } // process nums, numsM := make(map[int]int), make(map[int]bool) for i := 0; i < n; i++ { nums[i] = buf[i] if buf[i] == -2 { numsM[i] = true } } return nums, numsM, nil } // readStringTable reads the string data for n strings and the accompanying data // table of length sz. func (d *decoder) readStringTable(n, sz int) ([][]byte, []int, error) { buf, err := d.readInts(n, 16) if err != nil { return nil, nil, err } // read string data table data, err := d.readBytes(sz) if err != nil { return nil, nil, err } // align d.pos += d.pos % 2 // process s := make([][]byte, n) var m []int for i := 0; i < n; i++ { start := buf[i] if start == -2 { m = append(m, i) } else if start >= 0 { if end := findNull(data, start); end != -1 { s[i] = data[start:end] } else { return nil, nil, ErrInvalidStringTable } } } return s, m, nil } // readStrings reads the next n strings and processes the string data table of // length sz. func (d *decoder) readStrings(n, sz int) (map[int][]byte, map[int]bool, error) { s, m, err := d.readStringTable(n, sz) if err != nil { return nil, nil, err } strs := make(map[int][]byte) for k, v := range s { if k == AcsChars { v = canonicalizeAscChars(v) } strs[k] = v } strsM := make(map[int]bool, len(m)) for _, k := range m { strsM[k] = true } return strs, strsM, nil } // canonicalizeAscChars reorders chars to be unique, in order. // // see repair_ascc in ncurses-6.0/progs/dump_entry.c func canonicalizeAscChars(z []byte) []byte { var c chars enc := make(map[byte]byte, len(z)/2) for i := 0; i < len(z); i += 2 { if _, ok := enc[z[i]]; !ok { a, b := z[i], z[i+1] //log.Printf(">>> a: %d %c, b: %d %c", a, a, b, b) c, enc[a] = append(c, b), b } } sort.Sort(c) r := make([]byte, 2*len(c)) for i := 0; i < len(c); i++ { r[i*2], r[i*2+1] = c[i], enc[c[i]] } return r } type chars []byte func (c chars) Len() int { return len(c) } func (c chars) Swap(i, j int) { c[i], c[j] = c[j], c[i] } func (c chars) Less(i, j int) bool { return c[i] < c[j] }
go
MIT
f4fc3669ca8eb67aa350a76503397192bf26f057
2026-01-07T08:35:43.570558Z
false
jesseduffield/lazydocker
https://github.com/jesseduffield/lazydocker/blob/f4fc3669ca8eb67aa350a76503397192bf26f057/vendor/github.com/xo/terminfo/load.go
vendor/github.com/xo/terminfo/load.go
package terminfo import ( "os" "os/user" "path" "strings" "sync" ) // termCache is the terminfo cache. var termCache = struct { db map[string]*Terminfo sync.RWMutex }{ db: make(map[string]*Terminfo), } // Load follows the behavior described in terminfo(5) to find correct the // terminfo file using the name, reads the file and then returns a Terminfo // struct that describes the file. func Load(name string) (*Terminfo, error) { if name == "" { return nil, ErrEmptyTermName } termCache.RLock() ti, ok := termCache.db[name] termCache.RUnlock() if ok { return ti, nil } var checkDirs []string // check $TERMINFO if dir := os.Getenv("TERMINFO"); dir != "" { checkDirs = append(checkDirs, dir) } // check $HOME/.terminfo u, err := user.Current() if err != nil { return nil, err } checkDirs = append(checkDirs, path.Join(u.HomeDir, ".terminfo")) // check $TERMINFO_DIRS if dirs := os.Getenv("TERMINFO_DIRS"); dirs != "" { checkDirs = append(checkDirs, strings.Split(dirs, ":")...) } // check fallback directories checkDirs = append(checkDirs, "/etc/terminfo", "/lib/terminfo", "/usr/share/terminfo") for _, dir := range checkDirs { ti, err = Open(dir, name) if err != nil && err != ErrFileNotFound && !os.IsNotExist(err) { return nil, err } else if err == nil { return ti, nil } } return nil, ErrDatabaseDirectoryNotFound } // LoadFromEnv loads the terminal info based on the name contained in // environment variable TERM. func LoadFromEnv() (*Terminfo, error) { return Load(os.Getenv("TERM")) }
go
MIT
f4fc3669ca8eb67aa350a76503397192bf26f057
2026-01-07T08:35:43.570558Z
false
jesseduffield/lazydocker
https://github.com/jesseduffield/lazydocker/blob/f4fc3669ca8eb67aa350a76503397192bf26f057/vendor/github.com/xo/terminfo/stack.go
vendor/github.com/xo/terminfo/stack.go
package terminfo type stack []interface{} func (s *stack) push(v interface{}) { *s = append(*s, v) } func (s *stack) pop() interface{} { if len(*s) == 0 { return nil } v := (*s)[len(*s)-1] *s = (*s)[:len(*s)-1] return v } func (s *stack) popInt() int { if i, ok := s.pop().(int); ok { return i } return 0 } func (s *stack) popBool() bool { if b, ok := s.pop().(bool); ok { return b } return false } func (s *stack) popByte() byte { if b, ok := s.pop().(byte); ok { return b } return 0 } func (s *stack) popString() string { if a, ok := s.pop().(string); ok { return a } return "" } func (s *stack) reset() { *s = (*s)[:0] }
go
MIT
f4fc3669ca8eb67aa350a76503397192bf26f057
2026-01-07T08:35:43.570558Z
false
jesseduffield/lazydocker
https://github.com/jesseduffield/lazydocker/blob/f4fc3669ca8eb67aa350a76503397192bf26f057/vendor/github.com/xo/terminfo/color.go
vendor/github.com/xo/terminfo/color.go
package terminfo import ( "os" "strconv" "strings" ) // ColorLevel is the color level supported by a terminal. type ColorLevel uint // ColorLevel values. const ( ColorLevelNone ColorLevel = iota ColorLevelBasic ColorLevelHundreds ColorLevelMillions ) // String satisfies the Stringer interface. func (c ColorLevel) String() string { switch c { case ColorLevelBasic: return "basic" case ColorLevelHundreds: return "hundreds" case ColorLevelMillions: return "millions" } return "none" } // ChromaFormatterName returns the github.com/alecthomas/chroma compatible // formatter name for the color level. func (c ColorLevel) ChromaFormatterName() string { switch c { case ColorLevelBasic: return "terminal" case ColorLevelHundreds: return "terminal256" case ColorLevelMillions: return "terminal16m" } return "noop" } // ColorLevelFromEnv returns the color level COLORTERM, FORCE_COLOR, // TERM_PROGRAM, or determined from the TERM environment variable. func ColorLevelFromEnv() (ColorLevel, error) { // check for overriding environment variables colorTerm, termProg, forceColor := os.Getenv("COLORTERM"), os.Getenv("TERM_PROGRAM"), os.Getenv("FORCE_COLOR") switch { case strings.Contains(colorTerm, "truecolor") || strings.Contains(colorTerm, "24bit") || termProg == "Hyper": return ColorLevelMillions, nil case colorTerm != "" || forceColor != "": return ColorLevelBasic, nil case termProg == "Apple_Terminal": return ColorLevelHundreds, nil case termProg == "iTerm.app": ver := os.Getenv("TERM_PROGRAM_VERSION") if ver == "" { return ColorLevelHundreds, nil } i, err := strconv.Atoi(strings.Split(ver, ".")[0]) if err != nil { return ColorLevelNone, ErrInvalidTermProgramVersion } if i == 3 { return ColorLevelMillions, nil } return ColorLevelHundreds, nil } // otherwise determine from TERM's max_colors capability if term := os.Getenv("TERM"); term != "" { ti, err := Load(term) if err != nil { return ColorLevelNone, err } v, ok := ti.Nums[MaxColors] switch { case !ok || v <= 16: return ColorLevelNone, nil case ok && v >= 256: return ColorLevelHundreds, nil } } return ColorLevelBasic, nil }
go
MIT
f4fc3669ca8eb67aa350a76503397192bf26f057
2026-01-07T08:35:43.570558Z
false
jesseduffield/lazydocker
https://github.com/jesseduffield/lazydocker/blob/f4fc3669ca8eb67aa350a76503397192bf26f057/vendor/github.com/xo/terminfo/param.go
vendor/github.com/xo/terminfo/param.go
package terminfo import ( "bytes" "fmt" "io" "strconv" "strings" "sync" ) // parametizer represents the a scan state for a parameterized string. type parametizer struct { // z is the string to parameterize z []byte // pos is the current position in s. pos int // nest is the current nest level. nest int // s is the variable stack. s stack // skipElse keeps the state of skipping else. skipElse bool // buf is the result buffer. buf *bytes.Buffer // params are the parameters to interpolate. params [9]interface{} // vars are dynamic variables. vars [26]interface{} } // staticVars are the static, global variables. var staticVars = struct { vars [26]interface{} sync.Mutex }{} var parametizerPool = sync.Pool{ New: func() interface{} { p := new(parametizer) p.buf = bytes.NewBuffer(make([]byte, 0, 45)) return p }, } // newParametizer returns a new initialized parametizer from the pool. func newParametizer(z []byte) *parametizer { p := parametizerPool.Get().(*parametizer) p.z = z return p } // reset resets the parametizer. func (p *parametizer) reset() { p.pos, p.nest = 0, 0 p.s.reset() p.buf.Reset() p.params, p.vars = [9]interface{}{}, [26]interface{}{} parametizerPool.Put(p) } // stateFn represents the state of the scanner as a function that returns the // next state. type stateFn func() stateFn // exec executes the parameterizer, interpolating the supplied parameters. func (p *parametizer) exec() string { for state := p.scanTextFn; state != nil; { state = state() } return p.buf.String() } // peek returns the next byte. func (p *parametizer) peek() (byte, error) { if p.pos >= len(p.z) { return 0, io.EOF } return p.z[p.pos], nil } // writeFrom writes the characters from ppos to pos to the buffer. func (p *parametizer) writeFrom(ppos int) { if p.pos > ppos { // append remaining characters. p.buf.Write(p.z[ppos:p.pos]) } } func (p *parametizer) scanTextFn() stateFn { ppos := p.pos for { ch, err := p.peek() if err != nil { p.writeFrom(ppos) return nil } if ch == '%' { p.writeFrom(ppos) p.pos++ return p.scanCodeFn } p.pos++ } } func (p *parametizer) scanCodeFn() stateFn { ch, err := p.peek() if err != nil { return nil } switch ch { case '%': p.buf.WriteByte('%') case ':': // this character is used to avoid interpreting "%-" and "%+" as operators. // the next character is where the format really begins. p.pos++ _, err = p.peek() if err != nil { return nil } return p.scanFormatFn case '#', ' ', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '.': return p.scanFormatFn case 'o': p.buf.WriteString(strconv.FormatInt(int64(p.s.popInt()), 8)) case 'd': p.buf.WriteString(strconv.Itoa(p.s.popInt())) case 'x': p.buf.WriteString(strconv.FormatInt(int64(p.s.popInt()), 16)) case 'X': p.buf.WriteString(strings.ToUpper(strconv.FormatInt(int64(p.s.popInt()), 16))) case 's': p.buf.WriteString(p.s.popString()) case 'c': p.buf.WriteByte(p.s.popByte()) case 'p': p.pos++ return p.pushParamFn case 'P': p.pos++ return p.setDsVarFn case 'g': p.pos++ return p.getDsVarFn case '\'': p.pos++ ch, err = p.peek() if err != nil { return nil } p.s.push(ch) // skip the '\'' p.pos++ case '{': p.pos++ return p.pushIntfn case 'l': p.s.push(len(p.s.popString())) case '+': bi, ai := p.s.popInt(), p.s.popInt() p.s.push(ai + bi) case '-': bi, ai := p.s.popInt(), p.s.popInt() p.s.push(ai - bi) case '*': bi, ai := p.s.popInt(), p.s.popInt() p.s.push(ai * bi) case '/': bi, ai := p.s.popInt(), p.s.popInt() if bi != 0 { p.s.push(ai / bi) } else { p.s.push(0) } case 'm': bi, ai := p.s.popInt(), p.s.popInt() if bi != 0 { p.s.push(ai % bi) } else { p.s.push(0) } case '&': bi, ai := p.s.popInt(), p.s.popInt() p.s.push(ai & bi) case '|': bi, ai := p.s.popInt(), p.s.popInt() p.s.push(ai | bi) case '^': bi, ai := p.s.popInt(), p.s.popInt() p.s.push(ai ^ bi) case '=': bi, ai := p.s.popInt(), p.s.popInt() p.s.push(ai == bi) case '>': bi, ai := p.s.popInt(), p.s.popInt() p.s.push(ai > bi) case '<': bi, ai := p.s.popInt(), p.s.popInt() p.s.push(ai < bi) case 'A': bi, ai := p.s.popBool(), p.s.popBool() p.s.push(ai && bi) case 'O': bi, ai := p.s.popBool(), p.s.popBool() p.s.push(ai || bi) case '!': p.s.push(!p.s.popBool()) case '~': p.s.push(^p.s.popInt()) case 'i': for i := range p.params[:2] { if n, ok := p.params[i].(int); ok { p.params[i] = n + 1 } } case '?', ';': case 't': return p.scanThenFn case 'e': p.skipElse = true return p.skipTextFn } p.pos++ return p.scanTextFn } func (p *parametizer) scanFormatFn() stateFn { // the character was already read, so no need to check the error. ch, _ := p.peek() // 6 should be the maximum length of a format string, for example "%:-9.9d". f := []byte{'%', ch, 0, 0, 0, 0} var err error for { p.pos++ ch, err = p.peek() if err != nil { return nil } f = append(f, ch) switch ch { case 'o', 'd', 'x', 'X': fmt.Fprintf(p.buf, string(f), p.s.popInt()) break case 's': fmt.Fprintf(p.buf, string(f), p.s.popString()) break case 'c': fmt.Fprintf(p.buf, string(f), p.s.popByte()) break } } p.pos++ return p.scanTextFn } func (p *parametizer) pushParamFn() stateFn { ch, err := p.peek() if err != nil { return nil } if ai := int(ch - '1'); ai >= 0 && ai < len(p.params) { p.s.push(p.params[ai]) } else { p.s.push(0) } // skip the '}' p.pos++ return p.scanTextFn } func (p *parametizer) setDsVarFn() stateFn { ch, err := p.peek() if err != nil { return nil } if ch >= 'A' && ch <= 'Z' { staticVars.Lock() staticVars.vars[int(ch-'A')] = p.s.pop() staticVars.Unlock() } else if ch >= 'a' && ch <= 'z' { p.vars[int(ch-'a')] = p.s.pop() } p.pos++ return p.scanTextFn } func (p *parametizer) getDsVarFn() stateFn { ch, err := p.peek() if err != nil { return nil } var a byte if ch >= 'A' && ch <= 'Z' { a = 'A' } else if ch >= 'a' && ch <= 'z' { a = 'a' } staticVars.Lock() p.s.push(staticVars.vars[int(ch-a)]) staticVars.Unlock() p.pos++ return p.scanTextFn } func (p *parametizer) pushIntfn() stateFn { var ai int for { ch, err := p.peek() if err != nil { return nil } p.pos++ if ch < '0' || ch > '9' { p.s.push(ai) return p.scanTextFn } ai = (ai * 10) + int(ch-'0') } } func (p *parametizer) scanThenFn() stateFn { p.pos++ if p.s.popBool() { return p.scanTextFn } p.skipElse = false return p.skipTextFn } func (p *parametizer) skipTextFn() stateFn { for { ch, err := p.peek() if err != nil { return nil } p.pos++ if ch == '%' { break } } if p.skipElse { return p.skipElseFn } return p.skipThenFn } func (p *parametizer) skipThenFn() stateFn { ch, err := p.peek() if err != nil { return nil } p.pos++ switch ch { case ';': if p.nest == 0 { return p.scanTextFn } p.nest-- case '?': p.nest++ case 'e': if p.nest == 0 { return p.scanTextFn } } return p.skipTextFn } func (p *parametizer) skipElseFn() stateFn { ch, err := p.peek() if err != nil { return nil } p.pos++ switch ch { case ';': if p.nest == 0 { return p.scanTextFn } p.nest-- case '?': p.nest++ } return p.skipTextFn } // Printf evaluates a parameterized terminfo value z, interpolating params. func Printf(z []byte, params ...interface{}) string { p := newParametizer(z) defer p.reset() // make sure we always have 9 parameters -- makes it easier // later to skip checks and its faster for i := 0; i < len(p.params) && i < len(params); i++ { p.params[i] = params[i] } return p.exec() } // Fprintf evaluates a parameterized terminfo value z, interpolating params and // writing to w. func Fprintf(w io.Writer, z []byte, params ...interface{}) { w.Write([]byte(Printf(z, params...))) }
go
MIT
f4fc3669ca8eb67aa350a76503397192bf26f057
2026-01-07T08:35:43.570558Z
false
jesseduffield/lazydocker
https://github.com/jesseduffield/lazydocker/blob/f4fc3669ca8eb67aa350a76503397192bf26f057/vendor/github.com/xo/terminfo/caps.go
vendor/github.com/xo/terminfo/caps.go
package terminfo //go:generate go run gen.go // BoolCapName returns the bool capability name. func BoolCapName(i int) string { return boolCapNames[2*i] } // BoolCapNameShort returns the short bool capability name. func BoolCapNameShort(i int) string { return boolCapNames[2*i+1] } // NumCapName returns the num capability name. func NumCapName(i int) string { return numCapNames[2*i] } // NumCapNameShort returns the short num capability name. func NumCapNameShort(i int) string { return numCapNames[2*i+1] } // StringCapName returns the string capability name. func StringCapName(i int) string { return stringCapNames[2*i] } // StringCapNameShort returns the short string capability name. func StringCapNameShort(i int) string { return stringCapNames[2*i+1] }
go
MIT
f4fc3669ca8eb67aa350a76503397192bf26f057
2026-01-07T08:35:43.570558Z
false
jesseduffield/lazydocker
https://github.com/jesseduffield/lazydocker/blob/f4fc3669ca8eb67aa350a76503397192bf26f057/vendor/github.com/go-logr/logr/logr.go
vendor/github.com/go-logr/logr/logr.go
/* Copyright 2019 The logr Authors. 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. */ // This design derives from Dave Cheney's blog: // http://dave.cheney.net/2015/11/05/lets-talk-about-logging // Package logr defines a general-purpose logging API and abstract interfaces // to back that API. Packages in the Go ecosystem can depend on this package, // while callers can implement logging with whatever backend is appropriate. // // # Usage // // Logging is done using a Logger instance. Logger is a concrete type with // methods, which defers the actual logging to a LogSink interface. The main // methods of Logger are Info() and Error(). Arguments to Info() and Error() // are key/value pairs rather than printf-style formatted strings, emphasizing // "structured logging". // // With Go's standard log package, we might write: // // log.Printf("setting target value %s", targetValue) // // With logr's structured logging, we'd write: // // logger.Info("setting target", "value", targetValue) // // Errors are much the same. Instead of: // // log.Printf("failed to open the pod bay door for user %s: %v", user, err) // // We'd write: // // logger.Error(err, "failed to open the pod bay door", "user", user) // // Info() and Error() are very similar, but they are separate methods so that // LogSink implementations can choose to do things like attach additional // information (such as stack traces) on calls to Error(). Error() messages are // always logged, regardless of the current verbosity. If there is no error // instance available, passing nil is valid. // // # Verbosity // // Often we want to log information only when the application in "verbose // mode". To write log lines that are more verbose, Logger has a V() method. // The higher the V-level of a log line, the less critical it is considered. // Log-lines with V-levels that are not enabled (as per the LogSink) will not // be written. Level V(0) is the default, and logger.V(0).Info() has the same // meaning as logger.Info(). Negative V-levels have the same meaning as V(0). // Error messages do not have a verbosity level and are always logged. // // Where we might have written: // // if flVerbose >= 2 { // log.Printf("an unusual thing happened") // } // // We can write: // // logger.V(2).Info("an unusual thing happened") // // # Logger Names // // Logger instances can have name strings so that all messages logged through // that instance have additional context. For example, you might want to add // a subsystem name: // // logger.WithName("compactor").Info("started", "time", time.Now()) // // The WithName() method returns a new Logger, which can be passed to // constructors or other functions for further use. Repeated use of WithName() // will accumulate name "segments". These name segments will be joined in some // way by the LogSink implementation. It is strongly recommended that name // segments contain simple identifiers (letters, digits, and hyphen), and do // not contain characters that could muddle the log output or confuse the // joining operation (e.g. whitespace, commas, periods, slashes, brackets, // quotes, etc). // // # Saved Values // // Logger instances can store any number of key/value pairs, which will be // logged alongside all messages logged through that instance. For example, // you might want to create a Logger instance per managed object: // // With the standard log package, we might write: // // log.Printf("decided to set field foo to value %q for object %s/%s", // targetValue, object.Namespace, object.Name) // // With logr we'd write: // // // Elsewhere: set up the logger to log the object name. // obj.logger = mainLogger.WithValues( // "name", obj.name, "namespace", obj.namespace) // // // later on... // obj.logger.Info("setting foo", "value", targetValue) // // # Best Practices // // Logger has very few hard rules, with the goal that LogSink implementations // might have a lot of freedom to differentiate. There are, however, some // things to consider. // // The log message consists of a constant message attached to the log line. // This should generally be a simple description of what's occurring, and should // never be a format string. Variable information can then be attached using // named values. // // Keys are arbitrary strings, but should generally be constant values. Values // may be any Go value, but how the value is formatted is determined by the // LogSink implementation. // // Logger instances are meant to be passed around by value. Code that receives // such a value can call its methods without having to check whether the // instance is ready for use. // // The zero logger (= Logger{}) is identical to Discard() and discards all log // entries. Code that receives a Logger by value can simply call it, the methods // will never crash. For cases where passing a logger is optional, a pointer to Logger // should be used. // // # Key Naming Conventions // // Keys are not strictly required to conform to any specification or regex, but // it is recommended that they: // - be human-readable and meaningful (not auto-generated or simple ordinals) // - be constant (not dependent on input data) // - contain only printable characters // - not contain whitespace or punctuation // - use lower case for simple keys and lowerCamelCase for more complex ones // // These guidelines help ensure that log data is processed properly regardless // of the log implementation. For example, log implementations will try to // output JSON data or will store data for later database (e.g. SQL) queries. // // While users are generally free to use key names of their choice, it's // generally best to avoid using the following keys, as they're frequently used // by implementations: // - "caller": the calling information (file/line) of a particular log line // - "error": the underlying error value in the `Error` method // - "level": the log level // - "logger": the name of the associated logger // - "msg": the log message // - "stacktrace": the stack trace associated with a particular log line or // error (often from the `Error` message) // - "ts": the timestamp for a log line // // Implementations are encouraged to make use of these keys to represent the // above concepts, when necessary (for example, in a pure-JSON output form, it // would be necessary to represent at least message and timestamp as ordinary // named values). // // # Break Glass // // Implementations may choose to give callers access to the underlying // logging implementation. The recommended pattern for this is: // // // Underlier exposes access to the underlying logging implementation. // // Since callers only have a logr.Logger, they have to know which // // implementation is in use, so this interface is less of an abstraction // // and more of way to test type conversion. // type Underlier interface { // GetUnderlying() <underlying-type> // } // // Logger grants access to the sink to enable type assertions like this: // // func DoSomethingWithImpl(log logr.Logger) { // if underlier, ok := log.GetSink().(impl.Underlier); ok { // implLogger := underlier.GetUnderlying() // ... // } // } // // Custom `With*` functions can be implemented by copying the complete // Logger struct and replacing the sink in the copy: // // // WithFooBar changes the foobar parameter in the log sink and returns a // // new logger with that modified sink. It does nothing for loggers where // // the sink doesn't support that parameter. // func WithFoobar(log logr.Logger, foobar int) logr.Logger { // if foobarLogSink, ok := log.GetSink().(FoobarSink); ok { // log = log.WithSink(foobarLogSink.WithFooBar(foobar)) // } // return log // } // // Don't use New to construct a new Logger with a LogSink retrieved from an // existing Logger. Source code attribution might not work correctly and // unexported fields in Logger get lost. // // Beware that the same LogSink instance may be shared by different logger // instances. Calling functions that modify the LogSink will affect all of // those. package logr // New returns a new Logger instance. This is primarily used by libraries // implementing LogSink, rather than end users. Passing a nil sink will create // a Logger which discards all log lines. func New(sink LogSink) Logger { logger := Logger{} logger.setSink(sink) if sink != nil { sink.Init(runtimeInfo) } return logger } // setSink stores the sink and updates any related fields. It mutates the // logger and thus is only safe to use for loggers that are not currently being // used concurrently. func (l *Logger) setSink(sink LogSink) { l.sink = sink } // GetSink returns the stored sink. func (l Logger) GetSink() LogSink { return l.sink } // WithSink returns a copy of the logger with the new sink. func (l Logger) WithSink(sink LogSink) Logger { l.setSink(sink) return l } // Logger is an interface to an abstract logging implementation. This is a // concrete type for performance reasons, but all the real work is passed on to // a LogSink. Implementations of LogSink should provide their own constructors // that return Logger, not LogSink. // // The underlying sink can be accessed through GetSink and be modified through // WithSink. This enables the implementation of custom extensions (see "Break // Glass" in the package documentation). Normally the sink should be used only // indirectly. type Logger struct { sink LogSink level int } // Enabled tests whether this Logger is enabled. For example, commandline // flags might be used to set the logging verbosity and disable some info logs. func (l Logger) Enabled() bool { // Some implementations of LogSink look at the caller in Enabled (e.g. // different verbosity levels per package or file), but we only pass one // CallDepth in (via Init). This means that all calls from Logger to the // LogSink's Enabled, Info, and Error methods must have the same number of // frames. In other words, Logger methods can't call other Logger methods // which call these LogSink methods unless we do it the same in all paths. return l.sink != nil && l.sink.Enabled(l.level) } // Info logs a non-error message with the given key/value pairs as context. // // The msg argument should be used to add some constant description to the log // line. The key/value pairs can then be used to add additional variable // information. The key/value pairs must alternate string keys and arbitrary // values. func (l Logger) Info(msg string, keysAndValues ...any) { if l.sink == nil { return } if l.sink.Enabled(l.level) { // see comment in Enabled if withHelper, ok := l.sink.(CallStackHelperLogSink); ok { withHelper.GetCallStackHelper()() } l.sink.Info(l.level, msg, keysAndValues...) } } // Error logs an error, with the given message and key/value pairs as context. // It functions similarly to Info, but may have unique behavior, and should be // preferred for logging errors (see the package documentations for more // information). The log message will always be emitted, regardless of // verbosity level. // // The msg argument should be used to add context to any underlying error, // while the err argument should be used to attach the actual error that // triggered this log line, if present. The err parameter is optional // and nil may be passed instead of an error instance. func (l Logger) Error(err error, msg string, keysAndValues ...any) { if l.sink == nil { return } if withHelper, ok := l.sink.(CallStackHelperLogSink); ok { withHelper.GetCallStackHelper()() } l.sink.Error(err, msg, keysAndValues...) } // V returns a new Logger instance for a specific verbosity level, relative to // this Logger. In other words, V-levels are additive. A higher verbosity // level means a log message is less important. Negative V-levels are treated // as 0. func (l Logger) V(level int) Logger { if l.sink == nil { return l } if level < 0 { level = 0 } l.level += level return l } // GetV returns the verbosity level of the logger. If the logger's LogSink is // nil as in the Discard logger, this will always return 0. func (l Logger) GetV() int { // 0 if l.sink nil because of the if check in V above. return l.level } // WithValues returns a new Logger instance with additional key/value pairs. // See Info for documentation on how key/value pairs work. func (l Logger) WithValues(keysAndValues ...any) Logger { if l.sink == nil { return l } l.setSink(l.sink.WithValues(keysAndValues...)) return l } // WithName returns a new Logger instance with the specified name element added // to the Logger's name. Successive calls with WithName append additional // suffixes to the Logger's name. It's strongly recommended that name segments // contain only letters, digits, and hyphens (see the package documentation for // more information). func (l Logger) WithName(name string) Logger { if l.sink == nil { return l } l.setSink(l.sink.WithName(name)) return l } // WithCallDepth returns a Logger instance that offsets the call stack by the // specified number of frames when logging call site information, if possible. // This is useful for users who have helper functions between the "real" call // site and the actual calls to Logger methods. If depth is 0 the attribution // should be to the direct caller of this function. If depth is 1 the // attribution should skip 1 call frame, and so on. Successive calls to this // are additive. // // If the underlying log implementation supports a WithCallDepth(int) method, // it will be called and the result returned. If the implementation does not // support CallDepthLogSink, the original Logger will be returned. // // To skip one level, WithCallStackHelper() should be used instead of // WithCallDepth(1) because it works with implementions that support the // CallDepthLogSink and/or CallStackHelperLogSink interfaces. func (l Logger) WithCallDepth(depth int) Logger { if l.sink == nil { return l } if withCallDepth, ok := l.sink.(CallDepthLogSink); ok { l.setSink(withCallDepth.WithCallDepth(depth)) } return l } // WithCallStackHelper returns a new Logger instance that skips the direct // caller when logging call site information, if possible. This is useful for // users who have helper functions between the "real" call site and the actual // calls to Logger methods and want to support loggers which depend on marking // each individual helper function, like loggers based on testing.T. // // In addition to using that new logger instance, callers also must call the // returned function. // // If the underlying log implementation supports a WithCallDepth(int) method, // WithCallDepth(1) will be called to produce a new logger. If it supports a // WithCallStackHelper() method, that will be also called. If the // implementation does not support either of these, the original Logger will be // returned. func (l Logger) WithCallStackHelper() (func(), Logger) { if l.sink == nil { return func() {}, l } var helper func() if withCallDepth, ok := l.sink.(CallDepthLogSink); ok { l.setSink(withCallDepth.WithCallDepth(1)) } if withHelper, ok := l.sink.(CallStackHelperLogSink); ok { helper = withHelper.GetCallStackHelper() } else { helper = func() {} } return helper, l } // IsZero returns true if this logger is an uninitialized zero value func (l Logger) IsZero() bool { return l.sink == nil } // RuntimeInfo holds information that the logr "core" library knows which // LogSinks might want to know. type RuntimeInfo struct { // CallDepth is the number of call frames the logr library adds between the // end-user and the LogSink. LogSink implementations which choose to print // the original logging site (e.g. file & line) should climb this many // additional frames to find it. CallDepth int } // runtimeInfo is a static global. It must not be changed at run time. var runtimeInfo = RuntimeInfo{ CallDepth: 1, } // LogSink represents a logging implementation. End-users will generally not // interact with this type. type LogSink interface { // Init receives optional information about the logr library for LogSink // implementations that need it. Init(info RuntimeInfo) // Enabled tests whether this LogSink is enabled at the specified V-level. // For example, commandline flags might be used to set the logging // verbosity and disable some info logs. Enabled(level int) bool // Info logs a non-error message with the given key/value pairs as context. // The level argument is provided for optional logging. This method will // only be called when Enabled(level) is true. See Logger.Info for more // details. Info(level int, msg string, keysAndValues ...any) // Error logs an error, with the given message and key/value pairs as // context. See Logger.Error for more details. Error(err error, msg string, keysAndValues ...any) // WithValues returns a new LogSink with additional key/value pairs. See // Logger.WithValues for more details. WithValues(keysAndValues ...any) LogSink // WithName returns a new LogSink with the specified name appended. See // Logger.WithName for more details. WithName(name string) LogSink } // CallDepthLogSink represents a LogSink that knows how to climb the call stack // to identify the original call site and can offset the depth by a specified // number of frames. This is useful for users who have helper functions // between the "real" call site and the actual calls to Logger methods. // Implementations that log information about the call site (such as file, // function, or line) would otherwise log information about the intermediate // helper functions. // // This is an optional interface and implementations are not required to // support it. type CallDepthLogSink interface { // WithCallDepth returns a LogSink that will offset the call // stack by the specified number of frames when logging call // site information. // // If depth is 0, the LogSink should skip exactly the number // of call frames defined in RuntimeInfo.CallDepth when Info // or Error are called, i.e. the attribution should be to the // direct caller of Logger.Info or Logger.Error. // // If depth is 1 the attribution should skip 1 call frame, and so on. // Successive calls to this are additive. WithCallDepth(depth int) LogSink } // CallStackHelperLogSink represents a LogSink that knows how to climb // the call stack to identify the original call site and can skip // intermediate helper functions if they mark themselves as // helper. Go's testing package uses that approach. // // This is useful for users who have helper functions between the // "real" call site and the actual calls to Logger methods. // Implementations that log information about the call site (such as // file, function, or line) would otherwise log information about the // intermediate helper functions. // // This is an optional interface and implementations are not required // to support it. Implementations that choose to support this must not // simply implement it as WithCallDepth(1), because // Logger.WithCallStackHelper will call both methods if they are // present. This should only be implemented for LogSinks that actually // need it, as with testing.T. type CallStackHelperLogSink interface { // GetCallStackHelper returns a function that must be called // to mark the direct caller as helper function when logging // call site information. GetCallStackHelper() func() } // Marshaler is an optional interface that logged values may choose to // implement. Loggers with structured output, such as JSON, should // log the object return by the MarshalLog method instead of the // original value. type Marshaler interface { // MarshalLog can be used to: // - ensure that structs are not logged as strings when the original // value has a String method: return a different type without a // String method // - select which fields of a complex type should get logged: // return a simpler struct with fewer fields // - log unexported fields: return a different struct // with exported fields // // It may return any value of any type. MarshalLog() any }
go
MIT
f4fc3669ca8eb67aa350a76503397192bf26f057
2026-01-07T08:35:43.570558Z
false
jesseduffield/lazydocker
https://github.com/jesseduffield/lazydocker/blob/f4fc3669ca8eb67aa350a76503397192bf26f057/vendor/github.com/go-logr/logr/sloghandler.go
vendor/github.com/go-logr/logr/sloghandler.go
//go:build go1.21 // +build go1.21 /* Copyright 2023 The logr Authors. 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. */ package logr import ( "context" "log/slog" ) type slogHandler struct { // May be nil, in which case all logs get discarded. sink LogSink // Non-nil if sink is non-nil and implements SlogSink. slogSink SlogSink // groupPrefix collects values from WithGroup calls. It gets added as // prefix to value keys when handling a log record. groupPrefix string // levelBias can be set when constructing the handler to influence the // slog.Level of log records. A positive levelBias reduces the // slog.Level value. slog has no API to influence this value after the // handler got created, so it can only be set indirectly through // Logger.V. levelBias slog.Level } var _ slog.Handler = &slogHandler{} // groupSeparator is used to concatenate WithGroup names and attribute keys. const groupSeparator = "." // GetLevel is used for black box unit testing. func (l *slogHandler) GetLevel() slog.Level { return l.levelBias } func (l *slogHandler) Enabled(_ context.Context, level slog.Level) bool { return l.sink != nil && (level >= slog.LevelError || l.sink.Enabled(l.levelFromSlog(level))) } func (l *slogHandler) Handle(ctx context.Context, record slog.Record) error { if l.slogSink != nil { // Only adjust verbosity level of log entries < slog.LevelError. if record.Level < slog.LevelError { record.Level -= l.levelBias } return l.slogSink.Handle(ctx, record) } // No need to check for nil sink here because Handle will only be called // when Enabled returned true. kvList := make([]any, 0, 2*record.NumAttrs()) record.Attrs(func(attr slog.Attr) bool { kvList = attrToKVs(attr, l.groupPrefix, kvList) return true }) if record.Level >= slog.LevelError { l.sinkWithCallDepth().Error(nil, record.Message, kvList...) } else { level := l.levelFromSlog(record.Level) l.sinkWithCallDepth().Info(level, record.Message, kvList...) } return nil } // sinkWithCallDepth adjusts the stack unwinding so that when Error or Info // are called by Handle, code in slog gets skipped. // // This offset currently (Go 1.21.0) works for calls through // slog.New(ToSlogHandler(...)). There's no guarantee that the call // chain won't change. Wrapping the handler will also break unwinding. It's // still better than not adjusting at all.... // // This cannot be done when constructing the handler because FromSlogHandler needs // access to the original sink without this adjustment. A second copy would // work, but then WithAttrs would have to be called for both of them. func (l *slogHandler) sinkWithCallDepth() LogSink { if sink, ok := l.sink.(CallDepthLogSink); ok { return sink.WithCallDepth(2) } return l.sink } func (l *slogHandler) WithAttrs(attrs []slog.Attr) slog.Handler { if l.sink == nil || len(attrs) == 0 { return l } clone := *l if l.slogSink != nil { clone.slogSink = l.slogSink.WithAttrs(attrs) clone.sink = clone.slogSink } else { kvList := make([]any, 0, 2*len(attrs)) for _, attr := range attrs { kvList = attrToKVs(attr, l.groupPrefix, kvList) } clone.sink = l.sink.WithValues(kvList...) } return &clone } func (l *slogHandler) WithGroup(name string) slog.Handler { if l.sink == nil { return l } if name == "" { // slog says to inline empty groups return l } clone := *l if l.slogSink != nil { clone.slogSink = l.slogSink.WithGroup(name) clone.sink = clone.slogSink } else { clone.groupPrefix = addPrefix(clone.groupPrefix, name) } return &clone } // attrToKVs appends a slog.Attr to a logr-style kvList. It handle slog Groups // and other details of slog. func attrToKVs(attr slog.Attr, groupPrefix string, kvList []any) []any { attrVal := attr.Value.Resolve() if attrVal.Kind() == slog.KindGroup { groupVal := attrVal.Group() grpKVs := make([]any, 0, 2*len(groupVal)) prefix := groupPrefix if attr.Key != "" { prefix = addPrefix(groupPrefix, attr.Key) } for _, attr := range groupVal { grpKVs = attrToKVs(attr, prefix, grpKVs) } kvList = append(kvList, grpKVs...) } else if attr.Key != "" { kvList = append(kvList, addPrefix(groupPrefix, attr.Key), attrVal.Any()) } return kvList } func addPrefix(prefix, name string) string { if prefix == "" { return name } if name == "" { return prefix } return prefix + groupSeparator + name } // levelFromSlog adjusts the level by the logger's verbosity and negates it. // It ensures that the result is >= 0. This is necessary because the result is // passed to a LogSink and that API did not historically document whether // levels could be negative or what that meant. // // Some example usage: // // logrV0 := getMyLogger() // logrV2 := logrV0.V(2) // slogV2 := slog.New(logr.ToSlogHandler(logrV2)) // slogV2.Debug("msg") // =~ logrV2.V(4) =~ logrV0.V(6) // slogV2.Info("msg") // =~ logrV2.V(0) =~ logrV0.V(2) // slogv2.Warn("msg") // =~ logrV2.V(-4) =~ logrV0.V(0) func (l *slogHandler) levelFromSlog(level slog.Level) int { result := -level result += l.levelBias // in case the original Logger had a V level if result < 0 { result = 0 // because LogSink doesn't expect negative V levels } return int(result) }
go
MIT
f4fc3669ca8eb67aa350a76503397192bf26f057
2026-01-07T08:35:43.570558Z
false
jesseduffield/lazydocker
https://github.com/jesseduffield/lazydocker/blob/f4fc3669ca8eb67aa350a76503397192bf26f057/vendor/github.com/go-logr/logr/discard.go
vendor/github.com/go-logr/logr/discard.go
/* Copyright 2020 The logr Authors. 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. */ package logr // Discard returns a Logger that discards all messages logged to it. It can be // used whenever the caller is not interested in the logs. Logger instances // produced by this function always compare as equal. func Discard() Logger { return New(nil) }
go
MIT
f4fc3669ca8eb67aa350a76503397192bf26f057
2026-01-07T08:35:43.570558Z
false
jesseduffield/lazydocker
https://github.com/jesseduffield/lazydocker/blob/f4fc3669ca8eb67aa350a76503397192bf26f057/vendor/github.com/go-logr/logr/context_noslog.go
vendor/github.com/go-logr/logr/context_noslog.go
//go:build !go1.21 // +build !go1.21 /* Copyright 2019 The logr Authors. 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. */ package logr import ( "context" ) // FromContext returns a Logger from ctx or an error if no Logger is found. func FromContext(ctx context.Context) (Logger, error) { if v, ok := ctx.Value(contextKey{}).(Logger); ok { return v, nil } return Logger{}, notFoundError{} } // FromContextOrDiscard returns a Logger from ctx. If no Logger is found, this // returns a Logger that discards all log messages. func FromContextOrDiscard(ctx context.Context) Logger { if v, ok := ctx.Value(contextKey{}).(Logger); ok { return v } return Discard() } // NewContext returns a new Context, derived from ctx, which carries the // provided Logger. func NewContext(ctx context.Context, logger Logger) context.Context { return context.WithValue(ctx, contextKey{}, logger) }
go
MIT
f4fc3669ca8eb67aa350a76503397192bf26f057
2026-01-07T08:35:43.570558Z
false
jesseduffield/lazydocker
https://github.com/jesseduffield/lazydocker/blob/f4fc3669ca8eb67aa350a76503397192bf26f057/vendor/github.com/go-logr/logr/slogsink.go
vendor/github.com/go-logr/logr/slogsink.go
//go:build go1.21 // +build go1.21 /* Copyright 2023 The logr Authors. 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. */ package logr import ( "context" "log/slog" "runtime" "time" ) var ( _ LogSink = &slogSink{} _ CallDepthLogSink = &slogSink{} _ Underlier = &slogSink{} ) // Underlier is implemented by the LogSink returned by NewFromLogHandler. type Underlier interface { // GetUnderlying returns the Handler used by the LogSink. GetUnderlying() slog.Handler } const ( // nameKey is used to log the `WithName` values as an additional attribute. nameKey = "logger" // errKey is used to log the error parameter of Error as an additional attribute. errKey = "err" ) type slogSink struct { callDepth int name string handler slog.Handler } func (l *slogSink) Init(info RuntimeInfo) { l.callDepth = info.CallDepth } func (l *slogSink) GetUnderlying() slog.Handler { return l.handler } func (l *slogSink) WithCallDepth(depth int) LogSink { newLogger := *l newLogger.callDepth += depth return &newLogger } func (l *slogSink) Enabled(level int) bool { return l.handler.Enabled(context.Background(), slog.Level(-level)) } func (l *slogSink) Info(level int, msg string, kvList ...interface{}) { l.log(nil, msg, slog.Level(-level), kvList...) } func (l *slogSink) Error(err error, msg string, kvList ...interface{}) { l.log(err, msg, slog.LevelError, kvList...) } func (l *slogSink) log(err error, msg string, level slog.Level, kvList ...interface{}) { var pcs [1]uintptr // skip runtime.Callers, this function, Info/Error, and all helper functions above that. runtime.Callers(3+l.callDepth, pcs[:]) record := slog.NewRecord(time.Now(), level, msg, pcs[0]) if l.name != "" { record.AddAttrs(slog.String(nameKey, l.name)) } if err != nil { record.AddAttrs(slog.Any(errKey, err)) } record.Add(kvList...) _ = l.handler.Handle(context.Background(), record) } func (l slogSink) WithName(name string) LogSink { if l.name != "" { l.name += "/" } l.name += name return &l } func (l slogSink) WithValues(kvList ...interface{}) LogSink { l.handler = l.handler.WithAttrs(kvListToAttrs(kvList...)) return &l } func kvListToAttrs(kvList ...interface{}) []slog.Attr { // We don't need the record itself, only its Add method. record := slog.NewRecord(time.Time{}, 0, "", 0) record.Add(kvList...) attrs := make([]slog.Attr, 0, record.NumAttrs()) record.Attrs(func(attr slog.Attr) bool { attrs = append(attrs, attr) return true }) return attrs }
go
MIT
f4fc3669ca8eb67aa350a76503397192bf26f057
2026-01-07T08:35:43.570558Z
false
jesseduffield/lazydocker
https://github.com/jesseduffield/lazydocker/blob/f4fc3669ca8eb67aa350a76503397192bf26f057/vendor/github.com/go-logr/logr/context_slog.go
vendor/github.com/go-logr/logr/context_slog.go
//go:build go1.21 // +build go1.21 /* Copyright 2019 The logr Authors. 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. */ package logr import ( "context" "fmt" "log/slog" ) // FromContext returns a Logger from ctx or an error if no Logger is found. func FromContext(ctx context.Context) (Logger, error) { v := ctx.Value(contextKey{}) if v == nil { return Logger{}, notFoundError{} } switch v := v.(type) { case Logger: return v, nil case *slog.Logger: return FromSlogHandler(v.Handler()), nil default: // Not reached. panic(fmt.Sprintf("unexpected value type for logr context key: %T", v)) } } // FromContextAsSlogLogger returns a slog.Logger from ctx or nil if no such Logger is found. func FromContextAsSlogLogger(ctx context.Context) *slog.Logger { v := ctx.Value(contextKey{}) if v == nil { return nil } switch v := v.(type) { case Logger: return slog.New(ToSlogHandler(v)) case *slog.Logger: return v default: // Not reached. panic(fmt.Sprintf("unexpected value type for logr context key: %T", v)) } } // FromContextOrDiscard returns a Logger from ctx. If no Logger is found, this // returns a Logger that discards all log messages. func FromContextOrDiscard(ctx context.Context) Logger { if logger, err := FromContext(ctx); err == nil { return logger } return Discard() } // NewContext returns a new Context, derived from ctx, which carries the // provided Logger. func NewContext(ctx context.Context, logger Logger) context.Context { return context.WithValue(ctx, contextKey{}, logger) } // NewContextWithSlogLogger returns a new Context, derived from ctx, which carries the // provided slog.Logger. func NewContextWithSlogLogger(ctx context.Context, logger *slog.Logger) context.Context { return context.WithValue(ctx, contextKey{}, logger) }
go
MIT
f4fc3669ca8eb67aa350a76503397192bf26f057
2026-01-07T08:35:43.570558Z
false
jesseduffield/lazydocker
https://github.com/jesseduffield/lazydocker/blob/f4fc3669ca8eb67aa350a76503397192bf26f057/vendor/github.com/go-logr/logr/context.go
vendor/github.com/go-logr/logr/context.go
/* Copyright 2023 The logr Authors. 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. */ package logr // contextKey is how we find Loggers in a context.Context. With Go < 1.21, // the value is always a Logger value. With Go >= 1.21, the value can be a // Logger value or a slog.Logger pointer. type contextKey struct{} // notFoundError exists to carry an IsNotFound method. type notFoundError struct{} func (notFoundError) Error() string { return "no logr.Logger was present" } func (notFoundError) IsNotFound() bool { return true }
go
MIT
f4fc3669ca8eb67aa350a76503397192bf26f057
2026-01-07T08:35:43.570558Z
false
jesseduffield/lazydocker
https://github.com/jesseduffield/lazydocker/blob/f4fc3669ca8eb67aa350a76503397192bf26f057/vendor/github.com/go-logr/logr/slogr.go
vendor/github.com/go-logr/logr/slogr.go
//go:build go1.21 // +build go1.21 /* Copyright 2023 The logr Authors. 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. */ package logr import ( "context" "log/slog" ) // FromSlogHandler returns a Logger which writes to the slog.Handler. // // The logr verbosity level is mapped to slog levels such that V(0) becomes // slog.LevelInfo and V(4) becomes slog.LevelDebug. func FromSlogHandler(handler slog.Handler) Logger { if handler, ok := handler.(*slogHandler); ok { if handler.sink == nil { return Discard() } return New(handler.sink).V(int(handler.levelBias)) } return New(&slogSink{handler: handler}) } // ToSlogHandler returns a slog.Handler which writes to the same sink as the Logger. // // The returned logger writes all records with level >= slog.LevelError as // error log entries with LogSink.Error, regardless of the verbosity level of // the Logger: // // logger := <some Logger with 0 as verbosity level> // slog.New(ToSlogHandler(logger.V(10))).Error(...) -> logSink.Error(...) // // The level of all other records gets reduced by the verbosity // level of the Logger and the result is negated. If it happens // to be negative, then it gets replaced by zero because a LogSink // is not expected to handled negative levels: // // slog.New(ToSlogHandler(logger)).Debug(...) -> logger.GetSink().Info(level=4, ...) // slog.New(ToSlogHandler(logger)).Warning(...) -> logger.GetSink().Info(level=0, ...) // slog.New(ToSlogHandler(logger)).Info(...) -> logger.GetSink().Info(level=0, ...) // slog.New(ToSlogHandler(logger.V(4))).Info(...) -> logger.GetSink().Info(level=4, ...) func ToSlogHandler(logger Logger) slog.Handler { if sink, ok := logger.GetSink().(*slogSink); ok && logger.GetV() == 0 { return sink.handler } handler := &slogHandler{sink: logger.GetSink(), levelBias: slog.Level(logger.GetV())} if slogSink, ok := handler.sink.(SlogSink); ok { handler.slogSink = slogSink } return handler } // SlogSink is an optional interface that a LogSink can implement to support // logging through the slog.Logger or slog.Handler APIs better. It then should // also support special slog values like slog.Group. When used as a // slog.Handler, the advantages are: // // - stack unwinding gets avoided in favor of logging the pre-recorded PC, // as intended by slog // - proper grouping of key/value pairs via WithGroup // - verbosity levels > slog.LevelInfo can be recorded // - less overhead // // Both APIs (Logger and slog.Logger/Handler) then are supported equally // well. Developers can pick whatever API suits them better and/or mix // packages which use either API in the same binary with a common logging // implementation. // // This interface is necessary because the type implementing the LogSink // interface cannot also implement the slog.Handler interface due to the // different prototype of the common Enabled method. // // An implementation could support both interfaces in two different types, but then // additional interfaces would be needed to convert between those types in FromSlogHandler // and ToSlogHandler. type SlogSink interface { LogSink Handle(ctx context.Context, record slog.Record) error WithAttrs(attrs []slog.Attr) SlogSink WithGroup(name string) SlogSink }
go
MIT
f4fc3669ca8eb67aa350a76503397192bf26f057
2026-01-07T08:35:43.570558Z
false
jesseduffield/lazydocker
https://github.com/jesseduffield/lazydocker/blob/f4fc3669ca8eb67aa350a76503397192bf26f057/vendor/github.com/go-logr/logr/funcr/funcr.go
vendor/github.com/go-logr/logr/funcr/funcr.go
/* Copyright 2021 The logr Authors. 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. */ // Package funcr implements formatting of structured log messages and // optionally captures the call site and timestamp. // // The simplest way to use it is via its implementation of a // github.com/go-logr/logr.LogSink with output through an arbitrary // "write" function. See New and NewJSON for details. // // # Custom LogSinks // // For users who need more control, a funcr.Formatter can be embedded inside // your own custom LogSink implementation. This is useful when the LogSink // needs to implement additional methods, for example. // // # Formatting // // This will respect logr.Marshaler, fmt.Stringer, and error interfaces for // values which are being logged. When rendering a struct, funcr will use Go's // standard JSON tags (all except "string"). package funcr import ( "bytes" "encoding" "encoding/json" "fmt" "path/filepath" "reflect" "runtime" "strconv" "strings" "time" "github.com/go-logr/logr" ) // New returns a logr.Logger which is implemented by an arbitrary function. func New(fn func(prefix, args string), opts Options) logr.Logger { return logr.New(newSink(fn, NewFormatter(opts))) } // NewJSON returns a logr.Logger which is implemented by an arbitrary function // and produces JSON output. func NewJSON(fn func(obj string), opts Options) logr.Logger { fnWrapper := func(_, obj string) { fn(obj) } return logr.New(newSink(fnWrapper, NewFormatterJSON(opts))) } // Underlier exposes access to the underlying logging function. Since // callers only have a logr.Logger, they have to know which // implementation is in use, so this interface is less of an // abstraction and more of a way to test type conversion. type Underlier interface { GetUnderlying() func(prefix, args string) } func newSink(fn func(prefix, args string), formatter Formatter) logr.LogSink { l := &fnlogger{ Formatter: formatter, write: fn, } // For skipping fnlogger.Info and fnlogger.Error. l.Formatter.AddCallDepth(1) return l } // Options carries parameters which influence the way logs are generated. type Options struct { // LogCaller tells funcr to add a "caller" key to some or all log lines. // This has some overhead, so some users might not want it. LogCaller MessageClass // LogCallerFunc tells funcr to also log the calling function name. This // has no effect if caller logging is not enabled (see Options.LogCaller). LogCallerFunc bool // LogTimestamp tells funcr to add a "ts" key to log lines. This has some // overhead, so some users might not want it. LogTimestamp bool // TimestampFormat tells funcr how to render timestamps when LogTimestamp // is enabled. If not specified, a default format will be used. For more // details, see docs for Go's time.Layout. TimestampFormat string // LogInfoLevel tells funcr what key to use to log the info level. // If not specified, the info level will be logged as "level". // If this is set to "", the info level will not be logged at all. LogInfoLevel *string // Verbosity tells funcr which V logs to produce. Higher values enable // more logs. Info logs at or below this level will be written, while logs // above this level will be discarded. Verbosity int // RenderBuiltinsHook allows users to mutate the list of key-value pairs // while a log line is being rendered. The kvList argument follows logr // conventions - each pair of slice elements is comprised of a string key // and an arbitrary value (verified and sanitized before calling this // hook). The value returned must follow the same conventions. This hook // can be used to audit or modify logged data. For example, you might want // to prefix all of funcr's built-in keys with some string. This hook is // only called for built-in (provided by funcr itself) key-value pairs. // Equivalent hooks are offered for key-value pairs saved via // logr.Logger.WithValues or Formatter.AddValues (see RenderValuesHook) and // for user-provided pairs (see RenderArgsHook). RenderBuiltinsHook func(kvList []any) []any // RenderValuesHook is the same as RenderBuiltinsHook, except that it is // only called for key-value pairs saved via logr.Logger.WithValues. See // RenderBuiltinsHook for more details. RenderValuesHook func(kvList []any) []any // RenderArgsHook is the same as RenderBuiltinsHook, except that it is only // called for key-value pairs passed directly to Info and Error. See // RenderBuiltinsHook for more details. RenderArgsHook func(kvList []any) []any // MaxLogDepth tells funcr how many levels of nested fields (e.g. a struct // that contains a struct, etc.) it may log. Every time it finds a struct, // slice, array, or map the depth is increased by one. When the maximum is // reached, the value will be converted to a string indicating that the max // depth has been exceeded. If this field is not specified, a default // value will be used. MaxLogDepth int } // MessageClass indicates which category or categories of messages to consider. type MessageClass int const ( // None ignores all message classes. None MessageClass = iota // All considers all message classes. All // Info only considers info messages. Info // Error only considers error messages. Error ) // fnlogger inherits some of its LogSink implementation from Formatter // and just needs to add some glue code. type fnlogger struct { Formatter write func(prefix, args string) } func (l fnlogger) WithName(name string) logr.LogSink { l.Formatter.AddName(name) return &l } func (l fnlogger) WithValues(kvList ...any) logr.LogSink { l.Formatter.AddValues(kvList) return &l } func (l fnlogger) WithCallDepth(depth int) logr.LogSink { l.Formatter.AddCallDepth(depth) return &l } func (l fnlogger) Info(level int, msg string, kvList ...any) { prefix, args := l.FormatInfo(level, msg, kvList) l.write(prefix, args) } func (l fnlogger) Error(err error, msg string, kvList ...any) { prefix, args := l.FormatError(err, msg, kvList) l.write(prefix, args) } func (l fnlogger) GetUnderlying() func(prefix, args string) { return l.write } // Assert conformance to the interfaces. var _ logr.LogSink = &fnlogger{} var _ logr.CallDepthLogSink = &fnlogger{} var _ Underlier = &fnlogger{} // NewFormatter constructs a Formatter which emits a JSON-like key=value format. func NewFormatter(opts Options) Formatter { return newFormatter(opts, outputKeyValue) } // NewFormatterJSON constructs a Formatter which emits strict JSON. func NewFormatterJSON(opts Options) Formatter { return newFormatter(opts, outputJSON) } // Defaults for Options. const defaultTimestampFormat = "2006-01-02 15:04:05.000000" const defaultMaxLogDepth = 16 func newFormatter(opts Options, outfmt outputFormat) Formatter { if opts.TimestampFormat == "" { opts.TimestampFormat = defaultTimestampFormat } if opts.MaxLogDepth == 0 { opts.MaxLogDepth = defaultMaxLogDepth } if opts.LogInfoLevel == nil { opts.LogInfoLevel = new(string) *opts.LogInfoLevel = "level" } f := Formatter{ outputFormat: outfmt, prefix: "", values: nil, depth: 0, opts: &opts, } return f } // Formatter is an opaque struct which can be embedded in a LogSink // implementation. It should be constructed with NewFormatter. Some of // its methods directly implement logr.LogSink. type Formatter struct { outputFormat outputFormat prefix string values []any valuesStr string depth int opts *Options groupName string // for slog groups groups []groupDef } // outputFormat indicates which outputFormat to use. type outputFormat int const ( // outputKeyValue emits a JSON-like key=value format, but not strict JSON. outputKeyValue outputFormat = iota // outputJSON emits strict JSON. outputJSON ) // groupDef represents a saved group. The values may be empty, but we don't // know if we need to render the group until the final record is rendered. type groupDef struct { name string values string } // PseudoStruct is a list of key-value pairs that gets logged as a struct. type PseudoStruct []any // render produces a log line, ready to use. func (f Formatter) render(builtins, args []any) string { // Empirically bytes.Buffer is faster than strings.Builder for this. buf := bytes.NewBuffer(make([]byte, 0, 1024)) if f.outputFormat == outputJSON { buf.WriteByte('{') // for the whole record } // Render builtins vals := builtins if hook := f.opts.RenderBuiltinsHook; hook != nil { vals = hook(f.sanitize(vals)) } f.flatten(buf, vals, false) // keys are ours, no need to escape continuing := len(builtins) > 0 // Turn the inner-most group into a string argsStr := func() string { buf := bytes.NewBuffer(make([]byte, 0, 1024)) vals = args if hook := f.opts.RenderArgsHook; hook != nil { vals = hook(f.sanitize(vals)) } f.flatten(buf, vals, true) // escape user-provided keys return buf.String() }() // Render the stack of groups from the inside out. bodyStr := f.renderGroup(f.groupName, f.valuesStr, argsStr) for i := len(f.groups) - 1; i >= 0; i-- { grp := &f.groups[i] if grp.values == "" && bodyStr == "" { // no contents, so we must elide the whole group continue } bodyStr = f.renderGroup(grp.name, grp.values, bodyStr) } if bodyStr != "" { if continuing { buf.WriteByte(f.comma()) } buf.WriteString(bodyStr) } if f.outputFormat == outputJSON { buf.WriteByte('}') // for the whole record } return buf.String() } // renderGroup returns a string representation of the named group with rendered // values and args. If the name is empty, this will return the values and args, // joined. If the name is not empty, this will return a single key-value pair, // where the value is a grouping of the values and args. If the values and // args are both empty, this will return an empty string, even if the name was // specified. func (f Formatter) renderGroup(name string, values string, args string) string { buf := bytes.NewBuffer(make([]byte, 0, 1024)) needClosingBrace := false if name != "" && (values != "" || args != "") { buf.WriteString(f.quoted(name, true)) // escape user-provided keys buf.WriteByte(f.colon()) buf.WriteByte('{') needClosingBrace = true } continuing := false if values != "" { buf.WriteString(values) continuing = true } if args != "" { if continuing { buf.WriteByte(f.comma()) } buf.WriteString(args) } if needClosingBrace { buf.WriteByte('}') } return buf.String() } // flatten renders a list of key-value pairs into a buffer. If escapeKeys is // true, the keys are assumed to have non-JSON-compatible characters in them // and must be evaluated for escapes. // // This function returns a potentially modified version of kvList, which // ensures that there is a value for every key (adding a value if needed) and // that each key is a string (substituting a key if needed). func (f Formatter) flatten(buf *bytes.Buffer, kvList []any, escapeKeys bool) []any { // This logic overlaps with sanitize() but saves one type-cast per key, // which can be measurable. if len(kvList)%2 != 0 { kvList = append(kvList, noValue) } copied := false for i := 0; i < len(kvList); i += 2 { k, ok := kvList[i].(string) if !ok { if !copied { newList := make([]any, len(kvList)) copy(newList, kvList) kvList = newList copied = true } k = f.nonStringKey(kvList[i]) kvList[i] = k } v := kvList[i+1] if i > 0 { if f.outputFormat == outputJSON { buf.WriteByte(f.comma()) } else { // In theory the format could be something we don't understand. In // practice, we control it, so it won't be. buf.WriteByte(' ') } } buf.WriteString(f.quoted(k, escapeKeys)) buf.WriteByte(f.colon()) buf.WriteString(f.pretty(v)) } return kvList } func (f Formatter) quoted(str string, escape bool) string { if escape { return prettyString(str) } // this is faster return `"` + str + `"` } func (f Formatter) comma() byte { if f.outputFormat == outputJSON { return ',' } return ' ' } func (f Formatter) colon() byte { if f.outputFormat == outputJSON { return ':' } return '=' } func (f Formatter) pretty(value any) string { return f.prettyWithFlags(value, 0, 0) } const ( flagRawStruct = 0x1 // do not print braces on structs ) // TODO: This is not fast. Most of the overhead goes here. func (f Formatter) prettyWithFlags(value any, flags uint32, depth int) string { if depth > f.opts.MaxLogDepth { return `"<max-log-depth-exceeded>"` } // Handle types that take full control of logging. if v, ok := value.(logr.Marshaler); ok { // Replace the value with what the type wants to get logged. // That then gets handled below via reflection. value = invokeMarshaler(v) } // Handle types that want to format themselves. switch v := value.(type) { case fmt.Stringer: value = invokeStringer(v) case error: value = invokeError(v) } // Handling the most common types without reflect is a small perf win. switch v := value.(type) { case bool: return strconv.FormatBool(v) case string: return prettyString(v) case int: return strconv.FormatInt(int64(v), 10) case int8: return strconv.FormatInt(int64(v), 10) case int16: return strconv.FormatInt(int64(v), 10) case int32: return strconv.FormatInt(int64(v), 10) case int64: return strconv.FormatInt(int64(v), 10) case uint: return strconv.FormatUint(uint64(v), 10) case uint8: return strconv.FormatUint(uint64(v), 10) case uint16: return strconv.FormatUint(uint64(v), 10) case uint32: return strconv.FormatUint(uint64(v), 10) case uint64: return strconv.FormatUint(v, 10) case uintptr: return strconv.FormatUint(uint64(v), 10) case float32: return strconv.FormatFloat(float64(v), 'f', -1, 32) case float64: return strconv.FormatFloat(v, 'f', -1, 64) case complex64: return `"` + strconv.FormatComplex(complex128(v), 'f', -1, 64) + `"` case complex128: return `"` + strconv.FormatComplex(v, 'f', -1, 128) + `"` case PseudoStruct: buf := bytes.NewBuffer(make([]byte, 0, 1024)) v = f.sanitize(v) if flags&flagRawStruct == 0 { buf.WriteByte('{') } for i := 0; i < len(v); i += 2 { if i > 0 { buf.WriteByte(f.comma()) } k, _ := v[i].(string) // sanitize() above means no need to check success // arbitrary keys might need escaping buf.WriteString(prettyString(k)) buf.WriteByte(f.colon()) buf.WriteString(f.prettyWithFlags(v[i+1], 0, depth+1)) } if flags&flagRawStruct == 0 { buf.WriteByte('}') } return buf.String() } buf := bytes.NewBuffer(make([]byte, 0, 256)) t := reflect.TypeOf(value) if t == nil { return "null" } v := reflect.ValueOf(value) switch t.Kind() { case reflect.Bool: return strconv.FormatBool(v.Bool()) case reflect.String: return prettyString(v.String()) case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: return strconv.FormatInt(int64(v.Int()), 10) case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr: return strconv.FormatUint(uint64(v.Uint()), 10) case reflect.Float32: return strconv.FormatFloat(float64(v.Float()), 'f', -1, 32) case reflect.Float64: return strconv.FormatFloat(v.Float(), 'f', -1, 64) case reflect.Complex64: return `"` + strconv.FormatComplex(complex128(v.Complex()), 'f', -1, 64) + `"` case reflect.Complex128: return `"` + strconv.FormatComplex(v.Complex(), 'f', -1, 128) + `"` case reflect.Struct: if flags&flagRawStruct == 0 { buf.WriteByte('{') } printComma := false // testing i>0 is not enough because of JSON omitted fields for i := 0; i < t.NumField(); i++ { fld := t.Field(i) if fld.PkgPath != "" { // reflect says this field is only defined for non-exported fields. continue } if !v.Field(i).CanInterface() { // reflect isn't clear exactly what this means, but we can't use it. continue } name := "" omitempty := false if tag, found := fld.Tag.Lookup("json"); found { if tag == "-" { continue } if comma := strings.Index(tag, ","); comma != -1 { if n := tag[:comma]; n != "" { name = n } rest := tag[comma:] if strings.Contains(rest, ",omitempty,") || strings.HasSuffix(rest, ",omitempty") { omitempty = true } } else { name = tag } } if omitempty && isEmpty(v.Field(i)) { continue } if printComma { buf.WriteByte(f.comma()) } printComma = true // if we got here, we are rendering a field if fld.Anonymous && fld.Type.Kind() == reflect.Struct && name == "" { buf.WriteString(f.prettyWithFlags(v.Field(i).Interface(), flags|flagRawStruct, depth+1)) continue } if name == "" { name = fld.Name } // field names can't contain characters which need escaping buf.WriteString(f.quoted(name, false)) buf.WriteByte(f.colon()) buf.WriteString(f.prettyWithFlags(v.Field(i).Interface(), 0, depth+1)) } if flags&flagRawStruct == 0 { buf.WriteByte('}') } return buf.String() case reflect.Slice, reflect.Array: // If this is outputing as JSON make sure this isn't really a json.RawMessage. // If so just emit "as-is" and don't pretty it as that will just print // it as [X,Y,Z,...] which isn't terribly useful vs the string form you really want. if f.outputFormat == outputJSON { if rm, ok := value.(json.RawMessage); ok { // If it's empty make sure we emit an empty value as the array style would below. if len(rm) > 0 { buf.Write(rm) } else { buf.WriteString("null") } return buf.String() } } buf.WriteByte('[') for i := 0; i < v.Len(); i++ { if i > 0 { buf.WriteByte(f.comma()) } e := v.Index(i) buf.WriteString(f.prettyWithFlags(e.Interface(), 0, depth+1)) } buf.WriteByte(']') return buf.String() case reflect.Map: buf.WriteByte('{') // This does not sort the map keys, for best perf. it := v.MapRange() i := 0 for it.Next() { if i > 0 { buf.WriteByte(f.comma()) } // If a map key supports TextMarshaler, use it. keystr := "" if m, ok := it.Key().Interface().(encoding.TextMarshaler); ok { txt, err := m.MarshalText() if err != nil { keystr = fmt.Sprintf("<error-MarshalText: %s>", err.Error()) } else { keystr = string(txt) } keystr = prettyString(keystr) } else { // prettyWithFlags will produce already-escaped values keystr = f.prettyWithFlags(it.Key().Interface(), 0, depth+1) if t.Key().Kind() != reflect.String { // JSON only does string keys. Unlike Go's standard JSON, we'll // convert just about anything to a string. keystr = prettyString(keystr) } } buf.WriteString(keystr) buf.WriteByte(f.colon()) buf.WriteString(f.prettyWithFlags(it.Value().Interface(), 0, depth+1)) i++ } buf.WriteByte('}') return buf.String() case reflect.Ptr, reflect.Interface: if v.IsNil() { return "null" } return f.prettyWithFlags(v.Elem().Interface(), 0, depth) } return fmt.Sprintf(`"<unhandled-%s>"`, t.Kind().String()) } func prettyString(s string) string { // Avoid escaping (which does allocations) if we can. if needsEscape(s) { return strconv.Quote(s) } b := bytes.NewBuffer(make([]byte, 0, 1024)) b.WriteByte('"') b.WriteString(s) b.WriteByte('"') return b.String() } // needsEscape determines whether the input string needs to be escaped or not, // without doing any allocations. func needsEscape(s string) bool { for _, r := range s { if !strconv.IsPrint(r) || r == '\\' || r == '"' { return true } } return false } func isEmpty(v reflect.Value) bool { switch v.Kind() { case reflect.Array, reflect.Map, reflect.Slice, reflect.String: return v.Len() == 0 case reflect.Bool: return !v.Bool() case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: return v.Int() == 0 case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr: return v.Uint() == 0 case reflect.Float32, reflect.Float64: return v.Float() == 0 case reflect.Complex64, reflect.Complex128: return v.Complex() == 0 case reflect.Interface, reflect.Ptr: return v.IsNil() } return false } func invokeMarshaler(m logr.Marshaler) (ret any) { defer func() { if r := recover(); r != nil { ret = fmt.Sprintf("<panic: %s>", r) } }() return m.MarshalLog() } func invokeStringer(s fmt.Stringer) (ret string) { defer func() { if r := recover(); r != nil { ret = fmt.Sprintf("<panic: %s>", r) } }() return s.String() } func invokeError(e error) (ret string) { defer func() { if r := recover(); r != nil { ret = fmt.Sprintf("<panic: %s>", r) } }() return e.Error() } // Caller represents the original call site for a log line, after considering // logr.Logger.WithCallDepth and logr.Logger.WithCallStackHelper. The File and // Line fields will always be provided, while the Func field is optional. // Users can set the render hook fields in Options to examine logged key-value // pairs, one of which will be {"caller", Caller} if the Options.LogCaller // field is enabled for the given MessageClass. type Caller struct { // File is the basename of the file for this call site. File string `json:"file"` // Line is the line number in the file for this call site. Line int `json:"line"` // Func is the function name for this call site, or empty if // Options.LogCallerFunc is not enabled. Func string `json:"function,omitempty"` } func (f Formatter) caller() Caller { // +1 for this frame, +1 for Info/Error. pc, file, line, ok := runtime.Caller(f.depth + 2) if !ok { return Caller{"<unknown>", 0, ""} } fn := "" if f.opts.LogCallerFunc { if fp := runtime.FuncForPC(pc); fp != nil { fn = fp.Name() } } return Caller{filepath.Base(file), line, fn} } const noValue = "<no-value>" func (f Formatter) nonStringKey(v any) string { return fmt.Sprintf("<non-string-key: %s>", f.snippet(v)) } // snippet produces a short snippet string of an arbitrary value. func (f Formatter) snippet(v any) string { const snipLen = 16 snip := f.pretty(v) if len(snip) > snipLen { snip = snip[:snipLen] } return snip } // sanitize ensures that a list of key-value pairs has a value for every key // (adding a value if needed) and that each key is a string (substituting a key // if needed). func (f Formatter) sanitize(kvList []any) []any { if len(kvList)%2 != 0 { kvList = append(kvList, noValue) } for i := 0; i < len(kvList); i += 2 { _, ok := kvList[i].(string) if !ok { kvList[i] = f.nonStringKey(kvList[i]) } } return kvList } // startGroup opens a new group scope (basically a sub-struct), which locks all // the current saved values and starts them anew. This is needed to satisfy // slog. func (f *Formatter) startGroup(name string) { // Unnamed groups are just inlined. if name == "" { return } n := len(f.groups) f.groups = append(f.groups[:n:n], groupDef{f.groupName, f.valuesStr}) // Start collecting new values. f.groupName = name f.valuesStr = "" f.values = nil } // Init configures this Formatter from runtime info, such as the call depth // imposed by logr itself. // Note that this receiver is a pointer, so depth can be saved. func (f *Formatter) Init(info logr.RuntimeInfo) { f.depth += info.CallDepth } // Enabled checks whether an info message at the given level should be logged. func (f Formatter) Enabled(level int) bool { return level <= f.opts.Verbosity } // GetDepth returns the current depth of this Formatter. This is useful for // implementations which do their own caller attribution. func (f Formatter) GetDepth() int { return f.depth } // FormatInfo renders an Info log message into strings. The prefix will be // empty when no names were set (via AddNames), or when the output is // configured for JSON. func (f Formatter) FormatInfo(level int, msg string, kvList []any) (prefix, argsStr string) { args := make([]any, 0, 64) // using a constant here impacts perf prefix = f.prefix if f.outputFormat == outputJSON { args = append(args, "logger", prefix) prefix = "" } if f.opts.LogTimestamp { args = append(args, "ts", time.Now().Format(f.opts.TimestampFormat)) } if policy := f.opts.LogCaller; policy == All || policy == Info { args = append(args, "caller", f.caller()) } if key := *f.opts.LogInfoLevel; key != "" { args = append(args, key, level) } args = append(args, "msg", msg) return prefix, f.render(args, kvList) } // FormatError renders an Error log message into strings. The prefix will be // empty when no names were set (via AddNames), or when the output is // configured for JSON. func (f Formatter) FormatError(err error, msg string, kvList []any) (prefix, argsStr string) { args := make([]any, 0, 64) // using a constant here impacts perf prefix = f.prefix if f.outputFormat == outputJSON { args = append(args, "logger", prefix) prefix = "" } if f.opts.LogTimestamp { args = append(args, "ts", time.Now().Format(f.opts.TimestampFormat)) } if policy := f.opts.LogCaller; policy == All || policy == Error { args = append(args, "caller", f.caller()) } args = append(args, "msg", msg) var loggableErr any if err != nil { loggableErr = err.Error() } args = append(args, "error", loggableErr) return prefix, f.render(args, kvList) } // AddName appends the specified name. funcr uses '/' characters to separate // name elements. Callers should not pass '/' in the provided name string, but // this library does not actually enforce that. func (f *Formatter) AddName(name string) { if len(f.prefix) > 0 { f.prefix += "/" } f.prefix += name } // AddValues adds key-value pairs to the set of saved values to be logged with // each log line. func (f *Formatter) AddValues(kvList []any) { // Three slice args forces a copy. n := len(f.values) f.values = append(f.values[:n:n], kvList...) vals := f.values if hook := f.opts.RenderValuesHook; hook != nil { vals = hook(f.sanitize(vals)) } // Pre-render values, so we don't have to do it on each Info/Error call. buf := bytes.NewBuffer(make([]byte, 0, 1024)) f.flatten(buf, vals, true) // escape user-provided keys f.valuesStr = buf.String() } // AddCallDepth increases the number of stack-frames to skip when attributing // the log line to a file and line. func (f *Formatter) AddCallDepth(depth int) { f.depth += depth }
go
MIT
f4fc3669ca8eb67aa350a76503397192bf26f057
2026-01-07T08:35:43.570558Z
false
jesseduffield/lazydocker
https://github.com/jesseduffield/lazydocker/blob/f4fc3669ca8eb67aa350a76503397192bf26f057/vendor/github.com/go-logr/logr/funcr/slogsink.go
vendor/github.com/go-logr/logr/funcr/slogsink.go
//go:build go1.21 // +build go1.21 /* Copyright 2023 The logr Authors. 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. */ package funcr import ( "context" "log/slog" "github.com/go-logr/logr" ) var _ logr.SlogSink = &fnlogger{} const extraSlogSinkDepth = 3 // 2 for slog, 1 for SlogSink func (l fnlogger) Handle(_ context.Context, record slog.Record) error { kvList := make([]any, 0, 2*record.NumAttrs()) record.Attrs(func(attr slog.Attr) bool { kvList = attrToKVs(attr, kvList) return true }) if record.Level >= slog.LevelError { l.WithCallDepth(extraSlogSinkDepth).Error(nil, record.Message, kvList...) } else { level := l.levelFromSlog(record.Level) l.WithCallDepth(extraSlogSinkDepth).Info(level, record.Message, kvList...) } return nil } func (l fnlogger) WithAttrs(attrs []slog.Attr) logr.SlogSink { kvList := make([]any, 0, 2*len(attrs)) for _, attr := range attrs { kvList = attrToKVs(attr, kvList) } l.AddValues(kvList) return &l } func (l fnlogger) WithGroup(name string) logr.SlogSink { l.startGroup(name) return &l } // attrToKVs appends a slog.Attr to a logr-style kvList. It handle slog Groups // and other details of slog. func attrToKVs(attr slog.Attr, kvList []any) []any { attrVal := attr.Value.Resolve() if attrVal.Kind() == slog.KindGroup { groupVal := attrVal.Group() grpKVs := make([]any, 0, 2*len(groupVal)) for _, attr := range groupVal { grpKVs = attrToKVs(attr, grpKVs) } if attr.Key == "" { // slog says we have to inline these kvList = append(kvList, grpKVs...) } else { kvList = append(kvList, attr.Key, PseudoStruct(grpKVs)) } } else if attr.Key != "" { kvList = append(kvList, attr.Key, attrVal.Any()) } return kvList } // levelFromSlog adjusts the level by the logger's verbosity and negates it. // It ensures that the result is >= 0. This is necessary because the result is // passed to a LogSink and that API did not historically document whether // levels could be negative or what that meant. // // Some example usage: // // logrV0 := getMyLogger() // logrV2 := logrV0.V(2) // slogV2 := slog.New(logr.ToSlogHandler(logrV2)) // slogV2.Debug("msg") // =~ logrV2.V(4) =~ logrV0.V(6) // slogV2.Info("msg") // =~ logrV2.V(0) =~ logrV0.V(2) // slogv2.Warn("msg") // =~ logrV2.V(-4) =~ logrV0.V(0) func (l fnlogger) levelFromSlog(level slog.Level) int { result := -level if result < 0 { result = 0 // because LogSink doesn't expect negative V levels } return int(result) }
go
MIT
f4fc3669ca8eb67aa350a76503397192bf26f057
2026-01-07T08:35:43.570558Z
false
jesseduffield/lazydocker
https://github.com/jesseduffield/lazydocker/blob/f4fc3669ca8eb67aa350a76503397192bf26f057/vendor/github.com/go-logr/stdr/stdr.go
vendor/github.com/go-logr/stdr/stdr.go
/* Copyright 2019 The logr Authors. 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. */ // Package stdr implements github.com/go-logr/logr.Logger in terms of // Go's standard log package. package stdr import ( "log" "os" "github.com/go-logr/logr" "github.com/go-logr/logr/funcr" ) // The global verbosity level. See SetVerbosity(). var globalVerbosity int // SetVerbosity sets the global level against which all info logs will be // compared. If this is greater than or equal to the "V" of the logger, the // message will be logged. A higher value here means more logs will be written. // The previous verbosity value is returned. This is not concurrent-safe - // callers must be sure to call it from only one goroutine. func SetVerbosity(v int) int { old := globalVerbosity globalVerbosity = v return old } // New returns a logr.Logger which is implemented by Go's standard log package, // or something like it. If std is nil, this will use a default logger // instead. // // Example: stdr.New(log.New(os.Stderr, "", log.LstdFlags|log.Lshortfile))) func New(std StdLogger) logr.Logger { return NewWithOptions(std, Options{}) } // NewWithOptions returns a logr.Logger which is implemented by Go's standard // log package, or something like it. See New for details. func NewWithOptions(std StdLogger, opts Options) logr.Logger { if std == nil { // Go's log.Default() is only available in 1.16 and higher. std = log.New(os.Stderr, "", log.LstdFlags) } if opts.Depth < 0 { opts.Depth = 0 } fopts := funcr.Options{ LogCaller: funcr.MessageClass(opts.LogCaller), } sl := &logger{ Formatter: funcr.NewFormatter(fopts), std: std, } // For skipping our own logger.Info/Error. sl.Formatter.AddCallDepth(1 + opts.Depth) return logr.New(sl) } // Options carries parameters which influence the way logs are generated. type Options struct { // Depth biases the assumed number of call frames to the "true" caller. // This is useful when the calling code calls a function which then calls // stdr (e.g. a logging shim to another API). Values less than zero will // be treated as zero. Depth int // LogCaller tells stdr to add a "caller" key to some or all log lines. // Go's log package has options to log this natively, too. LogCaller MessageClass // TODO: add an option to log the date/time } // MessageClass indicates which category or categories of messages to consider. type MessageClass int const ( // None ignores all message classes. None MessageClass = iota // All considers all message classes. All // Info only considers info messages. Info // Error only considers error messages. Error ) // StdLogger is the subset of the Go stdlib log.Logger API that is needed for // this adapter. type StdLogger interface { // Output is the same as log.Output and log.Logger.Output. Output(calldepth int, logline string) error } type logger struct { funcr.Formatter std StdLogger } var _ logr.LogSink = &logger{} var _ logr.CallDepthLogSink = &logger{} func (l logger) Enabled(level int) bool { return globalVerbosity >= level } func (l logger) Info(level int, msg string, kvList ...interface{}) { prefix, args := l.FormatInfo(level, msg, kvList) if prefix != "" { args = prefix + ": " + args } _ = l.std.Output(l.Formatter.GetDepth()+1, args) } func (l logger) Error(err error, msg string, kvList ...interface{}) { prefix, args := l.FormatError(err, msg, kvList) if prefix != "" { args = prefix + ": " + args } _ = l.std.Output(l.Formatter.GetDepth()+1, args) } func (l logger) WithName(name string) logr.LogSink { l.Formatter.AddName(name) return &l } func (l logger) WithValues(kvList ...interface{}) logr.LogSink { l.Formatter.AddValues(kvList) return &l } func (l logger) WithCallDepth(depth int) logr.LogSink { l.Formatter.AddCallDepth(depth) return &l } // Underlier exposes access to the underlying logging implementation. Since // callers only have a logr.Logger, they have to know which implementation is // in use, so this interface is less of an abstraction and more of way to test // type conversion. type Underlier interface { GetUnderlying() StdLogger } // GetUnderlying returns the StdLogger underneath this logger. Since StdLogger // is itself an interface, the result may or may not be a Go log.Logger. func (l logger) GetUnderlying() StdLogger { return l.std }
go
MIT
f4fc3669ca8eb67aa350a76503397192bf26f057
2026-01-07T08:35:43.570558Z
false
jesseduffield/lazydocker
https://github.com/jesseduffield/lazydocker/blob/f4fc3669ca8eb67aa350a76503397192bf26f057/vendor/github.com/fvbommel/sortorder/natsort.go
vendor/github.com/fvbommel/sortorder/natsort.go
package sortorder // Natural implements sort.Interface to sort strings in natural order. This // means that e.g. "abc2" < "abc12". // // Non-digit sequences and numbers are compared separately. The former are // compared bytewise, while digits are compared numerically (except that // the number of leading zeros is used as a tie-breaker, so e.g. "2" < "02") // // Limitation: only ASCII digits (0-9) are considered. type Natural []string func (n Natural) Len() int { return len(n) } func (n Natural) Swap(i, j int) { n[i], n[j] = n[j], n[i] } func (n Natural) Less(i, j int) bool { return NaturalLess(n[i], n[j]) } func isDigit(b byte) bool { return '0' <= b && b <= '9' } // NaturalLess compares two strings using natural ordering. This means that e.g. // "abc2" < "abc12". // // Non-digit sequences and numbers are compared separately. The former are // compared bytewise, while digits are compared numerically (except that // the number of leading zeros is used as a tie-breaker, so e.g. "2" < "02") // // Limitation: only ASCII digits (0-9) are considered. func NaturalLess(str1, str2 string) bool { idx1, idx2 := 0, 0 for idx1 < len(str1) && idx2 < len(str2) { c1, c2 := str1[idx1], str2[idx2] dig1, dig2 := isDigit(c1), isDigit(c2) switch { case dig1 != dig2: // Digits before other characters. return dig1 // True if LHS is a digit, false if the RHS is one. case !dig1: // && !dig2, because dig1 == dig2 // UTF-8 compares bytewise-lexicographically, no need to decode // codepoints. if c1 != c2 { return c1 < c2 } idx1++ idx2++ default: // Digits // Eat zeros. for ; idx1 < len(str1) && str1[idx1] == '0'; idx1++ { } for ; idx2 < len(str2) && str2[idx2] == '0'; idx2++ { } // Eat all digits. nonZero1, nonZero2 := idx1, idx2 for ; idx1 < len(str1) && isDigit(str1[idx1]); idx1++ { } for ; idx2 < len(str2) && isDigit(str2[idx2]); idx2++ { } // If lengths of numbers with non-zero prefix differ, the shorter // one is less. if len1, len2 := idx1-nonZero1, idx2-nonZero2; len1 != len2 { return len1 < len2 } // If they're equally long, string comparison is correct. if nr1, nr2 := str1[nonZero1:idx1], str2[nonZero2:idx2]; nr1 != nr2 { return nr1 < nr2 } // Otherwise, the one with less zeros is less. // Because everything up to the number is equal, comparing the index // after the zeros is sufficient. if nonZero1 != nonZero2 { return nonZero1 < nonZero2 } } // They're identical so far, so continue comparing. } // So far they are identical. At least one is ended. If the other continues, // it sorts last. return len(str1) < len(str2) }
go
MIT
f4fc3669ca8eb67aa350a76503397192bf26f057
2026-01-07T08:35:43.570558Z
false
jesseduffield/lazydocker
https://github.com/jesseduffield/lazydocker/blob/f4fc3669ca8eb67aa350a76503397192bf26f057/vendor/github.com/fvbommel/sortorder/doc.go
vendor/github.com/fvbommel/sortorder/doc.go
// Package sortorder implements sort orders and comparison functions. // // Currently, it only implements so-called "natural order", where integers // embedded in strings are compared by value. package sortorder // import "github.com/fvbommel/sortorder"
go
MIT
f4fc3669ca8eb67aa350a76503397192bf26f057
2026-01-07T08:35:43.570558Z
false
jesseduffield/lazydocker
https://github.com/jesseduffield/lazydocker/blob/f4fc3669ca8eb67aa350a76503397192bf26f057/vendor/github.com/integrii/flaggy/flag.go
vendor/github.com/integrii/flaggy/flag.go
package flaggy import ( "errors" "fmt" "net" "reflect" "strconv" "strings" "time" ) // Flag holds the base methods for all flag types type Flag struct { ShortName string LongName string Description string rawValue string // the value as a string before being parsed Hidden bool // indicates this flag should be hidden from help and suggestions AssignmentVar interface{} defaultValue string // the value (as a string), that was set by default before any parsing and assignment parsed bool // indicates that this flag has already been parsed } // HasName indicates that this flag's short or long name matches the // supplied name string func (f *Flag) HasName(name string) bool { name = strings.TrimSpace(name) if f.ShortName == name || f.LongName == name { return true } return false } // identifyAndAssignValue identifies the type of the incoming value // and assigns it to the AssignmentVar pointer's target value. If // the value is a type that needs parsing, that is performed as well. func (f *Flag) identifyAndAssignValue(value string) error { var err error // Only parse this flag default value once. This keeps us from // overwriting the default value in help output if !f.parsed { f.parsed = true // parse the default value as a string and remember it for help output f.defaultValue, err = f.returnAssignmentVarValueAsString() if err != nil { return err } } debugPrint("attempting to assign value", value, "to flag", f.LongName) f.rawValue = value // remember the raw value // depending on the type of the assignment variable, we convert the // incoming string and assign it. We only use pointers to variables // in flagy. No returning vars by value. switch f.AssignmentVar.(type) { case *string: v, _ := (f.AssignmentVar).(*string) *v = value case *[]string: v := f.AssignmentVar.(*[]string) splitString := strings.Split(value, ",") new := append(*v, splitString...) *v = new case *bool: v, err := strconv.ParseBool(value) if err != nil { return err } a, _ := (f.AssignmentVar).(*bool) *a = v case *[]bool: // parse the incoming bool b, err := strconv.ParseBool(value) if err != nil { return err } // cast the assignment var existing := f.AssignmentVar.(*[]bool) // deref the assignment var and append to it v := append(*existing, b) // pointer the new value and assign it a, _ := (f.AssignmentVar).(*[]bool) *a = v case *time.Duration: v, err := time.ParseDuration(value) if err != nil { return err } a, _ := (f.AssignmentVar).(*time.Duration) *a = v case *[]time.Duration: t, err := time.ParseDuration(value) if err != nil { return err } existing := f.AssignmentVar.(*[]time.Duration) // deref the assignment var and append to it v := append(*existing, t) // pointer the new value and assign it a, _ := (f.AssignmentVar).(*[]time.Duration) *a = v case *float32: v, err := strconv.ParseFloat(value, 32) if err != nil { return err } float := float32(v) a, _ := (f.AssignmentVar).(*float32) *a = float case *[]float32: v, err := strconv.ParseFloat(value, 32) if err != nil { return err } float := float32(v) existing := f.AssignmentVar.(*[]float32) new := append(*existing, float) *existing = new case *float64: v, err := strconv.ParseFloat(value, 64) if err != nil { return err } a, _ := (f.AssignmentVar).(*float64) *a = v case *[]float64: v, err := strconv.ParseFloat(value, 64) if err != nil { return err } existing := f.AssignmentVar.(*[]float64) new := append(*existing, v) *existing = new case *int: v, err := strconv.Atoi(value) if err != nil { return err } e := f.AssignmentVar.(*int) *e = v case *[]int: v, err := strconv.Atoi(value) if err != nil { return err } existing := f.AssignmentVar.(*[]int) new := append(*existing, v) *existing = new case *uint: v, err := strconv.ParseUint(value, 10, 64) if err != nil { return err } existing := f.AssignmentVar.(*uint) *existing = uint(v) case *[]uint: v, err := strconv.ParseUint(value, 10, 64) if err != nil { return err } existing := f.AssignmentVar.(*[]uint) new := append(*existing, uint(v)) *existing = new case *uint64: v, err := strconv.ParseUint(value, 10, 64) if err != nil { return err } existing := f.AssignmentVar.(*uint64) *existing = v case *[]uint64: v, err := strconv.ParseUint(value, 10, 64) if err != nil { return err } existing := f.AssignmentVar.(*[]uint64) new := append(*existing, v) *existing = new case *uint32: v, err := strconv.ParseUint(value, 10, 32) if err != nil { return err } existing := f.AssignmentVar.(*uint32) *existing = uint32(v) case *[]uint32: v, err := strconv.ParseUint(value, 10, 32) if err != nil { return err } existing := f.AssignmentVar.(*[]uint32) new := append(*existing, uint32(v)) *existing = new case *uint16: v, err := strconv.ParseUint(value, 10, 16) if err != nil { return err } val := uint16(v) existing := f.AssignmentVar.(*uint16) *existing = val case *[]uint16: v, err := strconv.ParseUint(value, 10, 16) if err != nil { return err } existing := f.AssignmentVar.(*[]uint16) new := append(*existing, uint16(v)) *existing = new case *uint8: v, err := strconv.ParseUint(value, 10, 8) if err != nil { return err } val := uint8(v) existing := f.AssignmentVar.(*uint8) *existing = val case *[]uint8: var newSlice []uint8 v, err := strconv.ParseUint(value, 10, 8) if err != nil { return err } newV := uint8(v) existing := f.AssignmentVar.(*[]uint8) newSlice = append(*existing, newV) *existing = newSlice case *int64: v, err := strconv.ParseInt(value, 10, 64) if err != nil { return err } existing := f.AssignmentVar.(*int64) *existing = v case *[]int64: v, err := strconv.ParseInt(value, 10, 64) if err != nil { return err } existingSlice := f.AssignmentVar.(*[]int64) newSlice := append(*existingSlice, v) *existingSlice = newSlice case *int32: v, err := strconv.ParseInt(value, 10, 32) if err != nil { return err } converted := int32(v) existing := f.AssignmentVar.(*int32) *existing = converted case *[]int32: v, err := strconv.ParseInt(value, 10, 32) if err != nil { return err } existingSlice := f.AssignmentVar.(*[]int32) newSlice := append(*existingSlice, int32(v)) *existingSlice = newSlice case *int16: v, err := strconv.ParseInt(value, 10, 16) if err != nil { return err } converted := int16(v) existing := f.AssignmentVar.(*int16) *existing = converted case *[]int16: v, err := strconv.ParseInt(value, 10, 16) if err != nil { return err } existingSlice := f.AssignmentVar.(*[]int16) newSlice := append(*existingSlice, int16(v)) *existingSlice = newSlice case *int8: v, err := strconv.ParseInt(value, 10, 8) if err != nil { return err } converted := int8(v) existing := f.AssignmentVar.(*int8) *existing = converted case *[]int8: v, err := strconv.ParseInt(value, 10, 8) if err != nil { return err } existingSlice := f.AssignmentVar.(*[]int8) newSlice := append(*existingSlice, int8(v)) *existingSlice = newSlice case *net.IP: v := net.ParseIP(value) existing := f.AssignmentVar.(*net.IP) *existing = v case *[]net.IP: v := net.ParseIP(value) existing := f.AssignmentVar.(*[]net.IP) new := append(*existing, v) *existing = new case *net.HardwareAddr: v, err := net.ParseMAC(value) if err != nil { return err } existing := f.AssignmentVar.(*net.HardwareAddr) *existing = v case *[]net.HardwareAddr: v, err := net.ParseMAC(value) if err != nil { return err } existing := f.AssignmentVar.(*[]net.HardwareAddr) new := append(*existing, v) *existing = new case *net.IPMask: v := net.IPMask(net.ParseIP(value).To4()) existing := f.AssignmentVar.(*net.IPMask) *existing = v case *[]net.IPMask: v := net.IPMask(net.ParseIP(value).To4()) existing := f.AssignmentVar.(*[]net.IPMask) new := append(*existing, v) *existing = new default: return errors.New("Unknown flag assignmentVar supplied in flag " + f.LongName + " " + f.ShortName) } return err } const argIsPositional = "positional" // subcommand or positional value const argIsFlagWithSpace = "flagWithSpace" // -f path or --file path const argIsFlagWithValue = "flagWithValue" // -f=path or --file=path const argIsFinal = "final" // the final argument only '--' // determineArgType determines if the specified arg is a flag with space // separated value, a flag with a connected value, or neither (positional) func determineArgType(arg string) string { // if the arg is --, then its the final arg if arg == "--" { return argIsFinal } // if it has the prefix --, then its a long flag if strings.HasPrefix(arg, "--") { // if it contains an equals, it is a joined value if strings.Contains(arg, "=") { return argIsFlagWithValue } return argIsFlagWithSpace } // if it has the prefix -, then its a short flag if strings.HasPrefix(arg, "-") { // if it contains an equals, it is a joined value if strings.Contains(arg, "=") { return argIsFlagWithValue } return argIsFlagWithSpace } return argIsPositional } // parseArgWithValue parses a key=value concatenated argument into a key and // value func parseArgWithValue(arg string) (key string, value string) { // remove up to two minuses from start of flag arg = strings.TrimPrefix(arg, "-") arg = strings.TrimPrefix(arg, "-") // debugPrint("parseArgWithValue parsing", arg) // break at the equals args := strings.SplitN(arg, "=", 2) // if its a bool arg, with no explicit value, we return a blank if len(args) == 1 { return args[0], "" } // if its a key and value pair, we return those if len(args) == 2 { // debugPrint("parseArgWithValue parsed", args[0], args[1]) return args[0], args[1] } fmt.Println("Warning: attempted to parseArgWithValue but did not have correct parameter count.", arg, "->", args) return "", "" } // parseFlagToName parses a flag with space value down to a key name: // --path -> path // -p -> p func parseFlagToName(arg string) string { // remove minus from start arg = strings.TrimLeft(arg, "-") arg = strings.TrimLeft(arg, "-") return arg } // flagIsBool determines if the flag is a bool within the specified parser // and subcommand's context func flagIsBool(sc *Subcommand, p *Parser, key string) bool { for _, f := range append(sc.Flags, p.Flags...) { if f.HasName(key) { _, isBool := f.AssignmentVar.(*bool) _, isBoolSlice := f.AssignmentVar.(*[]bool) if isBool || isBoolSlice { return true } } } // by default, the answer is false return false } // returnAssignmentVarValueAsString returns the value of the flag's // assignment variable as a string. This is used to display the // default value of flags before they are assigned (like when help is output). func (f *Flag) returnAssignmentVarValueAsString() (string, error) { debugPrint("returning current value of assignment var of flag", f.LongName) var err error // depending on the type of the assignment variable, we convert the // incoming string and assign it. We only use pointers to variables // in flagy. No returning vars by value. switch f.AssignmentVar.(type) { case *string: v, _ := (f.AssignmentVar).(*string) return *v, err case *[]string: v := f.AssignmentVar.(*[]string) return strings.Join(*v, ","), err case *bool: a, _ := (f.AssignmentVar).(*bool) return strconv.FormatBool(*a), err case *[]bool: value := f.AssignmentVar.(*[]bool) var ss []string for _, b := range *value { ss = append(ss, strconv.FormatBool(b)) } return strings.Join(ss, ","), err case *time.Duration: a := f.AssignmentVar.(*time.Duration) return (*a).String(), err case *[]time.Duration: tds := f.AssignmentVar.(*[]time.Duration) var asSlice []string for _, td := range *tds { asSlice = append(asSlice, td.String()) } return strings.Join(asSlice, ","), err case *float32: a := f.AssignmentVar.(*float32) return strconv.FormatFloat(float64(*a), 'f', 2, 32), err case *[]float32: v := f.AssignmentVar.(*[]float32) var strSlice []string for _, f := range *v { formatted := strconv.FormatFloat(float64(f), 'f', 2, 32) strSlice = append(strSlice, formatted) } return strings.Join(strSlice, ","), err case *float64: a := f.AssignmentVar.(*float64) return strconv.FormatFloat(float64(*a), 'f', 2, 64), err case *[]float64: v := f.AssignmentVar.(*[]float64) var strSlice []string for _, f := range *v { formatted := strconv.FormatFloat(float64(f), 'f', 2, 64) strSlice = append(strSlice, formatted) } return strings.Join(strSlice, ","), err case *int: a := f.AssignmentVar.(*int) return strconv.Itoa(*a), err case *[]int: val := f.AssignmentVar.(*[]int) var strSlice []string for _, i := range *val { str := strconv.Itoa(i) strSlice = append(strSlice, str) } return strings.Join(strSlice, ","), err case *uint: v := f.AssignmentVar.(*uint) return strconv.FormatUint(uint64(*v), 10), err case *[]uint: values := f.AssignmentVar.(*[]uint) var strVars []string for _, i := range *values { strVars = append(strVars, strconv.FormatUint(uint64(i), 10)) } return strings.Join(strVars, ","), err case *uint64: v := f.AssignmentVar.(*uint64) return strconv.FormatUint(*v, 10), err case *[]uint64: values := f.AssignmentVar.(*[]uint64) var strVars []string for _, i := range *values { strVars = append(strVars, strconv.FormatUint(i, 10)) } return strings.Join(strVars, ","), err case *uint32: v := f.AssignmentVar.(*uint32) return strconv.FormatUint(uint64(*v), 10), err case *[]uint32: values := f.AssignmentVar.(*[]uint32) var strVars []string for _, i := range *values { strVars = append(strVars, strconv.FormatUint(uint64(i), 10)) } return strings.Join(strVars, ","), err case *uint16: v := f.AssignmentVar.(*uint16) return strconv.FormatUint(uint64(*v), 10), err case *[]uint16: values := f.AssignmentVar.(*[]uint16) var strVars []string for _, i := range *values { strVars = append(strVars, strconv.FormatUint(uint64(i), 10)) } return strings.Join(strVars, ","), err case *uint8: v := f.AssignmentVar.(*uint8) return strconv.FormatUint(uint64(*v), 10), err case *[]uint8: values := f.AssignmentVar.(*[]uint8) var strVars []string for _, i := range *values { strVars = append(strVars, strconv.FormatUint(uint64(i), 10)) } return strings.Join(strVars, ","), err case *int64: v := f.AssignmentVar.(*int64) return strconv.FormatInt(int64(*v), 10), err case *[]int64: values := f.AssignmentVar.(*[]int64) var strVars []string for _, i := range *values { strVars = append(strVars, strconv.FormatInt(i, 10)) } return strings.Join(strVars, ","), err case *int32: v := f.AssignmentVar.(*int32) return strconv.FormatInt(int64(*v), 10), err case *[]int32: values := f.AssignmentVar.(*[]int32) var strVars []string for _, i := range *values { strVars = append(strVars, strconv.FormatInt(int64(i), 10)) } return strings.Join(strVars, ","), err case *int16: v := f.AssignmentVar.(*int16) return strconv.FormatInt(int64(*v), 10), err case *[]int16: values := f.AssignmentVar.(*[]int16) var strVars []string for _, i := range *values { strVars = append(strVars, strconv.FormatInt(int64(i), 10)) } return strings.Join(strVars, ","), err case *int8: v := f.AssignmentVar.(*int8) return strconv.FormatInt(int64(*v), 10), err case *[]int8: values := f.AssignmentVar.(*[]int8) var strVars []string for _, i := range *values { strVars = append(strVars, strconv.FormatInt(int64(i), 10)) } return strings.Join(strVars, ","), err case *net.IP: val := f.AssignmentVar.(*net.IP) return val.String(), err case *[]net.IP: val := f.AssignmentVar.(*[]net.IP) var strSlice []string for _, ip := range *val { strSlice = append(strSlice, ip.String()) } return strings.Join(strSlice, ","), err case *net.HardwareAddr: val := f.AssignmentVar.(*net.HardwareAddr) return val.String(), err case *[]net.HardwareAddr: val := f.AssignmentVar.(*[]net.HardwareAddr) var strSlice []string for _, mac := range *val { strSlice = append(strSlice, mac.String()) } return strings.Join(strSlice, ","), err case *net.IPMask: val := f.AssignmentVar.(*net.IPMask) return val.String(), err case *[]net.IPMask: val := f.AssignmentVar.(*[]net.IPMask) var strSlice []string for _, m := range *val { strSlice = append(strSlice, m.String()) } return strings.Join(strSlice, ","), err default: return "", errors.New("Unknown flag assignmentVar found in flag " + f.LongName + " " + f.ShortName + ". Type not supported: " + reflect.TypeOf(f.AssignmentVar).String()) } }
go
MIT
f4fc3669ca8eb67aa350a76503397192bf26f057
2026-01-07T08:35:43.570558Z
false
jesseduffield/lazydocker
https://github.com/jesseduffield/lazydocker/blob/f4fc3669ca8eb67aa350a76503397192bf26f057/vendor/github.com/integrii/flaggy/parser.go
vendor/github.com/integrii/flaggy/parser.go
package flaggy import ( "errors" "fmt" "os" "strconv" "text/template" ) // Parser represents the set of flags and subcommands we are expecting // from our input arguments. Parser is the top level struct responsible for // parsing an entire set of subcommands and flags. type Parser struct { Subcommand Version string // the optional version of the parser. ShowHelpWithHFlag bool // display help when -h or --help passed ShowVersionWithVersionFlag bool // display the version when --version passed ShowHelpOnUnexpected bool // display help when an unexpected flag or subcommand is passed TrailingArguments []string // everything after a -- is placed here HelpTemplate *template.Template // template for Help output trailingArgumentsExtracted bool // indicates that trailing args have been parsed and should not be appended again parsed bool // indicates this parser has parsed subcommandContext *Subcommand // points to the most specific subcommand being used } // NewParser creates a new ArgumentParser ready to parse inputs func NewParser(name string) *Parser { // this can not be done inline because of struct embedding p := &Parser{} p.Name = name p.Version = defaultVersion p.ShowHelpOnUnexpected = true p.ShowHelpWithHFlag = true p.ShowVersionWithVersionFlag = true p.SetHelpTemplate(DefaultHelpTemplate) p.subcommandContext = &Subcommand{} return p } // ParseArgs parses as if the passed args were the os.Args, but without the // binary at the 0 position in the array. An error is returned if there // is a low level issue converting flags to their proper type. No error // is returned for invalid arguments or missing require subcommands. func (p *Parser) ParseArgs(args []string) error { if p.parsed { return errors.New("Parser.Parse() called twice on parser with name: " + " " + p.Name + " " + p.ShortName) } p.parsed = true debugPrint("Kicking off parsing with args:", args) err := p.parse(p, args, 0) if err != nil { return err } // if we are set to crash on unexpected args, look for those here TODO if p.ShowHelpOnUnexpected { parsedValues := p.findAllParsedValues() debugPrint("parsedValues:", parsedValues) argsNotParsed := findArgsNotInParsedValues(args, parsedValues) if len(argsNotParsed) > 0 { // flatten out unused args for our error message var argsNotParsedFlat string for _, a := range argsNotParsed { argsNotParsedFlat = argsNotParsedFlat + " " + a } p.ShowHelpAndExit("Unknown arguments supplied: " + argsNotParsedFlat) } } return nil } // findArgsNotInParsedValues finds arguments not used in parsed values. The // incoming args should be in the order supplied by the user and should not // include the invoked binary, which is normally the first thing in os.Args. func findArgsNotInParsedValues(args []string, parsedValues []parsedValue) []string { var argsNotUsed []string var skipNext bool for _, a := range args { // if the final argument (--) is seen, then we stop checking because all // further values are trailing arguments. if determineArgType(a) == argIsFinal { return argsNotUsed } // allow for skipping the next arg when needed if skipNext { skipNext = false continue } // strip flag slashes from incoming arguments so they match up with the // keys from parsedValues. arg := parseFlagToName(a) // indicates that we found this arg used in one of the parsed values. Used // to indicate which values should be added to argsNotUsed. var foundArgUsed bool // search all args for a corresponding parsed value for _, pv := range parsedValues { // this argumenet was a key // debugPrint(pv.Key, "==", arg) debugPrint(pv.Key + "==" + arg + " || (" + strconv.FormatBool(pv.IsPositional) + " && " + pv.Value + " == " + arg + ")") if pv.Key == arg || (pv.IsPositional && pv.Value == arg) { debugPrint("Found matching parsed arg for " + pv.Key) foundArgUsed = true // the arg was used in this parsedValues set // if the value is not a positional value and the parsed value had a // value that was not blank, we skip the next value in the argument list if !pv.IsPositional && len(pv.Value) > 0 { skipNext = true break } } // this prevents excessive parsed values from being checked after we find // the arg used for the first time if foundArgUsed { break } } // if the arg was not used in any parsed values, then we add it to the slice // of arguments not used if !foundArgUsed { argsNotUsed = append(argsNotUsed, arg) } } return argsNotUsed } // ShowVersionAndExit shows the version of this parser func (p *Parser) ShowVersionAndExit() { fmt.Println("Version:", p.Version) exitOrPanic(0) } // SetHelpTemplate sets the go template this parser will use when rendering // Help. func (p *Parser) SetHelpTemplate(tmpl string) error { var err error p.HelpTemplate = template.New(helpFlagLongName) p.HelpTemplate, err = p.HelpTemplate.Parse(tmpl) if err != nil { return err } return nil } // Parse calculates all flags and subcommands func (p *Parser) Parse() error { err := p.ParseArgs(os.Args[1:]) if err != nil { return err } return nil } // ShowHelp shows Help without an error message func (p *Parser) ShowHelp() { debugPrint("showing help for", p.subcommandContext.Name) p.ShowHelpWithMessage("") } // ShowHelpAndExit shows parser help and exits with status code 2 func (p *Parser) ShowHelpAndExit(message string) { p.ShowHelpWithMessage(message) exitOrPanic(2) } // ShowHelpWithMessage shows the Help for this parser with an optional string error // message as a header. The supplied subcommand will be the context of Help // displayed to the user. func (p *Parser) ShowHelpWithMessage(message string) { // create a new Help values template and extract values into it help := Help{} help.ExtractValues(p, message) err := p.HelpTemplate.Execute(os.Stderr, help) if err != nil { fmt.Fprintln(os.Stderr, "Error rendering Help template:", err) } } // DisableShowVersionWithVersion disables the showing of version information // with --version. It is enabled by default. func (p *Parser) DisableShowVersionWithVersion() { p.ShowVersionWithVersionFlag = false }
go
MIT
f4fc3669ca8eb67aa350a76503397192bf26f057
2026-01-07T08:35:43.570558Z
false
jesseduffield/lazydocker
https://github.com/jesseduffield/lazydocker/blob/f4fc3669ca8eb67aa350a76503397192bf26f057/vendor/github.com/integrii/flaggy/positionalValue.go
vendor/github.com/integrii/flaggy/positionalValue.go
package flaggy // PositionalValue represents a value which is determined by its position // relative to where a subcommand was detected. type PositionalValue struct { Name string // used in documentation only Description string AssignmentVar *string // the var that will get this variable Position int // the position, not including switches, of this variable Required bool // this subcommand must always be specified Found bool // was this positional found during parsing? Hidden bool // indicates this positional value should be hidden from help defaultValue string // used for help output }
go
MIT
f4fc3669ca8eb67aa350a76503397192bf26f057
2026-01-07T08:35:43.570558Z
false
jesseduffield/lazydocker
https://github.com/jesseduffield/lazydocker/blob/f4fc3669ca8eb67aa350a76503397192bf26f057/vendor/github.com/integrii/flaggy/subCommand.go
vendor/github.com/integrii/flaggy/subCommand.go
package flaggy import ( "fmt" "log" "net" "os" "strconv" "strings" "time" ) // Subcommand represents a subcommand which contains a set of child // subcommands along with a set of flags relevant to it. Parsing // runs until a subcommand is detected by matching its name and // position. Once a matching subcommand is found, the next set // of parsing occurs within that matched subcommand. type Subcommand struct { Name string ShortName string Description string Position int // the position of this subcommand, not including flags Subcommands []*Subcommand Flags []*Flag PositionalFlags []*PositionalValue ParsedValues []parsedValue // a list of values and positionals parsed AdditionalHelpPrepend string // additional prepended message when Help is displayed AdditionalHelpAppend string // additional appended message when Help is displayed Used bool // indicates this subcommand was found and parsed Hidden bool // indicates this subcommand should be hidden from help } // NewSubcommand creates a new subcommand that can have flags or PositionalFlags // added to it. The position starts with 1, not 0 func NewSubcommand(name string) *Subcommand { if len(name) == 0 { fmt.Fprintln(os.Stderr, "Error creating subcommand (NewSubcommand()). No subcommand name was specified.") exitOrPanic(2) } newSC := &Subcommand{ Name: name, } return newSC } // parseAllFlagsFromArgs parses the non-positional flags such as -f or -v=value // out of the supplied args and returns the resulting positional items in order, // all the flag names found (without values), a bool to indicate if help was // requested, and any errors found during parsing func (sc *Subcommand) parseAllFlagsFromArgs(p *Parser, args []string) ([]string, bool, error) { var positionalOnlyArguments []string var helpRequested bool // indicates the user has supplied -h and we // should render help if we are the last subcommand // indicates we should skip the next argument, like when parsing a flag // that separates key and value by space var skipNext bool // endArgfound indicates that a -- was found and everything // remaining should be added to the trailing arguments slices var endArgFound bool // find all the normal flags (not positional) and parse them out for i, a := range args { debugPrint("parsing arg:", a) // evaluate if there is a following arg to avoid panics var nextArgExists bool var nextArg string if len(args)-1 >= i+1 { nextArgExists = true nextArg = args[i+1] } // if end arg -- has been found, just add everything to TrailingArguments if endArgFound { if !p.trailingArgumentsExtracted { p.TrailingArguments = append(p.TrailingArguments, a) } continue } // skip this run if specified if skipNext { skipNext = false debugPrint("skipping flag because it is an arg:", a) continue } // parse the flag into its name for consideration without dashes flagName := parseFlagToName(a) // if the flag being passed is version or v and the option to display // version with version flags, then display version if p.ShowVersionWithVersionFlag { if flagName == versionFlagLongName { p.ShowVersionAndExit() } } // if the show Help on h flag option is set, then show Help when h or Help // is passed as an option if p.ShowHelpWithHFlag { if flagName == helpFlagShortName || flagName == helpFlagLongName { // Ensure this is the last subcommand passed so we give the correct // help output helpRequested = true continue } } // determine what kind of flag this is argType := determineArgType(a) // strip flags from arg // debugPrint("Parsing flag named", a, "of type", argType) // depending on the flag type, parse the key and value out, then apply it switch argType { case argIsFinal: // debugPrint("Arg", i, "is final:", a) endArgFound = true case argIsPositional: // debugPrint("Arg is positional or subcommand:", a) // this positional argument into a slice of their own, so that // we can determine if its a subcommand or positional value later positionalOnlyArguments = append(positionalOnlyArguments, a) // track this as a parsed value with the subcommand sc.addParsedPositionalValue(a) case argIsFlagWithSpace: // a flag with a space. ex) -k v or --key value a = parseFlagToName(a) // debugPrint("Arg", i, "is flag with space:", a) // parse next arg as value to this flag and apply to subcommand flags // if the flag is a bool flag, then we check for a following positional // and skip it if necessary if flagIsBool(sc, p, a) { debugPrint(sc.Name, "bool flag", a, "next var is:", nextArg) // set the value in this subcommand and its root parser valueSet, err := setValueForParsers(a, "true", p, sc) // if an error occurs, just return it and quit parsing if err != nil { return []string{}, false, err } // log all values parsed by this subcommand. We leave the value blank // because the bool value had no explicit true or false supplied if valueSet { sc.addParsedFlag(a, "") } // we've found and set a standalone bool flag, so we move on to the next // argument in the list of arguments continue } skipNext = true // debugPrint(sc.Name, "NOT bool flag", a) // if the next arg was not found, then show a Help message if !nextArgExists { p.ShowHelpWithMessage("Expected a following arg for flag " + a + ", but it did not exist.") exitOrPanic(2) } valueSet, err := setValueForParsers(a, nextArg, p, sc) if err != nil { return []string{}, false, err } // log all parsed values in the subcommand if valueSet { sc.addParsedFlag(a, nextArg) } case argIsFlagWithValue: // a flag with an equals sign. ex) -k=v or --key=value // debugPrint("Arg", i, "is flag with value:", a) a = parseFlagToName(a) // parse flag into key and value and apply to subcommand flags key, val := parseArgWithValue(a) // set the value in this subcommand and its root parser valueSet, err := setValueForParsers(key, val, p, sc) if err != nil { return []string{}, false, err } // log all values parsed by the subcommand if valueSet { sc.addParsedFlag(a, val) } } } return positionalOnlyArguments, helpRequested, nil } // findAllParsedValues finds all values parsed by all subcommands and this // subcommand and its child subcommands func (sc *Subcommand) findAllParsedValues() []parsedValue { parsedValues := sc.ParsedValues for _, sc := range sc.Subcommands { // skip unused subcommands if !sc.Used { continue } parsedValues = append(parsedValues, sc.findAllParsedValues()...) } return parsedValues } // parse causes the argument parser to parse based on the supplied []string. // depth specifies the non-flag subcommand positional depth. A slice of flags // and subcommands parsed is returned so that the parser can ultimately decide // if there were any unexpected values supplied by the user func (sc *Subcommand) parse(p *Parser, args []string, depth int) error { debugPrint("- Parsing subcommand", sc.Name, "with depth of", depth, "and args", args) // if a command is parsed, its used sc.Used = true debugPrint("used subcommand", sc.Name, sc.ShortName) if len(sc.Name) > 0 { sc.addParsedPositionalValue(sc.Name) } if len(sc.ShortName) > 0 { sc.addParsedPositionalValue(sc.ShortName) } // as subcommands are used, they become the context of the parser. This helps // us understand how to display help based on which subcommand is being used p.subcommandContext = sc // ensure that help and version flags are not used if the parser has the // built-in help and version flags enabled if p.ShowHelpWithHFlag { sc.ensureNoConflictWithBuiltinHelp() } if p.ShowVersionWithVersionFlag { sc.ensureNoConflictWithBuiltinVersion() } // Parse the normal flags out of the argument list and return the positionals // (subcommands and positional values), along with the flags used. // Then the flag values are applied to the parent parser and the current // subcommand being parsed. positionalOnlyArguments, helpRequested, err := sc.parseAllFlagsFromArgs(p, args) if err != nil { return err } // indicate that trailing arguments have been extracted, so that they aren't // appended a second time p.trailingArgumentsExtracted = true // loop over positional values and look for their matching positional // parameter, or their positional command. If neither are found, then // we throw an error var parsedArgCount int for pos, v := range positionalOnlyArguments { // the first relative positional argument will be human natural at position 1 // but offset for the depth of relative commands being parsed for currently. relativeDepth := pos - depth + 1 // debugPrint("Parsing positional only position", relativeDepth, "with value", v) if relativeDepth < 1 { // debugPrint(sc.Name, "skipped value:", v) continue } parsedArgCount++ // determine subcommands and parse them by positional value and name for _, cmd := range sc.Subcommands { // debugPrint("Subcommand being compared", relativeDepth, "==", cmd.Position, "and", v, "==", cmd.Name, "==", cmd.ShortName) if relativeDepth == cmd.Position && (v == cmd.Name || v == cmd.ShortName) { debugPrint("Decending into positional subcommand", cmd.Name, "at relativeDepth", relativeDepth, "and absolute depth", depth+1) return cmd.parse(p, args, depth+parsedArgCount) // continue recursive positional parsing } } // determine positional args and parse them by positional value and name var foundPositional bool for _, val := range sc.PositionalFlags { if relativeDepth == val.Position { debugPrint("Found a positional value at relativePos:", relativeDepth, "value:", v) // set original value for help output val.defaultValue = *val.AssignmentVar // defrerence the struct pointer, then set the pointer property within it *val.AssignmentVar = v // debugPrint("set positional to value", *val.AssignmentVar) foundPositional = true val.Found = true break } } // if there aren't any positional flags but there are subcommands that // were not used, display a useful message with subcommand options. if !foundPositional && p.ShowHelpOnUnexpected { debugPrint("No positional at position", relativeDepth) var foundSubcommandAtDepth bool for _, cmd := range sc.Subcommands { if cmd.Position == relativeDepth { foundSubcommandAtDepth = true } } // if there is a subcommand here but it was not specified, display them all // as a suggestion to the user before exiting. if foundSubcommandAtDepth { // determine which name to use in upcoming help output fmt.Fprintln(os.Stderr, sc.Name+":", "No subcommand or positional value found at position", strconv.Itoa(relativeDepth)+".") var output string for _, cmd := range sc.Subcommands { if cmd.Hidden { continue } output = output + " " + cmd.Name } // if there are available subcommands, let the user know if len(output) > 0 { output = strings.TrimLeft(output, " ") fmt.Println("Available subcommands:", output) } exitOrPanic(2) } // if there were not any flags or subcommands at this position at all, then // throw an error (display Help if necessary) p.ShowHelpWithMessage("Unexpected argument: " + v) exitOrPanic(2) } } // if help was requested and we should show help when h is passed, if helpRequested && p.ShowHelpWithHFlag { p.ShowHelp() exitOrPanic(0) } // find any positionals that were not used on subcommands that were // found and throw help (unknown argument) in the global parse or subcommand for _, pv := range p.PositionalFlags { if pv.Required && !pv.Found { p.ShowHelpWithMessage("Required global positional variable " + pv.Name + " not found at position " + strconv.Itoa(pv.Position)) exitOrPanic(2) } } for _, pv := range sc.PositionalFlags { if pv.Required && !pv.Found { p.ShowHelpWithMessage("Required positional of subcommand " + sc.Name + " named " + pv.Name + " not found at position " + strconv.Itoa(pv.Position)) exitOrPanic(2) } } return nil } // addParsedFlag makes it easy to append flag values parsed by the subcommand func (sc *Subcommand) addParsedFlag(key string, value string) { sc.ParsedValues = append(sc.ParsedValues, newParsedValue(key, value, false)) } // addParsedPositionalValue makes it easy to append positionals parsed by the // subcommand func (sc *Subcommand) addParsedPositionalValue(value string) { sc.ParsedValues = append(sc.ParsedValues, newParsedValue("", value, true)) } // FlagExists lets you know if the flag name exists as either a short or long // name in the (sub)command func (sc *Subcommand) FlagExists(name string) bool { for _, f := range sc.Flags { if f.HasName(name) { return true } } return false } // AttachSubcommand adds a possible subcommand to the Parser. func (sc *Subcommand) AttachSubcommand(newSC *Subcommand, relativePosition int) { // assign the depth of the subcommand when its attached newSC.Position = relativePosition // ensure no subcommands at this depth with this name for _, other := range sc.Subcommands { if newSC.Position == other.Position { if newSC.Name != "" { if newSC.Name == other.Name { log.Panicln("Unable to add subcommand because one already exists at position" + strconv.Itoa(newSC.Position) + " with name " + other.Name) } } if newSC.ShortName != "" { if newSC.ShortName == other.ShortName { log.Panicln("Unable to add subcommand because one already exists at position" + strconv.Itoa(newSC.Position) + " with name " + other.ShortName) } } } } // ensure no positionals at this depth for _, other := range sc.PositionalFlags { if newSC.Position == other.Position { log.Panicln("Unable to add subcommand because a positional value already exists at position " + strconv.Itoa(newSC.Position) + ": " + other.Name) } } sc.Subcommands = append(sc.Subcommands, newSC) } // add is a "generic" to add flags of any type. Checks the supplied parent // parser to ensure that the user isn't setting version or help flags that // conflict with the built-in help and version flag behavior. func (sc *Subcommand) add(assignmentVar interface{}, shortName string, longName string, description string) { // if the flag is already used, throw an error for _, existingFlag := range sc.Flags { if longName != "" && existingFlag.LongName == longName { log.Panicln("Flag " + longName + " added to subcommand " + sc.Name + " but the name is already assigned.") } if shortName != "" && existingFlag.ShortName == shortName { log.Panicln("Flag " + shortName + " added to subcommand " + sc.Name + " but the short name is already assigned.") } } newFlag := Flag{ AssignmentVar: assignmentVar, ShortName: shortName, LongName: longName, Description: description, } sc.Flags = append(sc.Flags, &newFlag) } // String adds a new string flag func (sc *Subcommand) String(assignmentVar *string, shortName string, longName string, description string) { sc.add(assignmentVar, shortName, longName, description) } // StringSlice adds a new slice of strings flag // Specify the flag multiple times to fill the slice func (sc *Subcommand) StringSlice(assignmentVar *[]string, shortName string, longName string, description string) { sc.add(assignmentVar, shortName, longName, description) } // Bool adds a new bool flag func (sc *Subcommand) Bool(assignmentVar *bool, shortName string, longName string, description string) { sc.add(assignmentVar, shortName, longName, description) } // BoolSlice adds a new slice of bools flag // Specify the flag multiple times to fill the slice func (sc *Subcommand) BoolSlice(assignmentVar *[]bool, shortName string, longName string, description string) { sc.add(assignmentVar, shortName, longName, description) } // ByteSlice adds a new slice of bytes flag // Specify the flag multiple times to fill the slice. Takes hex as input. func (sc *Subcommand) ByteSlice(assignmentVar *[]byte, shortName string, longName string, description string) { sc.add(assignmentVar, shortName, longName, description) } // Duration adds a new time.Duration flag. // Input format is described in time.ParseDuration(). // Example values: 1h, 1h50m, 32s func (sc *Subcommand) Duration(assignmentVar *time.Duration, shortName string, longName string, description string) { sc.add(assignmentVar, shortName, longName, description) } // DurationSlice adds a new time.Duration flag. // Input format is described in time.ParseDuration(). // Example values: 1h, 1h50m, 32s // Specify the flag multiple times to fill the slice. func (sc *Subcommand) DurationSlice(assignmentVar *[]time.Duration, shortName string, longName string, description string) { sc.add(assignmentVar, shortName, longName, description) } // Float32 adds a new float32 flag. func (sc *Subcommand) Float32(assignmentVar *float32, shortName string, longName string, description string) { sc.add(assignmentVar, shortName, longName, description) } // Float32Slice adds a new float32 flag. // Specify the flag multiple times to fill the slice. func (sc *Subcommand) Float32Slice(assignmentVar *[]float32, shortName string, longName string, description string) { sc.add(assignmentVar, shortName, longName, description) } // Float64 adds a new float64 flag. func (sc *Subcommand) Float64(assignmentVar *float64, shortName string, longName string, description string) { sc.add(assignmentVar, shortName, longName, description) } // Float64Slice adds a new float64 flag. // Specify the flag multiple times to fill the slice. func (sc *Subcommand) Float64Slice(assignmentVar *[]float64, shortName string, longName string, description string) { sc.add(assignmentVar, shortName, longName, description) } // Int adds a new int flag func (sc *Subcommand) Int(assignmentVar *int, shortName string, longName string, description string) { sc.add(assignmentVar, shortName, longName, description) } // IntSlice adds a new int slice flag. // Specify the flag multiple times to fill the slice. func (sc *Subcommand) IntSlice(assignmentVar *[]int, shortName string, longName string, description string) { sc.add(assignmentVar, shortName, longName, description) } // UInt adds a new uint flag func (sc *Subcommand) UInt(assignmentVar *uint, shortName string, longName string, description string) { sc.add(assignmentVar, shortName, longName, description) } // UIntSlice adds a new uint slice flag. // Specify the flag multiple times to fill the slice. func (sc *Subcommand) UIntSlice(assignmentVar *[]uint, shortName string, longName string, description string) { sc.add(assignmentVar, shortName, longName, description) } // UInt64 adds a new uint64 flag func (sc *Subcommand) UInt64(assignmentVar *uint64, shortName string, longName string, description string) { sc.add(assignmentVar, shortName, longName, description) } // UInt64Slice adds a new uint64 slice flag. // Specify the flag multiple times to fill the slice. func (sc *Subcommand) UInt64Slice(assignmentVar *[]uint64, shortName string, longName string, description string) { sc.add(assignmentVar, shortName, longName, description) } // UInt32 adds a new uint32 flag func (sc *Subcommand) UInt32(assignmentVar *uint32, shortName string, longName string, description string) { sc.add(assignmentVar, shortName, longName, description) } // UInt32Slice adds a new uint32 slice flag. // Specify the flag multiple times to fill the slice. func (sc *Subcommand) UInt32Slice(assignmentVar *[]uint32, shortName string, longName string, description string) { sc.add(assignmentVar, shortName, longName, description) } // UInt16 adds a new uint16 flag func (sc *Subcommand) UInt16(assignmentVar *uint16, shortName string, longName string, description string) { sc.add(assignmentVar, shortName, longName, description) } // UInt16Slice adds a new uint16 slice flag. // Specify the flag multiple times to fill the slice. func (sc *Subcommand) UInt16Slice(assignmentVar *[]uint16, shortName string, longName string, description string) { sc.add(assignmentVar, shortName, longName, description) } // UInt8 adds a new uint8 flag func (sc *Subcommand) UInt8(assignmentVar *uint8, shortName string, longName string, description string) { sc.add(assignmentVar, shortName, longName, description) } // UInt8Slice adds a new uint8 slice flag. // Specify the flag multiple times to fill the slice. func (sc *Subcommand) UInt8Slice(assignmentVar *[]uint8, shortName string, longName string, description string) { sc.add(assignmentVar, shortName, longName, description) } // Int64 adds a new int64 flag. func (sc *Subcommand) Int64(assignmentVar *int64, shortName string, longName string, description string) { sc.add(assignmentVar, shortName, longName, description) } // Int64Slice adds a new int64 slice flag. // Specify the flag multiple times to fill the slice. func (sc *Subcommand) Int64Slice(assignmentVar *[]int64, shortName string, longName string, description string) { sc.add(assignmentVar, shortName, longName, description) } // Int32 adds a new int32 flag func (sc *Subcommand) Int32(assignmentVar *int32, shortName string, longName string, description string) { sc.add(assignmentVar, shortName, longName, description) } // Int32Slice adds a new int32 slice flag. // Specify the flag multiple times to fill the slice. func (sc *Subcommand) Int32Slice(assignmentVar *[]int32, shortName string, longName string, description string) { sc.add(assignmentVar, shortName, longName, description) } // Int16 adds a new int16 flag func (sc *Subcommand) Int16(assignmentVar *int16, shortName string, longName string, description string) { sc.add(assignmentVar, shortName, longName, description) } // Int16Slice adds a new int16 slice flag. // Specify the flag multiple times to fill the slice. func (sc *Subcommand) Int16Slice(assignmentVar *[]int16, shortName string, longName string, description string) { sc.add(assignmentVar, shortName, longName, description) } // Int8 adds a new int8 flag func (sc *Subcommand) Int8(assignmentVar *int8, shortName string, longName string, description string) { sc.add(assignmentVar, shortName, longName, description) } // Int8Slice adds a new int8 slice flag. // Specify the flag multiple times to fill the slice. func (sc *Subcommand) Int8Slice(assignmentVar *[]int8, shortName string, longName string, description string) { sc.add(assignmentVar, shortName, longName, description) } // IP adds a new net.IP flag. func (sc *Subcommand) IP(assignmentVar *net.IP, shortName string, longName string, description string) { sc.add(assignmentVar, shortName, longName, description) } // IPSlice adds a new int8 slice flag. // Specify the flag multiple times to fill the slice. func (sc *Subcommand) IPSlice(assignmentVar *[]net.IP, shortName string, longName string, description string) { sc.add(assignmentVar, shortName, longName, description) } // HardwareAddr adds a new net.HardwareAddr flag. func (sc *Subcommand) HardwareAddr(assignmentVar *net.HardwareAddr, shortName string, longName string, description string) { sc.add(assignmentVar, shortName, longName, description) } // HardwareAddrSlice adds a new net.HardwareAddr slice flag. // Specify the flag multiple times to fill the slice. func (sc *Subcommand) HardwareAddrSlice(assignmentVar *[]net.HardwareAddr, shortName string, longName string, description string) { sc.add(assignmentVar, shortName, longName, description) } // IPMask adds a new net.IPMask flag. IPv4 Only. func (sc *Subcommand) IPMask(assignmentVar *net.IPMask, shortName string, longName string, description string) { sc.add(assignmentVar, shortName, longName, description) } // IPMaskSlice adds a new net.HardwareAddr slice flag. IPv4 only. // Specify the flag multiple times to fill the slice. func (sc *Subcommand) IPMaskSlice(assignmentVar *[]net.IPMask, shortName string, longName string, description string) { sc.add(assignmentVar, shortName, longName, description) } // AddPositionalValue adds a positional value to the subcommand. the // relativePosition starts at 1 and is relative to the subcommand it belongs to func (sc *Subcommand) AddPositionalValue(assignmentVar *string, name string, relativePosition int, required bool, description string) { // ensure no other positionals are at this depth for _, other := range sc.PositionalFlags { if relativePosition == other.Position { log.Panicln("Unable to add positional value because one already exists at position: " + strconv.Itoa(relativePosition)) } } // ensure no subcommands at this depth for _, other := range sc.Subcommands { if relativePosition == other.Position { log.Panicln("Unable to add positional value a subcommand already exists at position: " + strconv.Itoa(relativePosition)) } } newPositionalValue := PositionalValue{ Name: name, Position: relativePosition, AssignmentVar: assignmentVar, Required: required, Description: description, defaultValue: *assignmentVar, } sc.PositionalFlags = append(sc.PositionalFlags, &newPositionalValue) } // SetValueForKey sets the value for the specified key. If setting a bool // value, then send "true" or "false" as strings. The returned bool indicates // that a value was set. func (sc *Subcommand) SetValueForKey(key string, value string) (bool, error) { // debugPrint("Looking to set key", key, "to value", value) // check for and assign flags that match the key for _, f := range sc.Flags { // debugPrint("Evaluating string flag", f.ShortName, "==", key, "||", f.LongName, "==", key) if f.ShortName == key || f.LongName == key { // debugPrint("Setting string value for", key, "to", value) f.identifyAndAssignValue(value) return true, nil } } // debugPrint(sc.Name, "was unable to find a key named", key, "to set to value", value) return false, nil } // ensureNoConflictWithBuiltinHelp ensures that the flags on this subcommand do // not conflict with the builtin help flags (-h or --help). Exits the program // if a conflict is found. func (sc *Subcommand) ensureNoConflictWithBuiltinHelp() { for _, f := range sc.Flags { if f.LongName == helpFlagLongName { sc.exitBecauseOfHelpFlagConflict(f.LongName) } if f.LongName == helpFlagShortName { sc.exitBecauseOfHelpFlagConflict(f.LongName) } if f.ShortName == helpFlagLongName { sc.exitBecauseOfHelpFlagConflict(f.ShortName) } if f.ShortName == helpFlagShortName { sc.exitBecauseOfHelpFlagConflict(f.ShortName) } } } // ensureNoConflictWithBuiltinVersion ensures that the flags on this subcommand do // not conflict with the builtin version flag (--version). Exits the program // if a conflict is found. func (sc *Subcommand) ensureNoConflictWithBuiltinVersion() { for _, f := range sc.Flags { if f.LongName == versionFlagLongName { sc.exitBecauseOfVersionFlagConflict(f.LongName) } if f.ShortName == versionFlagLongName { sc.exitBecauseOfVersionFlagConflict(f.ShortName) } } } // exitBecauseOfVersionFlagConflict exits the program with a message about how to prevent // flags being defined from conflicting with the builtin flags. func (sc *Subcommand) exitBecauseOfVersionFlagConflict(flagName string) { fmt.Println(`Flag with name '` + flagName + `' conflicts with the internal --version flag in flaggy. You must either change the flag's name, or disable flaggy's internal version flag with 'flaggy.DefaultParser.ShowVersionWithVersionFlag = false'. If you are using a custom parser, you must instead set '.ShowVersionWithVersionFlag = false' on it.`) exitOrPanic(1) } // exitBecauseOfHelpFlagConflict exits the program with a message about how to prevent // flags being defined from conflicting with the builtin flags. func (sc *Subcommand) exitBecauseOfHelpFlagConflict(flagName string) { fmt.Println(`Flag with name '` + flagName + `' conflicts with the internal --help or -h flag in flaggy. You must either change the flag's name, or disable flaggy's internal help flag with 'flaggy.DefaultParser.ShowHelpWithHFlag = false'. If you are using a custom parser, you must instead set '.ShowHelpWithHFlag = false' on it.`) exitOrPanic(1) }
go
MIT
f4fc3669ca8eb67aa350a76503397192bf26f057
2026-01-07T08:35:43.570558Z
false
jesseduffield/lazydocker
https://github.com/jesseduffield/lazydocker/blob/f4fc3669ca8eb67aa350a76503397192bf26f057/vendor/github.com/integrii/flaggy/parsedValue.go
vendor/github.com/integrii/flaggy/parsedValue.go
package flaggy // parsedValue represents a flag or subcommand that was parsed. Primairily used // to account for all parsed values in order to determine if unknown values were // passed to the root parser after all subcommands have been parsed. type parsedValue struct { Key string Value string IsPositional bool // indicates that this value was positional and not a key/value } // newParsedValue creates and returns a new parsedValue struct with the // supplied values set func newParsedValue(key string, value string, isPositional bool) parsedValue { if len(key) == 0 && len(value) == 0 { panic("cant add parsed value with no key or value") } return parsedValue{ Key: key, Value: value, IsPositional: isPositional, } }
go
MIT
f4fc3669ca8eb67aa350a76503397192bf26f057
2026-01-07T08:35:43.570558Z
false
jesseduffield/lazydocker
https://github.com/jesseduffield/lazydocker/blob/f4fc3669ca8eb67aa350a76503397192bf26f057/vendor/github.com/integrii/flaggy/argumentParser.go
vendor/github.com/integrii/flaggy/argumentParser.go
package flaggy // setValueForParsers sets the value for a specified key in the // specified parsers (which normally include a Parser and Subcommand). // The return values represent the key being set, and any errors // returned when setting the key, such as failures to convert the string // into the appropriate flag value. We stop assigning values as soon // as we find a any parser that accepts it. func setValueForParsers(key string, value string, parsers ...ArgumentParser) (bool, error) { for _, p := range parsers { valueWasSet, err := p.SetValueForKey(key, value) if err != nil { return valueWasSet, err } if valueWasSet { return true, nil } } return false, nil } // ArgumentParser represents a parser or subcommand type ArgumentParser interface { SetValueForKey(key string, value string) (bool, error) }
go
MIT
f4fc3669ca8eb67aa350a76503397192bf26f057
2026-01-07T08:35:43.570558Z
false
jesseduffield/lazydocker
https://github.com/jesseduffield/lazydocker/blob/f4fc3669ca8eb67aa350a76503397192bf26f057/vendor/github.com/integrii/flaggy/helpValues.go
vendor/github.com/integrii/flaggy/helpValues.go
package flaggy import ( "log" "reflect" "strings" "unicode/utf8" ) // Help represents the values needed to render a Help page type Help struct { Subcommands []HelpSubcommand Positionals []HelpPositional Flags []HelpFlag UsageString string CommandName string PrependMessage string AppendMessage string Message string Description string } // HelpSubcommand is used to template subcommand Help output type HelpSubcommand struct { ShortName string LongName string Description string Position int Spacer string } // HelpPositional is used to template positional Help output type HelpPositional struct { Name string Description string Required bool Position int DefaultValue string Spacer string } // HelpFlag is used to template string flag Help output type HelpFlag struct { ShortName string LongName string Description string DefaultValue string Spacer string } // ExtractValues extracts Help template values from a subcommand and its parent // parser. The parser is required in order to detect default flag settings // for help and version output. func (h *Help) ExtractValues(p *Parser, message string) { // accept message string for output h.Message = message // extract Help values from the current subcommand in context // prependMessage string h.PrependMessage = p.subcommandContext.AdditionalHelpPrepend // appendMessage string h.AppendMessage = p.subcommandContext.AdditionalHelpAppend // command name h.CommandName = p.subcommandContext.Name // description h.Description = p.subcommandContext.Description maxLength := getLongestNameLength(p.subcommandContext.Subcommands, 0) // subcommands []HelpSubcommand for _, cmd := range p.subcommandContext.Subcommands { if cmd.Hidden { continue } newHelpSubcommand := HelpSubcommand{ ShortName: cmd.ShortName, LongName: cmd.Name, Description: cmd.Description, Position: cmd.Position, Spacer: makeSpacer(cmd.Name, maxLength), } h.Subcommands = append(h.Subcommands, newHelpSubcommand) } maxLength = getLongestNameLength(p.subcommandContext.PositionalFlags, 0) // parse positional flags into help output structs for _, pos := range p.subcommandContext.PositionalFlags { if pos.Hidden { continue } newHelpPositional := HelpPositional{ Name: pos.Name, Position: pos.Position, Description: pos.Description, Required: pos.Required, DefaultValue: pos.defaultValue, Spacer: makeSpacer(pos.Name, maxLength), } h.Positionals = append(h.Positionals, newHelpPositional) } maxLength = len(versionFlagLongName) if len(helpFlagLongName) > maxLength { maxLength = len(helpFlagLongName) } maxLength = getLongestNameLength(p.subcommandContext.Flags, maxLength) maxLength = getLongestNameLength(p.Flags, maxLength) // if the built-in version flag is enabled, then add it as a help flag if p.ShowVersionWithVersionFlag { defaultVersionFlag := HelpFlag{ ShortName: "", LongName: versionFlagLongName, Description: "Displays the program version string.", DefaultValue: "", Spacer: makeSpacer(versionFlagLongName, maxLength), } h.Flags = append(h.Flags, defaultVersionFlag) } // if the built-in help flag exists, then add it as a help flag if p.ShowHelpWithHFlag { defaultHelpFlag := HelpFlag{ ShortName: helpFlagShortName, LongName: helpFlagLongName, Description: "Displays help with available flag, subcommand, and positional value parameters.", DefaultValue: "", Spacer: makeSpacer(helpFlagLongName, maxLength), } h.Flags = append(h.Flags, defaultHelpFlag) } // go through every flag in the subcommand and add it to help output h.parseFlagsToHelpFlags(p.subcommandContext.Flags, maxLength) // go through every flag in the parent parser and add it to help output h.parseFlagsToHelpFlags(p.Flags, maxLength) // formulate the usage string // first, we capture all the command and positional names by position commandsByPosition := make(map[int]string) for _, pos := range p.subcommandContext.PositionalFlags { if pos.Hidden { continue } if len(commandsByPosition[pos.Position]) > 0 { commandsByPosition[pos.Position] = commandsByPosition[pos.Position] + "|" + pos.Name } else { commandsByPosition[pos.Position] = pos.Name } } for _, cmd := range p.subcommandContext.Subcommands { if cmd.Hidden { continue } if len(commandsByPosition[cmd.Position]) > 0 { commandsByPosition[cmd.Position] = commandsByPosition[cmd.Position] + "|" + cmd.Name } else { commandsByPosition[cmd.Position] = cmd.Name } } // find the highest position count in the map var highestPosition int for i := range commandsByPosition { if i > highestPosition { highestPosition = i } } // only have a usage string if there are positional items var usageString string if highestPosition > 0 { // find each positional value and make our final string usageString = p.subcommandContext.Name for i := 1; i <= highestPosition; i++ { if len(commandsByPosition[i]) > 0 { usageString = usageString + " [" + commandsByPosition[i] + "]" } else { // dont keep listing after the first position without any properties // it will be impossible to reach anything beyond here anyway break } } } h.UsageString = usageString } // parseFlagsToHelpFlags parses the specified slice of flags into // help flags on the the calling help command func (h *Help) parseFlagsToHelpFlags(flags []*Flag, maxLength int) { for _, f := range flags { if f.Hidden { continue } // parse help values out if the flag hasn't been parsed yet if !f.parsed { f.parsed = true // parse the default value as a string and remember it for help output f.defaultValue, _ = f.returnAssignmentVarValueAsString() } // determine the default value based on the assignment variable defaultValue := f.defaultValue // dont show nils if defaultValue == "<nil>" { defaultValue = "" } // for bools, dont show a default of false _, isBool := f.AssignmentVar.(*bool) if isBool { b := f.AssignmentVar.(*bool) if *b == false { defaultValue = "" } } newHelpFlag := HelpFlag{ ShortName: f.ShortName, LongName: f.LongName, Description: f.Description, DefaultValue: defaultValue, Spacer: makeSpacer(f.LongName, maxLength), } h.AddFlagToHelp(newHelpFlag) } } // AddFlagToHelp adds a flag to help output if it does not exist func (h *Help) AddFlagToHelp(f HelpFlag) { for _, existingFlag := range h.Flags { if len(existingFlag.ShortName) > 0 && existingFlag.ShortName == f.ShortName { return } if len(existingFlag.LongName) > 0 && existingFlag.LongName == f.LongName { return } } h.Flags = append(h.Flags, f) } // getLongestNameLength takes a slice of any supported flag and returns the length of the longest of their names func getLongestNameLength(slice interface{}, min int) int { var maxLength = min s := reflect.ValueOf(slice) if s.Kind() != reflect.Slice { log.Panicf("Paremeter given to getLongestNameLength() is of type %s. Expected slice", s.Kind()) } for i := 0; i < s.Len(); i++ { option := s.Index(i).Interface() var name string switch t := option.(type) { case *Subcommand: name = t.Name case *Flag: name = t.LongName case *PositionalValue: name = t.Name default: log.Panicf("Unexpected type %T found in slice passed to getLongestNameLength(). Possible types: *Subcommand, *Flag, *PositionalValue", t) } length := len(name) if length > maxLength { maxLength = length } } return maxLength } // makeSpacer creates a string of whitespaces, with a length of the given // maxLength minus the length of the given name func makeSpacer(name string, maxLength int) string { length := maxLength - utf8.RuneCountInString(name) if length < 0 { length = 0 } return strings.Repeat(" ", length) }
go
MIT
f4fc3669ca8eb67aa350a76503397192bf26f057
2026-01-07T08:35:43.570558Z
false
jesseduffield/lazydocker
https://github.com/jesseduffield/lazydocker/blob/f4fc3669ca8eb67aa350a76503397192bf26f057/vendor/github.com/integrii/flaggy/help.go
vendor/github.com/integrii/flaggy/help.go
package flaggy // defaultHelpTemplate is the help template used by default // {{if (or (or (gt (len .StringFlags) 0) (gt (len .IntFlags) 0)) (gt (len .BoolFlags) 0))}} // {{if (or (gt (len .StringFlags) 0) (gt (len .BoolFlags) 0))}} const defaultHelpTemplate = `{{.CommandName}}{{if .Description}} - {{.Description}}{{end}}{{if .PrependMessage}} {{.PrependMessage}}{{end}} {{if .UsageString}} Usage: {{.UsageString}}{{end}}{{if .Positionals}} Positional Variables: {{range .Positionals}} {{.Name}} {{.Spacer}}{{if .Description}} {{.Description}}{{end}}{{if .DefaultValue}} (default: {{.DefaultValue}}){{else}}{{if .Required}} (Required){{end}}{{end}}{{end}}{{end}}{{if .Subcommands}} Subcommands: {{range .Subcommands}} {{.LongName}}{{if .ShortName}} ({{.ShortName}}){{end}}{{if .Position}}{{if gt .Position 1}} (position {{.Position}}){{end}}{{end}}{{if .Description}} {{.Spacer}}{{.Description}}{{end}}{{end}} {{end}}{{if (gt (len .Flags) 0)}} Flags: {{if .Flags}}{{range .Flags}} {{if .ShortName}}-{{.ShortName}} {{else}} {{end}}{{if .LongName}}--{{.LongName}}{{end}}{{if .Description}} {{.Spacer}}{{.Description}}{{if .DefaultValue}} (default: {{.DefaultValue}}){{end}}{{end}}{{end}}{{end}} {{end}}{{if .AppendMessage}}{{.AppendMessage}} {{end}}{{if .Message}} {{.Message}}{{end}} `
go
MIT
f4fc3669ca8eb67aa350a76503397192bf26f057
2026-01-07T08:35:43.570558Z
false
jesseduffield/lazydocker
https://github.com/jesseduffield/lazydocker/blob/f4fc3669ca8eb67aa350a76503397192bf26f057/vendor/github.com/integrii/flaggy/main.go
vendor/github.com/integrii/flaggy/main.go
// Package flaggy is a input flag parsing package that supports recursive // subcommands, positional values, and any-position flags without // unnecessary complexeties. // // For a getting started tutorial and full feature list, check out the // readme at https://github.com/integrii/flaggy. package flaggy // import "github.com/integrii/flaggy" import ( "fmt" "log" "net" "os" "strconv" "strings" "time" ) // strings used for builtin help and version flags both short and long const versionFlagLongName = "version" const helpFlagLongName = "help" const helpFlagShortName = "h" // defaultVersion is applied to parsers when they are created const defaultVersion = "0.0.0" // DebugMode indicates that debug output should be enabled var DebugMode bool // DefaultHelpTemplate is the help template that will be used // for newly created subcommands and commands var DefaultHelpTemplate = defaultHelpTemplate // DefaultParser is the default parser that is used with the package-level public // functions var DefaultParser *Parser // TrailingArguments holds trailing arguments in the main parser after parsing // has been run. var TrailingArguments []string func init() { // set the default help template // allow usage like flaggy.StringVar by enabling a default Parser ResetParser() } // ResetParser resets the default parser to a fresh instance. Uses the // name of the binary executing as the program name by default. func ResetParser() { if len(os.Args) > 0 { chunks := strings.Split(os.Args[0], "/") DefaultParser = NewParser(chunks[len(chunks)-1]) } else { DefaultParser = NewParser("default") } } // Parse parses flags as requested in the default package parser func Parse() { err := DefaultParser.Parse() TrailingArguments = DefaultParser.TrailingArguments if err != nil { log.Panicln("Error from argument parser:", err) } } // ParseArgs parses the passed args as if they were the arguments to the // running binary. Targets the default main parser for the package. func ParseArgs(args []string) { err := DefaultParser.ParseArgs(args) TrailingArguments = DefaultParser.TrailingArguments if err != nil { log.Panicln("Error from argument parser:", err) } } // String adds a new string flag func String(assignmentVar *string, shortName string, longName string, description string) { DefaultParser.add(assignmentVar, shortName, longName, description) } // StringSlice adds a new slice of strings flag // Specify the flag multiple times to fill the slice func StringSlice(assignmentVar *[]string, shortName string, longName string, description string) { DefaultParser.add(assignmentVar, shortName, longName, description) } // Bool adds a new bool flag func Bool(assignmentVar *bool, shortName string, longName string, description string) { DefaultParser.add(assignmentVar, shortName, longName, description) } // BoolSlice adds a new slice of bools flag // Specify the flag multiple times to fill the slice func BoolSlice(assignmentVar *[]bool, shortName string, longName string, description string) { DefaultParser.add(assignmentVar, shortName, longName, description) } // ByteSlice adds a new slice of bytes flag // Specify the flag multiple times to fill the slice. Takes hex as input. func ByteSlice(assignmentVar *[]byte, shortName string, longName string, description string) { DefaultParser.add(assignmentVar, shortName, longName, description) } // Duration adds a new time.Duration flag. // Input format is described in time.ParseDuration(). // Example values: 1h, 1h50m, 32s func Duration(assignmentVar *time.Duration, shortName string, longName string, description string) { DefaultParser.add(assignmentVar, shortName, longName, description) } // DurationSlice adds a new time.Duration flag. // Input format is described in time.ParseDuration(). // Example values: 1h, 1h50m, 32s // Specify the flag multiple times to fill the slice. func DurationSlice(assignmentVar *[]time.Duration, shortName string, longName string, description string) { DefaultParser.add(assignmentVar, shortName, longName, description) } // Float32 adds a new float32 flag. func Float32(assignmentVar *float32, shortName string, longName string, description string) { DefaultParser.add(assignmentVar, shortName, longName, description) } // Float32Slice adds a new float32 flag. // Specify the flag multiple times to fill the slice. func Float32Slice(assignmentVar *[]float32, shortName string, longName string, description string) { DefaultParser.add(assignmentVar, shortName, longName, description) } // Float64 adds a new float64 flag. func Float64(assignmentVar *float64, shortName string, longName string, description string) { DefaultParser.add(assignmentVar, shortName, longName, description) } // Float64Slice adds a new float64 flag. // Specify the flag multiple times to fill the slice. func Float64Slice(assignmentVar *[]float64, shortName string, longName string, description string) { DefaultParser.add(assignmentVar, shortName, longName, description) } // Int adds a new int flag func Int(assignmentVar *int, shortName string, longName string, description string) { DefaultParser.add(assignmentVar, shortName, longName, description) } // IntSlice adds a new int slice flag. // Specify the flag multiple times to fill the slice. func IntSlice(assignmentVar *[]int, shortName string, longName string, description string) { DefaultParser.add(assignmentVar, shortName, longName, description) } // UInt adds a new uint flag func UInt(assignmentVar *uint, shortName string, longName string, description string) { DefaultParser.add(assignmentVar, shortName, longName, description) } // UIntSlice adds a new uint slice flag. // Specify the flag multiple times to fill the slice. func UIntSlice(assignmentVar *[]uint, shortName string, longName string, description string) { DefaultParser.add(assignmentVar, shortName, longName, description) } // UInt64 adds a new uint64 flag func UInt64(assignmentVar *uint64, shortName string, longName string, description string) { DefaultParser.add(assignmentVar, shortName, longName, description) } // UInt64Slice adds a new uint64 slice flag. // Specify the flag multiple times to fill the slice. func UInt64Slice(assignmentVar *[]uint64, shortName string, longName string, description string) { DefaultParser.add(assignmentVar, shortName, longName, description) } // UInt32 adds a new uint32 flag func UInt32(assignmentVar *uint32, shortName string, longName string, description string) { DefaultParser.add(assignmentVar, shortName, longName, description) } // UInt32Slice adds a new uint32 slice flag. // Specify the flag multiple times to fill the slice. func UInt32Slice(assignmentVar *[]uint32, shortName string, longName string, description string) { DefaultParser.add(assignmentVar, shortName, longName, description) } // UInt16 adds a new uint16 flag func UInt16(assignmentVar *uint16, shortName string, longName string, description string) { DefaultParser.add(assignmentVar, shortName, longName, description) } // UInt16Slice adds a new uint16 slice flag. // Specify the flag multiple times to fill the slice. func UInt16Slice(assignmentVar *[]uint16, shortName string, longName string, description string) { DefaultParser.add(assignmentVar, shortName, longName, description) } // UInt8 adds a new uint8 flag func UInt8(assignmentVar *uint8, shortName string, longName string, description string) { DefaultParser.add(assignmentVar, shortName, longName, description) } // UInt8Slice adds a new uint8 slice flag. // Specify the flag multiple times to fill the slice. func UInt8Slice(assignmentVar *[]uint8, shortName string, longName string, description string) { DefaultParser.add(assignmentVar, shortName, longName, description) } // Int64 adds a new int64 flag func Int64(assignmentVar *int64, shortName string, longName string, description string) { DefaultParser.add(assignmentVar, shortName, longName, description) } // Int64Slice adds a new int64 slice flag. // Specify the flag multiple times to fill the slice. func Int64Slice(assignmentVar *[]int64, shortName string, longName string, description string) { DefaultParser.add(assignmentVar, shortName, longName, description) } // Int32 adds a new int32 flag func Int32(assignmentVar *int32, shortName string, longName string, description string) { DefaultParser.add(assignmentVar, shortName, longName, description) } // Int32Slice adds a new int32 slice flag. // Specify the flag multiple times to fill the slice. func Int32Slice(assignmentVar *[]int32, shortName string, longName string, description string) { DefaultParser.add(assignmentVar, shortName, longName, description) } // Int16 adds a new int16 flag func Int16(assignmentVar *int16, shortName string, longName string, description string) { DefaultParser.add(assignmentVar, shortName, longName, description) } // Int16Slice adds a new int16 slice flag. // Specify the flag multiple times to fill the slice. func Int16Slice(assignmentVar *[]int16, shortName string, longName string, description string) { DefaultParser.add(assignmentVar, shortName, longName, description) } // Int8 adds a new int8 flag func Int8(assignmentVar *int8, shortName string, longName string, description string) { DefaultParser.add(assignmentVar, shortName, longName, description) } // Int8Slice adds a new int8 slice flag. // Specify the flag multiple times to fill the slice. func Int8Slice(assignmentVar *[]int8, shortName string, longName string, description string) { DefaultParser.add(assignmentVar, shortName, longName, description) } // IP adds a new net.IP flag. func IP(assignmentVar *net.IP, shortName string, longName string, description string) { DefaultParser.add(assignmentVar, shortName, longName, description) } // IPSlice adds a new int8 slice flag. // Specify the flag multiple times to fill the slice. func IPSlice(assignmentVar *[]net.IP, shortName string, longName string, description string) { DefaultParser.add(assignmentVar, shortName, longName, description) } // HardwareAddr adds a new net.HardwareAddr flag. func HardwareAddr(assignmentVar *net.HardwareAddr, shortName string, longName string, description string) { DefaultParser.add(assignmentVar, shortName, longName, description) } // HardwareAddrSlice adds a new net.HardwareAddr slice flag. // Specify the flag multiple times to fill the slice. func HardwareAddrSlice(assignmentVar *[]net.HardwareAddr, shortName string, longName string, description string) { DefaultParser.add(assignmentVar, shortName, longName, description) } // IPMask adds a new net.IPMask flag. IPv4 Only. func IPMask(assignmentVar *net.IPMask, shortName string, longName string, description string) { DefaultParser.add(assignmentVar, shortName, longName, description) } // IPMaskSlice adds a new net.HardwareAddr slice flag. IPv4 only. // Specify the flag multiple times to fill the slice. func IPMaskSlice(assignmentVar *[]net.IPMask, shortName string, longName string, description string) { DefaultParser.add(assignmentVar, shortName, longName, description) } // AttachSubcommand adds a subcommand for parsing func AttachSubcommand(subcommand *Subcommand, relativePosition int) { DefaultParser.AttachSubcommand(subcommand, relativePosition) } // ShowHelp shows parser help func ShowHelp(message string) { DefaultParser.ShowHelpWithMessage(message) } // SetDescription sets the description of the default package command parser func SetDescription(description string) { DefaultParser.Description = description } // SetVersion sets the version of the default package command parser func SetVersion(version string) { DefaultParser.Version = version } // SetName sets the name of the default package command parser func SetName(name string) { DefaultParser.Name = name } // ShowHelpAndExit shows parser help and exits with status code 2 func ShowHelpAndExit(message string) { ShowHelp(message) exitOrPanic(2) } // PanicInsteadOfExit is used when running tests var PanicInsteadOfExit bool // exitOrPanic panics instead of calling os.Exit so that tests can catch // more failures func exitOrPanic(code int) { if PanicInsteadOfExit { panic("Panic instead of exit with code: " + strconv.Itoa(code)) } os.Exit(code) } // ShowHelpOnUnexpectedEnable enables the ShowHelpOnUnexpected behavior on the // default parser. This causes unknown inputs to error out. func ShowHelpOnUnexpectedEnable() { DefaultParser.ShowHelpOnUnexpected = true } // ShowHelpOnUnexpectedDisable disables the ShowHelpOnUnexpected behavior on the // default parser. This causes unknown inputs to error out. func ShowHelpOnUnexpectedDisable() { DefaultParser.ShowHelpOnUnexpected = false } // AddPositionalValue adds a positional value to the main parser at the global // context func AddPositionalValue(assignmentVar *string, name string, relativePosition int, required bool, description string) { DefaultParser.AddPositionalValue(assignmentVar, name, relativePosition, required, description) } // debugPrint prints if debugging is enabled func debugPrint(i ...interface{}) { if DebugMode { fmt.Println(i...) } }
go
MIT
f4fc3669ca8eb67aa350a76503397192bf26f057
2026-01-07T08:35:43.570558Z
false
jesseduffield/lazydocker
https://github.com/jesseduffield/lazydocker/blob/f4fc3669ca8eb67aa350a76503397192bf26f057/vendor/github.com/mattn/go-colorable/colorable_windows.go
vendor/github.com/mattn/go-colorable/colorable_windows.go
// +build windows // +build !appengine package colorable import ( "bytes" "io" "math" "os" "strconv" "strings" "sync" "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) commonLvbUnderscore = 0x8000 cENABLE_VIRTUAL_TERMINAL_PROCESSING = 0x4 ) const ( genericRead = 0x80000000 genericWrite = 0x40000000 ) const ( consoleTextmodeBuffer = 0x1 ) 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") procGetConsoleMode = kernel32.NewProc("GetConsoleMode") procSetConsoleMode = kernel32.NewProc("SetConsoleMode") procCreateConsoleScreenBuffer = kernel32.NewProc("CreateConsoleScreenBuffer") ) // Writer provides colorable Writer to the console type Writer struct { out io.Writer handle syscall.Handle althandle syscall.Handle oldattr word oldpos coord rest bytes.Buffer mutex sync.Mutex } // NewColorable returns new instance of Writer which handles 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 mode uint32 if r, _, _ := procGetConsoleMode.Call(file.Fd(), uintptr(unsafe.Pointer(&mode))); r != 0 && mode&cENABLE_VIRTUAL_TERMINAL_PROCESSING != 0 { return file } 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 returns new instance of Writer which handles escape sequence for stdout. func NewColorableStdout() io.Writer { return NewColorable(os.Stdout) } // NewColorableStderr returns new instance of Writer which handles 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 } // returns Atoi(s) unless s == "" in which case it returns def func atoiWithDefault(s string, def int) (int, error) { if s == "" { return def, nil } return strconv.Atoi(s) } // Write writes data on console func (w *Writer) Write(data []byte) (n int, err error) { w.mutex.Lock() defer w.mutex.Unlock() var csbi consoleScreenBufferInfo procGetConsoleScreenBufferInfo.Call(uintptr(w.handle), uintptr(unsafe.Pointer(&csbi))) handle := w.handle var er *bytes.Reader if w.rest.Len() > 0 { var rest bytes.Buffer w.rest.WriteTo(&rest) w.rest.Reset() rest.Write(data) er = bytes.NewReader(rest.Bytes()) } else { 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 } switch c2 { case '>': continue case ']': w.rest.WriteByte(c1) w.rest.WriteByte(c2) er.WriteTo(&w.rest) if bytes.IndexByte(w.rest.Bytes(), 0x07) == -1 { break loop } er = bytes.NewReader(w.rest.Bytes()[2:]) err := doTitleSequence(er) if err != nil { break loop } w.rest.Reset() continue // https://github.com/mattn/go-colorable/issues/27 case '7': procGetConsoleScreenBufferInfo.Call(uintptr(handle), uintptr(unsafe.Pointer(&csbi))) w.oldpos = csbi.cursorPosition continue case '8': procSetConsoleCursorPosition.Call(uintptr(handle), *(*uintptr)(unsafe.Pointer(&w.oldpos))) continue case 0x5b: // execute part after switch default: continue } w.rest.WriteByte(c1) w.rest.WriteByte(c2) er.WriteTo(&w.rest) var buf bytes.Buffer var m byte for i, c := range w.rest.Bytes()[2:] { if ('a' <= c && c <= 'z') || ('A' <= c && c <= 'Z') || c == '@' { m = c er = bytes.NewReader(w.rest.Bytes()[2+i+1:]) w.rest.Reset() break } buf.Write([]byte(string(c))) } if m == 0 { break loop } switch m { case 'A': n, err = atoiWithDefault(buf.String(), 1) if err != nil { continue } procGetConsoleScreenBufferInfo.Call(uintptr(handle), uintptr(unsafe.Pointer(&csbi))) csbi.cursorPosition.y -= short(n) procSetConsoleCursorPosition.Call(uintptr(handle), *(*uintptr)(unsafe.Pointer(&csbi.cursorPosition))) case 'B': n, err = atoiWithDefault(buf.String(), 1) if err != nil { continue } procGetConsoleScreenBufferInfo.Call(uintptr(handle), uintptr(unsafe.Pointer(&csbi))) csbi.cursorPosition.y += short(n) procSetConsoleCursorPosition.Call(uintptr(handle), *(*uintptr)(unsafe.Pointer(&csbi.cursorPosition))) case 'C': n, err = atoiWithDefault(buf.String(), 1) if err != nil { continue } procGetConsoleScreenBufferInfo.Call(uintptr(handle), uintptr(unsafe.Pointer(&csbi))) csbi.cursorPosition.x += short(n) procSetConsoleCursorPosition.Call(uintptr(handle), *(*uintptr)(unsafe.Pointer(&csbi.cursorPosition))) case 'D': n, err = atoiWithDefault(buf.String(), 1) if err != nil { continue } procGetConsoleScreenBufferInfo.Call(uintptr(handle), uintptr(unsafe.Pointer(&csbi))) csbi.cursorPosition.x -= short(n) if csbi.cursorPosition.x < 0 { csbi.cursorPosition.x = 0 } procSetConsoleCursorPosition.Call(uintptr(handle), *(*uintptr)(unsafe.Pointer(&csbi.cursorPosition))) case 'E': n, err = strconv.Atoi(buf.String()) if err != nil { continue } procGetConsoleScreenBufferInfo.Call(uintptr(handle), uintptr(unsafe.Pointer(&csbi))) csbi.cursorPosition.x = 0 csbi.cursorPosition.y += short(n) procSetConsoleCursorPosition.Call(uintptr(handle), *(*uintptr)(unsafe.Pointer(&csbi.cursorPosition))) case 'F': n, err = strconv.Atoi(buf.String()) if err != nil { continue } procGetConsoleScreenBufferInfo.Call(uintptr(handle), uintptr(unsafe.Pointer(&csbi))) csbi.cursorPosition.x = 0 csbi.cursorPosition.y -= short(n) procSetConsoleCursorPosition.Call(uintptr(handle), *(*uintptr)(unsafe.Pointer(&csbi.cursorPosition))) case 'G': n, err = strconv.Atoi(buf.String()) if err != nil { continue } if n < 1 { n = 1 } procGetConsoleScreenBufferInfo.Call(uintptr(handle), uintptr(unsafe.Pointer(&csbi))) csbi.cursorPosition.x = short(n - 1) procSetConsoleCursorPosition.Call(uintptr(handle), *(*uintptr)(unsafe.Pointer(&csbi.cursorPosition))) case 'H', 'f': procGetConsoleScreenBufferInfo.Call(uintptr(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(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(handle), uintptr(unsafe.Pointer(&csbi))) switch n { case 0: cursor = coord{x: csbi.cursorPosition.x, y: csbi.cursorPosition.y} count = dword(csbi.size.x) - dword(csbi.cursorPosition.x) + dword(csbi.size.y-csbi.cursorPosition.y)*dword(csbi.size.x) case 1: cursor = coord{x: csbi.window.left, y: csbi.window.top} count = dword(csbi.size.x) - dword(csbi.cursorPosition.x) + dword(csbi.window.top-csbi.cursorPosition.y)*dword(csbi.size.x) case 2: cursor = coord{x: csbi.window.left, y: csbi.window.top} count = dword(csbi.size.x) - dword(csbi.cursorPosition.x) + dword(csbi.size.y-csbi.cursorPosition.y)*dword(csbi.size.x) } procFillConsoleOutputCharacter.Call(uintptr(handle), uintptr(' '), uintptr(count), *(*uintptr)(unsafe.Pointer(&cursor)), uintptr(unsafe.Pointer(&written))) procFillConsoleOutputAttribute.Call(uintptr(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(handle), uintptr(unsafe.Pointer(&csbi))) var cursor coord var count, written dword switch n { case 0: cursor = coord{x: csbi.cursorPosition.x, y: csbi.cursorPosition.y} count = dword(csbi.size.x - csbi.cursorPosition.x) case 1: cursor = coord{x: csbi.window.left, y: csbi.cursorPosition.y} count = dword(csbi.size.x - csbi.cursorPosition.x) case 2: cursor = coord{x: csbi.window.left, y: csbi.cursorPosition.y} count = dword(csbi.size.x) } procFillConsoleOutputCharacter.Call(uintptr(handle), uintptr(' '), uintptr(count), *(*uintptr)(unsafe.Pointer(&cursor)), uintptr(unsafe.Pointer(&written))) procFillConsoleOutputAttribute.Call(uintptr(handle), uintptr(csbi.attributes), uintptr(count), *(*uintptr)(unsafe.Pointer(&cursor)), uintptr(unsafe.Pointer(&written))) case 'X': n := 0 if buf.Len() > 0 { n, err = strconv.Atoi(buf.String()) if err != nil { continue } } procGetConsoleScreenBufferInfo.Call(uintptr(handle), uintptr(unsafe.Pointer(&csbi))) var cursor coord var written dword cursor = coord{x: csbi.cursorPosition.x, y: csbi.cursorPosition.y} procFillConsoleOutputCharacter.Call(uintptr(handle), uintptr(' '), uintptr(n), *(*uintptr)(unsafe.Pointer(&cursor)), uintptr(unsafe.Pointer(&written))) procFillConsoleOutputAttribute.Call(uintptr(handle), uintptr(csbi.attributes), uintptr(n), *(*uintptr)(unsafe.Pointer(&cursor)), uintptr(unsafe.Pointer(&written))) case 'm': procGetConsoleScreenBufferInfo.Call(uintptr(handle), uintptr(unsafe.Pointer(&csbi))) attr := csbi.attributes cs := buf.String() if cs == "" { procSetConsoleTextAttribute.Call(uintptr(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 n == 4: attr |= commonLvbUnderscore case (1 <= n && n <= 3) || n == 5: attr |= foregroundIntensity case n == 7 || n == 27: attr = (attr &^ (foregroundMask | backgroundMask)) | ((attr & foregroundMask) << 4) | ((attr & backgroundMask) >> 4) case n == 22: attr &^= foregroundIntensity case n == 24: attr &^= commonLvbUnderscore 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%len(n256foreAttr)] i += 2 } } else if len(token) == 5 && token[i+1] == "2" { var r, g, b int r, _ = strconv.Atoi(token[i+2]) g, _ = strconv.Atoi(token[i+3]) b, _ = strconv.Atoi(token[i+4]) i += 4 if r > 127 { attr |= foregroundRed } if g > 127 { attr |= foregroundGreen } if b > 127 { attr |= foregroundBlue } } 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%len(n256backAttr)] i += 2 } } else if len(token) == 5 && token[i+1] == "2" { var r, g, b int r, _ = strconv.Atoi(token[i+2]) g, _ = strconv.Atoi(token[i+3]) b, _ = strconv.Atoi(token[i+4]) i += 4 if r > 127 { attr |= backgroundRed } if g > 127 { attr |= backgroundGreen } if b > 127 { attr |= backgroundBlue } } 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(handle), uintptr(attr)) } } case 'h': var ci consoleCursorInfo cs := buf.String() if cs == "5>" { procGetConsoleCursorInfo.Call(uintptr(handle), uintptr(unsafe.Pointer(&ci))) ci.visible = 0 procSetConsoleCursorInfo.Call(uintptr(handle), uintptr(unsafe.Pointer(&ci))) } else if cs == "?25" { procGetConsoleCursorInfo.Call(uintptr(handle), uintptr(unsafe.Pointer(&ci))) ci.visible = 1 procSetConsoleCursorInfo.Call(uintptr(handle), uintptr(unsafe.Pointer(&ci))) } else if cs == "?1049" { if w.althandle == 0 { h, _, _ := procCreateConsoleScreenBuffer.Call(uintptr(genericRead|genericWrite), 0, 0, uintptr(consoleTextmodeBuffer), 0, 0) w.althandle = syscall.Handle(h) if w.althandle != 0 { handle = w.althandle } } } case 'l': var ci consoleCursorInfo cs := buf.String() if cs == "5>" { procGetConsoleCursorInfo.Call(uintptr(handle), uintptr(unsafe.Pointer(&ci))) ci.visible = 1 procSetConsoleCursorInfo.Call(uintptr(handle), uintptr(unsafe.Pointer(&ci))) } else if cs == "?25" { procGetConsoleCursorInfo.Call(uintptr(handle), uintptr(unsafe.Pointer(&ci))) ci.visible = 0 procSetConsoleCursorInfo.Call(uintptr(handle), uintptr(unsafe.Pointer(&ci))) } else if cs == "?1049" { if w.althandle != 0 { syscall.CloseHandle(w.althandle) w.althandle = 0 handle = w.handle } } case 's': procGetConsoleScreenBufferInfo.Call(uintptr(handle), uintptr(unsafe.Pointer(&csbi))) w.oldpos = csbi.cursorPosition case 'u': procSetConsoleCursorPosition.Call(uintptr(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() } } // EnableColorsStdout enable colors if possible. func EnableColorsStdout(enabled *bool) func() { var mode uint32 h := os.Stdout.Fd() if r, _, _ := procGetConsoleMode.Call(h, uintptr(unsafe.Pointer(&mode))); r != 0 { if r, _, _ = procSetConsoleMode.Call(h, uintptr(mode|cENABLE_VIRTUAL_TERMINAL_PROCESSING)); r != 0 { if enabled != nil { *enabled = true } return func() { procSetConsoleMode.Call(h, uintptr(mode)) } } } if enabled != nil { *enabled = true } return func() {} }
go
MIT
f4fc3669ca8eb67aa350a76503397192bf26f057
2026-01-07T08:35:43.570558Z
false
jesseduffield/lazydocker
https://github.com/jesseduffield/lazydocker/blob/f4fc3669ca8eb67aa350a76503397192bf26f057/vendor/github.com/mattn/go-colorable/noncolorable.go
vendor/github.com/mattn/go-colorable/noncolorable.go
package colorable import ( "bytes" "io" ) // NonColorable holds writer but removes escape sequence. type NonColorable struct { out io.Writer } // NewNonColorable returns new instance of Writer which removes escape sequence from Writer. func NewNonColorable(w io.Writer) io.Writer { return &NonColorable{out: w} } // Write writes 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 }
go
MIT
f4fc3669ca8eb67aa350a76503397192bf26f057
2026-01-07T08:35:43.570558Z
false
jesseduffield/lazydocker
https://github.com/jesseduffield/lazydocker/blob/f4fc3669ca8eb67aa350a76503397192bf26f057/vendor/github.com/mattn/go-colorable/colorable_others.go
vendor/github.com/mattn/go-colorable/colorable_others.go
// +build !windows // +build !appengine package colorable import ( "io" "os" _ "github.com/mattn/go-isatty" ) // NewColorable returns new instance of Writer which handles escape sequence. func NewColorable(file *os.File) io.Writer { if file == nil { panic("nil passed instead of *os.File to NewColorable()") } return file } // NewColorableStdout returns new instance of Writer which handles escape sequence for stdout. func NewColorableStdout() io.Writer { return os.Stdout } // NewColorableStderr returns new instance of Writer which handles escape sequence for stderr. func NewColorableStderr() io.Writer { return os.Stderr } // EnableColorsStdout enable colors if possible. func EnableColorsStdout(enabled *bool) func() { if enabled != nil { *enabled = true } return func() {} }
go
MIT
f4fc3669ca8eb67aa350a76503397192bf26f057
2026-01-07T08:35:43.570558Z
false
jesseduffield/lazydocker
https://github.com/jesseduffield/lazydocker/blob/f4fc3669ca8eb67aa350a76503397192bf26f057/vendor/github.com/mattn/go-colorable/colorable_appengine.go
vendor/github.com/mattn/go-colorable/colorable_appengine.go
// +build appengine package colorable import ( "io" "os" _ "github.com/mattn/go-isatty" ) // NewColorable returns new instance of Writer which handles escape sequence. func NewColorable(file *os.File) io.Writer { if file == nil { panic("nil passed instead of *os.File to NewColorable()") } return file } // NewColorableStdout returns new instance of Writer which handles escape sequence for stdout. func NewColorableStdout() io.Writer { return os.Stdout } // NewColorableStderr returns new instance of Writer which handles escape sequence for stderr. func NewColorableStderr() io.Writer { return os.Stderr } // EnableColorsStdout enable colors if possible. func EnableColorsStdout(enabled *bool) func() { if enabled != nil { *enabled = true } return func() {} }
go
MIT
f4fc3669ca8eb67aa350a76503397192bf26f057
2026-01-07T08:35:43.570558Z
false
jesseduffield/lazydocker
https://github.com/jesseduffield/lazydocker/blob/f4fc3669ca8eb67aa350a76503397192bf26f057/vendor/github.com/mattn/go-runewidth/runewidth.go
vendor/github.com/mattn/go-runewidth/runewidth.go
package runewidth import ( "os" "strings" "github.com/rivo/uniseg" ) //go:generate go run script/generate.go var ( // EastAsianWidth will be set true if the current locale is CJK EastAsianWidth bool // StrictEmojiNeutral should be set false if handle broken fonts StrictEmojiNeutral bool = true // DefaultCondition is a condition in current locale DefaultCondition = &Condition{ EastAsianWidth: false, StrictEmojiNeutral: true, } ) func init() { handleEnv() } func handleEnv() { env := os.Getenv("RUNEWIDTH_EASTASIAN") if env == "" { EastAsianWidth = IsEastAsian() } else { EastAsianWidth = env == "1" } // update DefaultCondition if DefaultCondition.EastAsianWidth != EastAsianWidth { DefaultCondition.EastAsianWidth = EastAsianWidth if len(DefaultCondition.combinedLut) > 0 { DefaultCondition.combinedLut = DefaultCondition.combinedLut[:0] CreateLUT() } } } 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 { if r < t[0].first { return false } bot := 0 top := len(t) - 1 for top >= bot { mid := (bot + top) >> 1 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}, {0x2028, 0x202E}, {0x206A, 0x206F}, {0xD800, 0xDFFF}, {0xFEFF, 0xFEFF}, {0xFFF9, 0xFFFB}, {0xFFFE, 0xFFFF}, } // Condition have flag EastAsianWidth whether the current locale is CJK or not. type Condition struct { combinedLut []byte EastAsianWidth bool StrictEmojiNeutral bool } // NewCondition return new instance of Condition which is current locale. func NewCondition() *Condition { return &Condition{ EastAsianWidth: EastAsianWidth, StrictEmojiNeutral: StrictEmojiNeutral, } } // RuneWidth returns the number of cells in r. // See http://www.unicode.org/reports/tr11/ func (c *Condition) RuneWidth(r rune) int { if r < 0 || r > 0x10FFFF { return 0 } if len(c.combinedLut) > 0 { return int(c.combinedLut[r>>1]>>(uint(r&1)*4)) & 3 } // optimized version, verified by TestRuneWidthChecksums() if !c.EastAsianWidth { switch { case r < 0x20: return 0 case (r >= 0x7F && r <= 0x9F) || r == 0xAD: // nonprint return 0 case r < 0x300: return 1 case inTable(r, narrow): return 1 case inTables(r, nonprint, combining): return 0 case inTable(r, doublewidth): return 2 default: return 1 } } else { switch { case inTables(r, nonprint, combining): return 0 case inTable(r, narrow): return 1 case inTables(r, ambiguous, doublewidth): return 2 case !c.StrictEmojiNeutral && inTables(r, ambiguous, emoji, narrow): return 2 default: return 1 } } } // CreateLUT will create an in-memory lookup table of 557056 bytes for faster operation. // This should not be called concurrently with other operations on c. // If options in c is changed, CreateLUT should be called again. func (c *Condition) CreateLUT() { const max = 0x110000 lut := c.combinedLut if len(c.combinedLut) != 0 { // Remove so we don't use it. c.combinedLut = nil } else { lut = make([]byte, max/2) } for i := range lut { i32 := int32(i * 2) x0 := c.RuneWidth(i32) x1 := c.RuneWidth(i32 + 1) lut[i] = uint8(x0) | uint8(x1)<<4 } c.combinedLut = lut } // StringWidth return width as you can see func (c *Condition) StringWidth(s string) (width int) { g := uniseg.NewGraphemes(s) for g.Next() { var chWidth int for _, r := range g.Runes() { chWidth = c.RuneWidth(r) if chWidth > 0 { break // Our best guess at this point is to use the width of the first non-zero-width rune. } } width += chWidth } return } // 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 } w -= c.StringWidth(tail) var width int pos := len(s) g := uniseg.NewGraphemes(s) for g.Next() { var chWidth int for _, r := range g.Runes() { chWidth = c.RuneWidth(r) if chWidth > 0 { break // See StringWidth() for details. } } if width+chWidth > w { pos, _ = g.Positions() break } width += chWidth } return s[:pos] + tail } // TruncateLeft cuts w cells from the beginning of the `s`. func (c *Condition) TruncateLeft(s string, w int, prefix string) string { if c.StringWidth(s) <= w { return prefix } var width int pos := len(s) g := uniseg.NewGraphemes(s) for g.Next() { var chWidth int for _, r := range g.Runes() { chWidth = c.RuneWidth(r) if chWidth > 0 { break // See StringWidth() for details. } } if width+chWidth > w { if width < w { _, pos = g.Positions() prefix += strings.Repeat(" ", width+chWidth-w) } else { pos, _ = g.Positions() } break } width += chWidth } return prefix + s[pos:] } // Wrap return string wrapped with w cells func (c *Condition) Wrap(s string, w int) string { width := 0 out := "" for _, r := range s { cw := c.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) } // TruncateLeft cuts w cells from the beginning of the `s`. func TruncateLeft(s string, w int, prefix string) string { return DefaultCondition.TruncateLeft(s, w, prefix) } // 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) } // CreateLUT will create an in-memory lookup table of 557055 bytes for faster operation. // This should not be called concurrently with other operations. func CreateLUT() { if len(DefaultCondition.combinedLut) > 0 { return } DefaultCondition.CreateLUT() }
go
MIT
f4fc3669ca8eb67aa350a76503397192bf26f057
2026-01-07T08:35:43.570558Z
false
jesseduffield/lazydocker
https://github.com/jesseduffield/lazydocker/blob/f4fc3669ca8eb67aa350a76503397192bf26f057/vendor/github.com/mattn/go-runewidth/runewidth_table.go
vendor/github.com/mattn/go-runewidth/runewidth_table.go
// Code generated by script/generate.go. DO NOT EDIT. package runewidth var combining = table{ {0x0300, 0x036F}, {0x0483, 0x0489}, {0x07EB, 0x07F3}, {0x0C00, 0x0C00}, {0x0C04, 0x0C04}, {0x0D00, 0x0D01}, {0x135D, 0x135F}, {0x1A7F, 0x1A7F}, {0x1AB0, 0x1AC0}, {0x1B6B, 0x1B73}, {0x1DC0, 0x1DF9}, {0x1DFB, 0x1DFF}, {0x20D0, 0x20F0}, {0x2CEF, 0x2CF1}, {0x2DE0, 0x2DFF}, {0x3099, 0x309A}, {0xA66F, 0xA672}, {0xA674, 0xA67D}, {0xA69E, 0xA69F}, {0xA6F0, 0xA6F1}, {0xA8E0, 0xA8F1}, {0xFE20, 0xFE2F}, {0x101FD, 0x101FD}, {0x10376, 0x1037A}, {0x10EAB, 0x10EAC}, {0x10F46, 0x10F50}, {0x11300, 0x11301}, {0x1133B, 0x1133C}, {0x11366, 0x1136C}, {0x11370, 0x11374}, {0x16AF0, 0x16AF4}, {0x1D165, 0x1D169}, {0x1D16D, 0x1D172}, {0x1D17B, 0x1D182}, {0x1D185, 0x1D18B}, {0x1D1AA, 0x1D1AD}, {0x1D242, 0x1D244}, {0x1E000, 0x1E006}, {0x1E008, 0x1E018}, {0x1E01B, 0x1E021}, {0x1E023, 0x1E024}, {0x1E026, 0x1E02A}, {0x1E8D0, 0x1E8D6}, } 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, 0x312F}, {0x3131, 0x318E}, {0x3190, 0x31E3}, {0x31F0, 0x321E}, {0x3220, 0x3247}, {0x3250, 0x4DBF}, {0x4E00, 0xA48C}, {0xA490, 0xA4C6}, {0xA960, 0xA97C}, {0xAC00, 0xD7A3}, {0xF900, 0xFAFF}, {0xFE10, 0xFE19}, {0xFE30, 0xFE52}, {0xFE54, 0xFE66}, {0xFE68, 0xFE6B}, {0xFF01, 0xFF60}, {0xFFE0, 0xFFE6}, {0x16FE0, 0x16FE4}, {0x16FF0, 0x16FF1}, {0x17000, 0x187F7}, {0x18800, 0x18CD5}, {0x18D00, 0x18D08}, {0x1B000, 0x1B11E}, {0x1B150, 0x1B152}, {0x1B164, 0x1B167}, {0x1B170, 0x1B2FB}, {0x1F004, 0x1F004}, {0x1F0CF, 0x1F0CF}, {0x1F18E, 0x1F18E}, {0x1F191, 0x1F19A}, {0x1F200, 0x1F202}, {0x1F210, 0x1F23B}, {0x1F240, 0x1F248}, {0x1F250, 0x1F251}, {0x1F260, 0x1F265}, {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}, {0x1F6D5, 0x1F6D7}, {0x1F6EB, 0x1F6EC}, {0x1F6F4, 0x1F6FC}, {0x1F7E0, 0x1F7EB}, {0x1F90C, 0x1F93A}, {0x1F93C, 0x1F945}, {0x1F947, 0x1F978}, {0x1F97A, 0x1F9CB}, {0x1F9CD, 0x1F9FF}, {0x1FA70, 0x1FA74}, {0x1FA78, 0x1FA7A}, {0x1FA80, 0x1FA86}, {0x1FA90, 0x1FAA8}, {0x1FAB0, 0x1FAB6}, {0x1FAC0, 0x1FAC2}, {0x1FAD0, 0x1FAD6}, {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 narrow = table{ {0x0020, 0x007E}, {0x00A2, 0x00A3}, {0x00A5, 0x00A6}, {0x00AC, 0x00AC}, {0x00AF, 0x00AF}, {0x27E6, 0x27ED}, {0x2985, 0x2986}, } var neutral = table{ {0x0000, 0x001F}, {0x007F, 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, 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, 0x01CD}, {0x01CF, 0x01CF}, {0x01D1, 0x01D1}, {0x01D3, 0x01D3}, {0x01D5, 0x01D5}, {0x01D7, 0x01D7}, {0x01D9, 0x01D9}, {0x01DB, 0x01DB}, {0x01DD, 0x0250}, {0x0252, 0x0260}, {0x0262, 0x02C3}, {0x02C5, 0x02C6}, {0x02C8, 0x02C8}, {0x02CC, 0x02CC}, {0x02CE, 0x02CF}, {0x02D1, 0x02D7}, {0x02DC, 0x02DC}, {0x02DE, 0x02DE}, {0x02E0, 0x02FF}, {0x0370, 0x0377}, {0x037A, 0x037F}, {0x0384, 0x038A}, {0x038C, 0x038C}, {0x038E, 0x0390}, {0x03AA, 0x03B0}, {0x03C2, 0x03C2}, {0x03CA, 0x0400}, {0x0402, 0x040F}, {0x0450, 0x0450}, {0x0452, 0x052F}, {0x0531, 0x0556}, {0x0559, 0x058A}, {0x058D, 0x058F}, {0x0591, 0x05C7}, {0x05D0, 0x05EA}, {0x05EF, 0x05F4}, {0x0600, 0x061C}, {0x061E, 0x070D}, {0x070F, 0x074A}, {0x074D, 0x07B1}, {0x07C0, 0x07FA}, {0x07FD, 0x082D}, {0x0830, 0x083E}, {0x0840, 0x085B}, {0x085E, 0x085E}, {0x0860, 0x086A}, {0x08A0, 0x08B4}, {0x08B6, 0x08C7}, {0x08D3, 0x0983}, {0x0985, 0x098C}, {0x098F, 0x0990}, {0x0993, 0x09A8}, {0x09AA, 0x09B0}, {0x09B2, 0x09B2}, {0x09B6, 0x09B9}, {0x09BC, 0x09C4}, {0x09C7, 0x09C8}, {0x09CB, 0x09CE}, {0x09D7, 0x09D7}, {0x09DC, 0x09DD}, {0x09DF, 0x09E3}, {0x09E6, 0x09FE}, {0x0A01, 0x0A03}, {0x0A05, 0x0A0A}, {0x0A0F, 0x0A10}, {0x0A13, 0x0A28}, {0x0A2A, 0x0A30}, {0x0A32, 0x0A33}, {0x0A35, 0x0A36}, {0x0A38, 0x0A39}, {0x0A3C, 0x0A3C}, {0x0A3E, 0x0A42}, {0x0A47, 0x0A48}, {0x0A4B, 0x0A4D}, {0x0A51, 0x0A51}, {0x0A59, 0x0A5C}, {0x0A5E, 0x0A5E}, {0x0A66, 0x0A76}, {0x0A81, 0x0A83}, {0x0A85, 0x0A8D}, {0x0A8F, 0x0A91}, {0x0A93, 0x0AA8}, {0x0AAA, 0x0AB0}, {0x0AB2, 0x0AB3}, {0x0AB5, 0x0AB9}, {0x0ABC, 0x0AC5}, {0x0AC7, 0x0AC9}, {0x0ACB, 0x0ACD}, {0x0AD0, 0x0AD0}, {0x0AE0, 0x0AE3}, {0x0AE6, 0x0AF1}, {0x0AF9, 0x0AFF}, {0x0B01, 0x0B03}, {0x0B05, 0x0B0C}, {0x0B0F, 0x0B10}, {0x0B13, 0x0B28}, {0x0B2A, 0x0B30}, {0x0B32, 0x0B33}, {0x0B35, 0x0B39}, {0x0B3C, 0x0B44}, {0x0B47, 0x0B48}, {0x0B4B, 0x0B4D}, {0x0B55, 0x0B57}, {0x0B5C, 0x0B5D}, {0x0B5F, 0x0B63}, {0x0B66, 0x0B77}, {0x0B82, 0x0B83}, {0x0B85, 0x0B8A}, {0x0B8E, 0x0B90}, {0x0B92, 0x0B95}, {0x0B99, 0x0B9A}, {0x0B9C, 0x0B9C}, {0x0B9E, 0x0B9F}, {0x0BA3, 0x0BA4}, {0x0BA8, 0x0BAA}, {0x0BAE, 0x0BB9}, {0x0BBE, 0x0BC2}, {0x0BC6, 0x0BC8}, {0x0BCA, 0x0BCD}, {0x0BD0, 0x0BD0}, {0x0BD7, 0x0BD7}, {0x0BE6, 0x0BFA}, {0x0C00, 0x0C0C}, {0x0C0E, 0x0C10}, {0x0C12, 0x0C28}, {0x0C2A, 0x0C39}, {0x0C3D, 0x0C44}, {0x0C46, 0x0C48}, {0x0C4A, 0x0C4D}, {0x0C55, 0x0C56}, {0x0C58, 0x0C5A}, {0x0C60, 0x0C63}, {0x0C66, 0x0C6F}, {0x0C77, 0x0C8C}, {0x0C8E, 0x0C90}, {0x0C92, 0x0CA8}, {0x0CAA, 0x0CB3}, {0x0CB5, 0x0CB9}, {0x0CBC, 0x0CC4}, {0x0CC6, 0x0CC8}, {0x0CCA, 0x0CCD}, {0x0CD5, 0x0CD6}, {0x0CDE, 0x0CDE}, {0x0CE0, 0x0CE3}, {0x0CE6, 0x0CEF}, {0x0CF1, 0x0CF2}, {0x0D00, 0x0D0C}, {0x0D0E, 0x0D10}, {0x0D12, 0x0D44}, {0x0D46, 0x0D48}, {0x0D4A, 0x0D4F}, {0x0D54, 0x0D63}, {0x0D66, 0x0D7F}, {0x0D81, 0x0D83}, {0x0D85, 0x0D96}, {0x0D9A, 0x0DB1}, {0x0DB3, 0x0DBB}, {0x0DBD, 0x0DBD}, {0x0DC0, 0x0DC6}, {0x0DCA, 0x0DCA}, {0x0DCF, 0x0DD4}, {0x0DD6, 0x0DD6}, {0x0DD8, 0x0DDF}, {0x0DE6, 0x0DEF}, {0x0DF2, 0x0DF4}, {0x0E01, 0x0E3A}, {0x0E3F, 0x0E5B}, {0x0E81, 0x0E82}, {0x0E84, 0x0E84}, {0x0E86, 0x0E8A}, {0x0E8C, 0x0EA3}, {0x0EA5, 0x0EA5}, {0x0EA7, 0x0EBD}, {0x0EC0, 0x0EC4}, {0x0EC6, 0x0EC6}, {0x0EC8, 0x0ECD}, {0x0ED0, 0x0ED9}, {0x0EDC, 0x0EDF}, {0x0F00, 0x0F47}, {0x0F49, 0x0F6C}, {0x0F71, 0x0F97}, {0x0F99, 0x0FBC}, {0x0FBE, 0x0FCC}, {0x0FCE, 0x0FDA}, {0x1000, 0x10C5}, {0x10C7, 0x10C7}, {0x10CD, 0x10CD}, {0x10D0, 0x10FF}, {0x1160, 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, 0x137C}, {0x1380, 0x1399}, {0x13A0, 0x13F5}, {0x13F8, 0x13FD}, {0x1400, 0x169C}, {0x16A0, 0x16F8}, {0x1700, 0x170C}, {0x170E, 0x1714}, {0x1720, 0x1736}, {0x1740, 0x1753}, {0x1760, 0x176C}, {0x176E, 0x1770}, {0x1772, 0x1773}, {0x1780, 0x17DD}, {0x17E0, 0x17E9}, {0x17F0, 0x17F9}, {0x1800, 0x180E}, {0x1810, 0x1819}, {0x1820, 0x1878}, {0x1880, 0x18AA}, {0x18B0, 0x18F5}, {0x1900, 0x191E}, {0x1920, 0x192B}, {0x1930, 0x193B}, {0x1940, 0x1940}, {0x1944, 0x196D}, {0x1970, 0x1974}, {0x1980, 0x19AB}, {0x19B0, 0x19C9}, {0x19D0, 0x19DA}, {0x19DE, 0x1A1B}, {0x1A1E, 0x1A5E}, {0x1A60, 0x1A7C}, {0x1A7F, 0x1A89}, {0x1A90, 0x1A99}, {0x1AA0, 0x1AAD}, {0x1AB0, 0x1AC0}, {0x1B00, 0x1B4B}, {0x1B50, 0x1B7C}, {0x1B80, 0x1BF3}, {0x1BFC, 0x1C37}, {0x1C3B, 0x1C49}, {0x1C4D, 0x1C88}, {0x1C90, 0x1CBA}, {0x1CBD, 0x1CC7}, {0x1CD0, 0x1CFA}, {0x1D00, 0x1DF9}, {0x1DFB, 0x1F15}, {0x1F18, 0x1F1D}, {0x1F20, 0x1F45}, {0x1F48, 0x1F4D}, {0x1F50, 0x1F57}, {0x1F59, 0x1F59}, {0x1F5B, 0x1F5B}, {0x1F5D, 0x1F5D}, {0x1F5F, 0x1F7D}, {0x1F80, 0x1FB4}, {0x1FB6, 0x1FC4}, {0x1FC6, 0x1FD3}, {0x1FD6, 0x1FDB}, {0x1FDD, 0x1FEF}, {0x1FF2, 0x1FF4}, {0x1FF6, 0x1FFE}, {0x2000, 0x200F}, {0x2011, 0x2012}, {0x2017, 0x2017}, {0x201A, 0x201B}, {0x201E, 0x201F}, {0x2023, 0x2023}, {0x2028, 0x202F}, {0x2031, 0x2031}, {0x2034, 0x2034}, {0x2036, 0x203A}, {0x203C, 0x203D}, {0x203F, 0x2064}, {0x2066, 0x2071}, {0x2075, 0x207E}, {0x2080, 0x2080}, {0x2085, 0x208E}, {0x2090, 0x209C}, {0x20A0, 0x20A8}, {0x20AA, 0x20AB}, {0x20AD, 0x20BF}, {0x20D0, 0x20F0}, {0x2100, 0x2102}, {0x2104, 0x2104}, {0x2106, 0x2108}, {0x210A, 0x2112}, {0x2114, 0x2115}, {0x2117, 0x2120}, {0x2123, 0x2125}, {0x2127, 0x212A}, {0x212C, 0x2152}, {0x2155, 0x215A}, {0x215F, 0x215F}, {0x216C, 0x216F}, {0x217A, 0x2188}, {0x218A, 0x218B}, {0x219A, 0x21B7}, {0x21BA, 0x21D1}, {0x21D3, 0x21D3}, {0x21D5, 0x21E6}, {0x21E8, 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, 0x2311}, {0x2313, 0x2319}, {0x231C, 0x2328}, {0x232B, 0x23E8}, {0x23ED, 0x23EF}, {0x23F1, 0x23F2}, {0x23F4, 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, 0x25FC}, {0x25FF, 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, 0x2775}, {0x2780, 0x2794}, {0x2798, 0x27AF}, {0x27B1, 0x27BE}, {0x27C0, 0x27E5}, {0x27EE, 0x2984}, {0x2987, 0x2B1A}, {0x2B1D, 0x2B4F}, {0x2B51, 0x2B54}, {0x2B5A, 0x2B73}, {0x2B76, 0x2B95}, {0x2B97, 0x2C2E}, {0x2C30, 0x2C5E}, {0x2C60, 0x2CF3}, {0x2CF9, 0x2D25}, {0x2D27, 0x2D27}, {0x2D2D, 0x2D2D}, {0x2D30, 0x2D67}, {0x2D6F, 0x2D70}, {0x2D7F, 0x2D96}, {0x2DA0, 0x2DA6}, {0x2DA8, 0x2DAE}, {0x2DB0, 0x2DB6}, {0x2DB8, 0x2DBE}, {0x2DC0, 0x2DC6}, {0x2DC8, 0x2DCE}, {0x2DD0, 0x2DD6}, {0x2DD8, 0x2DDE}, {0x2DE0, 0x2E52}, {0x303F, 0x303F}, {0x4DC0, 0x4DFF}, {0xA4D0, 0xA62B}, {0xA640, 0xA6F7}, {0xA700, 0xA7BF}, {0xA7C2, 0xA7CA}, {0xA7F5, 0xA82C}, {0xA830, 0xA839}, {0xA840, 0xA877}, {0xA880, 0xA8C5}, {0xA8CE, 0xA8D9}, {0xA8E0, 0xA953}, {0xA95F, 0xA95F}, {0xA980, 0xA9CD}, {0xA9CF, 0xA9D9}, {0xA9DE, 0xA9FE}, {0xAA00, 0xAA36}, {0xAA40, 0xAA4D}, {0xAA50, 0xAA59}, {0xAA5C, 0xAAC2}, {0xAADB, 0xAAF6}, {0xAB01, 0xAB06}, {0xAB09, 0xAB0E}, {0xAB11, 0xAB16}, {0xAB20, 0xAB26}, {0xAB28, 0xAB2E}, {0xAB30, 0xAB6B}, {0xAB70, 0xABED}, {0xABF0, 0xABF9}, {0xD7B0, 0xD7C6}, {0xD7CB, 0xD7FB}, {0xD800, 0xDFFF}, {0xFB00, 0xFB06}, {0xFB13, 0xFB17}, {0xFB1D, 0xFB36}, {0xFB38, 0xFB3C}, {0xFB3E, 0xFB3E}, {0xFB40, 0xFB41}, {0xFB43, 0xFB44}, {0xFB46, 0xFBC1}, {0xFBD3, 0xFD3F}, {0xFD50, 0xFD8F}, {0xFD92, 0xFDC7}, {0xFDF0, 0xFDFD}, {0xFE20, 0xFE2F}, {0xFE70, 0xFE74}, {0xFE76, 0xFEFC}, {0xFEFF, 0xFEFF}, {0xFFF9, 0xFFFC}, {0x10000, 0x1000B}, {0x1000D, 0x10026}, {0x10028, 0x1003A}, {0x1003C, 0x1003D}, {0x1003F, 0x1004D}, {0x10050, 0x1005D}, {0x10080, 0x100FA}, {0x10100, 0x10102}, {0x10107, 0x10133}, {0x10137, 0x1018E}, {0x10190, 0x1019C}, {0x101A0, 0x101A0}, {0x101D0, 0x101FD}, {0x10280, 0x1029C}, {0x102A0, 0x102D0}, {0x102E0, 0x102FB}, {0x10300, 0x10323}, {0x1032D, 0x1034A}, {0x10350, 0x1037A}, {0x10380, 0x1039D}, {0x1039F, 0x103C3}, {0x103C8, 0x103D5}, {0x10400, 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, 0x10855}, {0x10857, 0x1089E}, {0x108A7, 0x108AF}, {0x108E0, 0x108F2}, {0x108F4, 0x108F5}, {0x108FB, 0x1091B}, {0x1091F, 0x10939}, {0x1093F, 0x1093F}, {0x10980, 0x109B7}, {0x109BC, 0x109CF}, {0x109D2, 0x10A03}, {0x10A05, 0x10A06}, {0x10A0C, 0x10A13}, {0x10A15, 0x10A17}, {0x10A19, 0x10A35}, {0x10A38, 0x10A3A}, {0x10A3F, 0x10A48}, {0x10A50, 0x10A58}, {0x10A60, 0x10A9F}, {0x10AC0, 0x10AE6}, {0x10AEB, 0x10AF6}, {0x10B00, 0x10B35}, {0x10B39, 0x10B55}, {0x10B58, 0x10B72}, {0x10B78, 0x10B91}, {0x10B99, 0x10B9C}, {0x10BA9, 0x10BAF}, {0x10C00, 0x10C48}, {0x10C80, 0x10CB2}, {0x10CC0, 0x10CF2}, {0x10CFA, 0x10D27}, {0x10D30, 0x10D39}, {0x10E60, 0x10E7E}, {0x10E80, 0x10EA9}, {0x10EAB, 0x10EAD}, {0x10EB0, 0x10EB1}, {0x10F00, 0x10F27}, {0x10F30, 0x10F59}, {0x10FB0, 0x10FCB}, {0x10FE0, 0x10FF6}, {0x11000, 0x1104D}, {0x11052, 0x1106F}, {0x1107F, 0x110C1}, {0x110CD, 0x110CD}, {0x110D0, 0x110E8}, {0x110F0, 0x110F9}, {0x11100, 0x11134}, {0x11136, 0x11147}, {0x11150, 0x11176}, {0x11180, 0x111DF}, {0x111E1, 0x111F4}, {0x11200, 0x11211}, {0x11213, 0x1123E}, {0x11280, 0x11286}, {0x11288, 0x11288}, {0x1128A, 0x1128D}, {0x1128F, 0x1129D}, {0x1129F, 0x112A9}, {0x112B0, 0x112EA}, {0x112F0, 0x112F9}, {0x11300, 0x11303}, {0x11305, 0x1130C}, {0x1130F, 0x11310}, {0x11313, 0x11328}, {0x1132A, 0x11330}, {0x11332, 0x11333}, {0x11335, 0x11339}, {0x1133B, 0x11344}, {0x11347, 0x11348}, {0x1134B, 0x1134D}, {0x11350, 0x11350}, {0x11357, 0x11357}, {0x1135D, 0x11363}, {0x11366, 0x1136C}, {0x11370, 0x11374}, {0x11400, 0x1145B}, {0x1145D, 0x11461}, {0x11480, 0x114C7}, {0x114D0, 0x114D9}, {0x11580, 0x115B5}, {0x115B8, 0x115DD}, {0x11600, 0x11644}, {0x11650, 0x11659}, {0x11660, 0x1166C}, {0x11680, 0x116B8}, {0x116C0, 0x116C9}, {0x11700, 0x1171A}, {0x1171D, 0x1172B}, {0x11730, 0x1173F}, {0x11800, 0x1183B}, {0x118A0, 0x118F2}, {0x118FF, 0x11906}, {0x11909, 0x11909}, {0x1190C, 0x11913}, {0x11915, 0x11916}, {0x11918, 0x11935}, {0x11937, 0x11938}, {0x1193B, 0x11946}, {0x11950, 0x11959}, {0x119A0, 0x119A7}, {0x119AA, 0x119D7}, {0x119DA, 0x119E4}, {0x11A00, 0x11A47}, {0x11A50, 0x11AA2}, {0x11AC0, 0x11AF8}, {0x11C00, 0x11C08}, {0x11C0A, 0x11C36}, {0x11C38, 0x11C45}, {0x11C50, 0x11C6C}, {0x11C70, 0x11C8F}, {0x11C92, 0x11CA7}, {0x11CA9, 0x11CB6}, {0x11D00, 0x11D06}, {0x11D08, 0x11D09}, {0x11D0B, 0x11D36}, {0x11D3A, 0x11D3A}, {0x11D3C, 0x11D3D}, {0x11D3F, 0x11D47}, {0x11D50, 0x11D59}, {0x11D60, 0x11D65}, {0x11D67, 0x11D68}, {0x11D6A, 0x11D8E}, {0x11D90, 0x11D91}, {0x11D93, 0x11D98}, {0x11DA0, 0x11DA9}, {0x11EE0, 0x11EF8}, {0x11FB0, 0x11FB0}, {0x11FC0, 0x11FF1}, {0x11FFF, 0x12399}, {0x12400, 0x1246E}, {0x12470, 0x12474}, {0x12480, 0x12543}, {0x13000, 0x1342E}, {0x13430, 0x13438}, {0x14400, 0x14646}, {0x16800, 0x16A38}, {0x16A40, 0x16A5E}, {0x16A60, 0x16A69}, {0x16A6E, 0x16A6F}, {0x16AD0, 0x16AED}, {0x16AF0, 0x16AF5}, {0x16B00, 0x16B45}, {0x16B50, 0x16B59}, {0x16B5B, 0x16B61}, {0x16B63, 0x16B77}, {0x16B7D, 0x16B8F}, {0x16E40, 0x16E9A}, {0x16F00, 0x16F4A}, {0x16F4F, 0x16F87}, {0x16F8F, 0x16F9F}, {0x1BC00, 0x1BC6A}, {0x1BC70, 0x1BC7C}, {0x1BC80, 0x1BC88}, {0x1BC90, 0x1BC99}, {0x1BC9C, 0x1BCA3}, {0x1D000, 0x1D0F5}, {0x1D100, 0x1D126}, {0x1D129, 0x1D1E8}, {0x1D200, 0x1D245}, {0x1D2E0, 0x1D2F3}, {0x1D300, 0x1D356}, {0x1D360, 0x1D378}, {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, 0x1D7CB}, {0x1D7CE, 0x1DA8B}, {0x1DA9B, 0x1DA9F}, {0x1DAA1, 0x1DAAF}, {0x1E000, 0x1E006}, {0x1E008, 0x1E018}, {0x1E01B, 0x1E021}, {0x1E023, 0x1E024}, {0x1E026, 0x1E02A}, {0x1E100, 0x1E12C}, {0x1E130, 0x1E13D}, {0x1E140, 0x1E149}, {0x1E14E, 0x1E14F}, {0x1E2C0, 0x1E2F9}, {0x1E2FF, 0x1E2FF}, {0x1E800, 0x1E8C4}, {0x1E8C7, 0x1E8D6}, {0x1E900, 0x1E94B}, {0x1E950, 0x1E959}, {0x1E95E, 0x1E95F}, {0x1EC71, 0x1ECB4}, {0x1ED01, 0x1ED3D}, {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, 0x1F10F}, {0x1F12E, 0x1F12F}, {0x1F16A, 0x1F16F}, {0x1F1AD, 0x1F1AD}, {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}, {0x1F6D3, 0x1F6D4}, {0x1F6E0, 0x1F6EA}, {0x1F6F0, 0x1F6F3}, {0x1F700, 0x1F773}, {0x1F780, 0x1F7D8}, {0x1F800, 0x1F80B}, {0x1F810, 0x1F847}, {0x1F850, 0x1F859}, {0x1F860, 0x1F887}, {0x1F890, 0x1F8AD}, {0x1F8B0, 0x1F8B1}, {0x1F900, 0x1F90B}, {0x1F93B, 0x1F93B}, {0x1F946, 0x1F946}, {0x1FA00, 0x1FA53}, {0x1FA60, 0x1FA6D}, {0x1FB00, 0x1FB92}, {0x1FB94, 0x1FBCA}, {0x1FBF0, 0x1FBF9}, {0xE0001, 0xE0001}, {0xE0020, 0xE007F}, } var emoji = table{ {0x203C, 0x203C}, {0x2049, 0x2049}, {0x2122, 0x2122}, {0x2139, 0x2139}, {0x2194, 0x2199}, {0x21A9, 0x21AA}, {0x231A, 0x231B}, {0x2328, 0x2328}, {0x2388, 0x2388}, {0x23CF, 0x23CF}, {0x23E9, 0x23F3}, {0x23F8, 0x23FA}, {0x24C2, 0x24C2}, {0x25AA, 0x25AB}, {0x25B6, 0x25B6}, {0x25C0, 0x25C0}, {0x25FB, 0x25FE}, {0x2600, 0x2605}, {0x2607, 0x2612}, {0x2614, 0x2685}, {0x2690, 0x2705}, {0x2708, 0x2712}, {0x2714, 0x2714}, {0x2716, 0x2716}, {0x271D, 0x271D}, {0x2721, 0x2721}, {0x2728, 0x2728}, {0x2733, 0x2734}, {0x2744, 0x2744}, {0x2747, 0x2747}, {0x274C, 0x274C}, {0x274E, 0x274E}, {0x2753, 0x2755}, {0x2757, 0x2757}, {0x2763, 0x2767}, {0x2795, 0x2797}, {0x27A1, 0x27A1}, {0x27B0, 0x27B0}, {0x27BF, 0x27BF}, {0x2934, 0x2935}, {0x2B05, 0x2B07}, {0x2B1B, 0x2B1C}, {0x2B50, 0x2B50}, {0x2B55, 0x2B55}, {0x3030, 0x3030}, {0x303D, 0x303D}, {0x3297, 0x3297}, {0x3299, 0x3299}, {0x1F000, 0x1F0FF}, {0x1F10D, 0x1F10F}, {0x1F12F, 0x1F12F}, {0x1F16C, 0x1F171}, {0x1F17E, 0x1F17F}, {0x1F18E, 0x1F18E}, {0x1F191, 0x1F19A}, {0x1F1AD, 0x1F1E5}, {0x1F201, 0x1F20F}, {0x1F21A, 0x1F21A}, {0x1F22F, 0x1F22F}, {0x1F232, 0x1F23A}, {0x1F23C, 0x1F23F}, {0x1F249, 0x1F3FA}, {0x1F400, 0x1F53D}, {0x1F546, 0x1F64F}, {0x1F680, 0x1F6FF}, {0x1F774, 0x1F77F}, {0x1F7D5, 0x1F7FF}, {0x1F80C, 0x1F80F}, {0x1F848, 0x1F84F}, {0x1F85A, 0x1F85F}, {0x1F888, 0x1F88F}, {0x1F8AE, 0x1F8FF}, {0x1F90C, 0x1F93A}, {0x1F93C, 0x1F945}, {0x1F947, 0x1FAFF}, {0x1FC00, 0x1FFFD}, }
go
MIT
f4fc3669ca8eb67aa350a76503397192bf26f057
2026-01-07T08:35:43.570558Z
false
jesseduffield/lazydocker
https://github.com/jesseduffield/lazydocker/blob/f4fc3669ca8eb67aa350a76503397192bf26f057/vendor/github.com/mattn/go-runewidth/runewidth_posix.go
vendor/github.com/mattn/go-runewidth/runewidth_posix.go
//go:build !windows && !js && !appengine // +build !windows,!js,!appengine 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_ALL") if locale == "" { 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) }
go
MIT
f4fc3669ca8eb67aa350a76503397192bf26f057
2026-01-07T08:35:43.570558Z
false
jesseduffield/lazydocker
https://github.com/jesseduffield/lazydocker/blob/f4fc3669ca8eb67aa350a76503397192bf26f057/vendor/github.com/mattn/go-runewidth/runewidth_windows.go
vendor/github.com/mattn/go-runewidth/runewidth_windows.go
//go:build windows && !appengine // +build windows,!appengine 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 }
go
MIT
f4fc3669ca8eb67aa350a76503397192bf26f057
2026-01-07T08:35:43.570558Z
false
jesseduffield/lazydocker
https://github.com/jesseduffield/lazydocker/blob/f4fc3669ca8eb67aa350a76503397192bf26f057/vendor/github.com/mattn/go-runewidth/runewidth_appengine.go
vendor/github.com/mattn/go-runewidth/runewidth_appengine.go
//go:build appengine // +build appengine package runewidth // IsEastAsian return true if the current locale is CJK func IsEastAsian() bool { return false }
go
MIT
f4fc3669ca8eb67aa350a76503397192bf26f057
2026-01-07T08:35:43.570558Z
false
jesseduffield/lazydocker
https://github.com/jesseduffield/lazydocker/blob/f4fc3669ca8eb67aa350a76503397192bf26f057/vendor/github.com/mattn/go-runewidth/runewidth_js.go
vendor/github.com/mattn/go-runewidth/runewidth_js.go
//go:build js && !appengine // +build js,!appengine package runewidth func IsEastAsian() bool { // TODO: Implement this for the web. Detect east asian in a compatible way, and return true. return false }
go
MIT
f4fc3669ca8eb67aa350a76503397192bf26f057
2026-01-07T08:35:43.570558Z
false
jesseduffield/lazydocker
https://github.com/jesseduffield/lazydocker/blob/f4fc3669ca8eb67aa350a76503397192bf26f057/vendor/github.com/mattn/go-isatty/isatty_bsd.go
vendor/github.com/mattn/go-isatty/isatty_bsd.go
// +build darwin freebsd openbsd netbsd dragonfly // +build !appengine package isatty import "golang.org/x/sys/unix" // IsTerminal return true if the file descriptor is terminal. func IsTerminal(fd uintptr) bool { _, err := unix.IoctlGetTermios(int(fd), unix.TIOCGETA) return err == nil } // 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 }
go
MIT
f4fc3669ca8eb67aa350a76503397192bf26f057
2026-01-07T08:35:43.570558Z
false
jesseduffield/lazydocker
https://github.com/jesseduffield/lazydocker/blob/f4fc3669ca8eb67aa350a76503397192bf26f057/vendor/github.com/mattn/go-isatty/isatty_windows.go
vendor/github.com/mattn/go-isatty/isatty_windows.go
// +build windows // +build !appengine package isatty import ( "errors" "strings" "syscall" "unicode/utf16" "unsafe" ) const ( objectNameInfo uintptr = 1 fileNameInfo = 2 fileTypePipe = 3 ) var ( kernel32 = syscall.NewLazyDLL("kernel32.dll") ntdll = syscall.NewLazyDLL("ntdll.dll") procGetConsoleMode = kernel32.NewProc("GetConsoleMode") procGetFileInformationByHandleEx = kernel32.NewProc("GetFileInformationByHandleEx") procGetFileType = kernel32.NewProc("GetFileType") procNtQueryObject = ntdll.NewProc("NtQueryObject") ) 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` && token[0] != `\Device\NamedPipe\msys` && token[0] != `\Device\NamedPipe\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 } // getFileNameByHandle use the undocomented ntdll NtQueryObject to get file full name from file handler // since GetFileInformationByHandleEx is not avilable under windows Vista and still some old fashion // guys are using Windows XP, this is a workaround for those guys, it will also work on system from // Windows vista to 10 // see https://stackoverflow.com/a/18792477 for details func getFileNameByHandle(fd uintptr) (string, error) { if procNtQueryObject == nil { return "", errors.New("ntdll.dll: NtQueryObject not supported") } var buf [4 + syscall.MAX_PATH]uint16 var result int r, _, e := syscall.Syscall6(procNtQueryObject.Addr(), 5, fd, objectNameInfo, uintptr(unsafe.Pointer(&buf)), uintptr(2*len(buf)), uintptr(unsafe.Pointer(&result)), 0) if r != 0 { return "", e } return string(utf16.Decode(buf[4 : 4+buf[0]/2])), nil } // IsCygwinTerminal() return true if the file descriptor is a cygwin or msys2 // terminal. func IsCygwinTerminal(fd uintptr) bool { if procGetFileInformationByHandleEx == nil { name, err := getFileNameByHandle(fd) if err != nil { return false } return isCygwinPipeName(name) } // 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]))) }
go
MIT
f4fc3669ca8eb67aa350a76503397192bf26f057
2026-01-07T08:35:43.570558Z
false
jesseduffield/lazydocker
https://github.com/jesseduffield/lazydocker/blob/f4fc3669ca8eb67aa350a76503397192bf26f057/vendor/github.com/mattn/go-isatty/isatty_solaris.go
vendor/github.com/mattn/go-isatty/isatty_solaris.go
// +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 } // 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 }
go
MIT
f4fc3669ca8eb67aa350a76503397192bf26f057
2026-01-07T08:35:43.570558Z
false
jesseduffield/lazydocker
https://github.com/jesseduffield/lazydocker/blob/f4fc3669ca8eb67aa350a76503397192bf26f057/vendor/github.com/mattn/go-isatty/isatty_plan9.go
vendor/github.com/mattn/go-isatty/isatty_plan9.go
// +build plan9 package isatty import ( "syscall" ) // IsTerminal returns true if the given file descriptor is a terminal. func IsTerminal(fd uintptr) bool { path, err := syscall.Fd2path(int(fd)) if err != nil { return false } return path == "/dev/cons" || path == "/mnt/term/dev/cons" } // 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 }
go
MIT
f4fc3669ca8eb67aa350a76503397192bf26f057
2026-01-07T08:35:43.570558Z
false
jesseduffield/lazydocker
https://github.com/jesseduffield/lazydocker/blob/f4fc3669ca8eb67aa350a76503397192bf26f057/vendor/github.com/mattn/go-isatty/isatty_others.go
vendor/github.com/mattn/go-isatty/isatty_others.go
// +build appengine js nacl package isatty // IsTerminal returns true if the file descriptor is terminal which // is always false on js and 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 }
go
MIT
f4fc3669ca8eb67aa350a76503397192bf26f057
2026-01-07T08:35:43.570558Z
false
jesseduffield/lazydocker
https://github.com/jesseduffield/lazydocker/blob/f4fc3669ca8eb67aa350a76503397192bf26f057/vendor/github.com/mattn/go-isatty/doc.go
vendor/github.com/mattn/go-isatty/doc.go
// Package isatty implements interface to isatty package isatty
go
MIT
f4fc3669ca8eb67aa350a76503397192bf26f057
2026-01-07T08:35:43.570558Z
false
jesseduffield/lazydocker
https://github.com/jesseduffield/lazydocker/blob/f4fc3669ca8eb67aa350a76503397192bf26f057/vendor/github.com/mattn/go-isatty/isatty_tcgets.go
vendor/github.com/mattn/go-isatty/isatty_tcgets.go
// +build linux aix // +build !appengine package isatty import "golang.org/x/sys/unix" // IsTerminal return true if the file descriptor is terminal. func IsTerminal(fd uintptr) bool { _, err := unix.IoctlGetTermios(int(fd), unix.TCGETS) return err == nil } // 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 }
go
MIT
f4fc3669ca8eb67aa350a76503397192bf26f057
2026-01-07T08:35:43.570558Z
false
jesseduffield/lazydocker
https://github.com/jesseduffield/lazydocker/blob/f4fc3669ca8eb67aa350a76503397192bf26f057/vendor/github.com/sirupsen/logrus/terminal_check_solaris.go
vendor/github.com/sirupsen/logrus/terminal_check_solaris.go
package logrus import ( "golang.org/x/sys/unix" ) // IsTerminal returns true if the given file descriptor is a terminal. func isTerminal(fd int) bool { _, err := unix.IoctlGetTermio(fd, unix.TCGETA) return err == nil }
go
MIT
f4fc3669ca8eb67aa350a76503397192bf26f057
2026-01-07T08:35:43.570558Z
false
jesseduffield/lazydocker
https://github.com/jesseduffield/lazydocker/blob/f4fc3669ca8eb67aa350a76503397192bf26f057/vendor/github.com/sirupsen/logrus/terminal_check_js.go
vendor/github.com/sirupsen/logrus/terminal_check_js.go
// +build js package logrus func isTerminal(fd int) bool { return false }
go
MIT
f4fc3669ca8eb67aa350a76503397192bf26f057
2026-01-07T08:35:43.570558Z
false
jesseduffield/lazydocker
https://github.com/jesseduffield/lazydocker/blob/f4fc3669ca8eb67aa350a76503397192bf26f057/vendor/github.com/sirupsen/logrus/terminal_check_appengine.go
vendor/github.com/sirupsen/logrus/terminal_check_appengine.go
// +build appengine package logrus import ( "io" ) func checkIfTerminal(w io.Writer) bool { return true }
go
MIT
f4fc3669ca8eb67aa350a76503397192bf26f057
2026-01-07T08:35:43.570558Z
false
jesseduffield/lazydocker
https://github.com/jesseduffield/lazydocker/blob/f4fc3669ca8eb67aa350a76503397192bf26f057/vendor/github.com/sirupsen/logrus/entry.go
vendor/github.com/sirupsen/logrus/entry.go
package logrus import ( "bytes" "context" "fmt" "os" "reflect" "runtime" "strings" "sync" "time" ) var ( // qualified package name, cached at first use logrusPackage string // Positions in the call stack when tracing to report the calling method minimumCallerDepth int // Used for caller information initialisation callerInitOnce sync.Once ) const ( maximumCallerDepth int = 25 knownLogrusFrames int = 4 ) func init() { // start at the bottom of the stack before the package-name cache is primed minimumCallerDepth = 1 } // Defines the key when adding errors using WithError. var ErrorKey = "error" // An entry is the final or intermediate Logrus logging entry. It contains all // the fields passed with WithField{,s}. It's finally logged when Trace, Debug, // Info, Warn, Error, Fatal or Panic is called on it. These objects can be // reused and passed around as much as you wish to avoid field duplication. type Entry struct { Logger *Logger // Contains all the fields set by the user. Data Fields // Time at which the log entry was created Time time.Time // Level the log entry was logged at: Trace, Debug, Info, Warn, Error, Fatal or Panic // This field will be set on entry firing and the value will be equal to the one in Logger struct field. Level Level // Calling method, with package name Caller *runtime.Frame // Message passed to Trace, Debug, Info, Warn, Error, Fatal or Panic Message string // When formatter is called in entry.log(), a Buffer may be set to entry Buffer *bytes.Buffer // Contains the context set by the user. Useful for hook processing etc. Context context.Context // err may contain a field formatting error err string } func NewEntry(logger *Logger) *Entry { return &Entry{ Logger: logger, // Default is three fields, plus one optional. Give a little extra room. Data: make(Fields, 6), } } func (entry *Entry) Dup() *Entry { data := make(Fields, len(entry.Data)) for k, v := range entry.Data { data[k] = v } return &Entry{Logger: entry.Logger, Data: data, Time: entry.Time, Context: entry.Context, err: entry.err} } // Returns the bytes representation of this entry from the formatter. func (entry *Entry) Bytes() ([]byte, error) { return entry.Logger.Formatter.Format(entry) } // Returns the string representation from the reader and ultimately the // formatter. func (entry *Entry) String() (string, error) { serialized, err := entry.Bytes() if err != nil { return "", err } str := string(serialized) return str, nil } // Add an error as single field (using the key defined in ErrorKey) to the Entry. func (entry *Entry) WithError(err error) *Entry { return entry.WithField(ErrorKey, err) } // Add a context to the Entry. func (entry *Entry) WithContext(ctx context.Context) *Entry { dataCopy := make(Fields, len(entry.Data)) for k, v := range entry.Data { dataCopy[k] = v } return &Entry{Logger: entry.Logger, Data: dataCopy, Time: entry.Time, err: entry.err, Context: ctx} } // Add a single field to the Entry. func (entry *Entry) WithField(key string, value interface{}) *Entry { return entry.WithFields(Fields{key: value}) } // Add a map of fields to the Entry. func (entry *Entry) WithFields(fields Fields) *Entry { data := make(Fields, len(entry.Data)+len(fields)) for k, v := range entry.Data { data[k] = v } fieldErr := entry.err for k, v := range fields { isErrField := false if t := reflect.TypeOf(v); t != nil { switch { case t.Kind() == reflect.Func, t.Kind() == reflect.Ptr && t.Elem().Kind() == reflect.Func: isErrField = true } } if isErrField { tmp := fmt.Sprintf("can not add field %q", k) if fieldErr != "" { fieldErr = entry.err + ", " + tmp } else { fieldErr = tmp } } else { data[k] = v } } return &Entry{Logger: entry.Logger, Data: data, Time: entry.Time, err: fieldErr, Context: entry.Context} } // Overrides the time of the Entry. func (entry *Entry) WithTime(t time.Time) *Entry { dataCopy := make(Fields, len(entry.Data)) for k, v := range entry.Data { dataCopy[k] = v } return &Entry{Logger: entry.Logger, Data: dataCopy, Time: t, err: entry.err, Context: entry.Context} } // getPackageName reduces a fully qualified function name to the package name // There really ought to be to be a better way... func getPackageName(f string) string { for { lastPeriod := strings.LastIndex(f, ".") lastSlash := strings.LastIndex(f, "/") if lastPeriod > lastSlash { f = f[:lastPeriod] } else { break } } return f } // getCaller retrieves the name of the first non-logrus calling function func getCaller() *runtime.Frame { // cache this package's fully-qualified name callerInitOnce.Do(func() { pcs := make([]uintptr, maximumCallerDepth) _ = runtime.Callers(0, pcs) // dynamic get the package name and the minimum caller depth for i := 0; i < maximumCallerDepth; i++ { funcName := runtime.FuncForPC(pcs[i]).Name() if strings.Contains(funcName, "getCaller") { logrusPackage = getPackageName(funcName) break } } minimumCallerDepth = knownLogrusFrames }) // Restrict the lookback frames to avoid runaway lookups pcs := make([]uintptr, maximumCallerDepth) depth := runtime.Callers(minimumCallerDepth, pcs) frames := runtime.CallersFrames(pcs[:depth]) for f, again := frames.Next(); again; f, again = frames.Next() { pkg := getPackageName(f.Function) // If the caller isn't part of this package, we're done if pkg != logrusPackage { return &f //nolint:scopelint } } // if we got here, we failed to find the caller's context return nil } func (entry Entry) HasCaller() (has bool) { return entry.Logger != nil && entry.Logger.ReportCaller && entry.Caller != nil } func (entry *Entry) log(level Level, msg string) { var buffer *bytes.Buffer newEntry := entry.Dup() if newEntry.Time.IsZero() { newEntry.Time = time.Now() } newEntry.Level = level newEntry.Message = msg newEntry.Logger.mu.Lock() reportCaller := newEntry.Logger.ReportCaller bufPool := newEntry.getBufferPool() newEntry.Logger.mu.Unlock() if reportCaller { newEntry.Caller = getCaller() } newEntry.fireHooks() buffer = bufPool.Get() defer func() { newEntry.Buffer = nil buffer.Reset() bufPool.Put(buffer) }() buffer.Reset() newEntry.Buffer = buffer newEntry.write() newEntry.Buffer = nil // To avoid Entry#log() returning a value that only would make sense for // panic() to use in Entry#Panic(), we avoid the allocation by checking // directly here. if level <= PanicLevel { panic(newEntry) } } func (entry *Entry) getBufferPool() (pool BufferPool) { if entry.Logger.BufferPool != nil { return entry.Logger.BufferPool } return bufferPool } func (entry *Entry) fireHooks() { var tmpHooks LevelHooks entry.Logger.mu.Lock() tmpHooks = make(LevelHooks, len(entry.Logger.Hooks)) for k, v := range entry.Logger.Hooks { tmpHooks[k] = v } entry.Logger.mu.Unlock() err := tmpHooks.Fire(entry.Level, entry) if err != nil { fmt.Fprintf(os.Stderr, "Failed to fire hook: %v\n", err) } } func (entry *Entry) write() { entry.Logger.mu.Lock() defer entry.Logger.mu.Unlock() serialized, err := entry.Logger.Formatter.Format(entry) if err != nil { fmt.Fprintf(os.Stderr, "Failed to obtain reader, %v\n", err) return } if _, err := entry.Logger.Out.Write(serialized); err != nil { fmt.Fprintf(os.Stderr, "Failed to write to log, %v\n", err) } } // Log will log a message at the level given as parameter. // Warning: using Log at Panic or Fatal level will not respectively Panic nor Exit. // For this behaviour Entry.Panic or Entry.Fatal should be used instead. func (entry *Entry) Log(level Level, args ...interface{}) { if entry.Logger.IsLevelEnabled(level) { entry.log(level, fmt.Sprint(args...)) } } func (entry *Entry) Trace(args ...interface{}) { entry.Log(TraceLevel, args...) } func (entry *Entry) Debug(args ...interface{}) { entry.Log(DebugLevel, args...) } func (entry *Entry) Print(args ...interface{}) { entry.Info(args...) } func (entry *Entry) Info(args ...interface{}) { entry.Log(InfoLevel, args...) } func (entry *Entry) Warn(args ...interface{}) { entry.Log(WarnLevel, args...) } func (entry *Entry) Warning(args ...interface{}) { entry.Warn(args...) } func (entry *Entry) Error(args ...interface{}) { entry.Log(ErrorLevel, args...) } func (entry *Entry) Fatal(args ...interface{}) { entry.Log(FatalLevel, args...) entry.Logger.Exit(1) } func (entry *Entry) Panic(args ...interface{}) { entry.Log(PanicLevel, args...) } // Entry Printf family functions func (entry *Entry) Logf(level Level, format string, args ...interface{}) { if entry.Logger.IsLevelEnabled(level) { entry.Log(level, fmt.Sprintf(format, args...)) } } func (entry *Entry) Tracef(format string, args ...interface{}) { entry.Logf(TraceLevel, format, args...) } func (entry *Entry) Debugf(format string, args ...interface{}) { entry.Logf(DebugLevel, format, args...) } func (entry *Entry) Infof(format string, args ...interface{}) { entry.Logf(InfoLevel, format, args...) } func (entry *Entry) Printf(format string, args ...interface{}) { entry.Infof(format, args...) } func (entry *Entry) Warnf(format string, args ...interface{}) { entry.Logf(WarnLevel, format, args...) } func (entry *Entry) Warningf(format string, args ...interface{}) { entry.Warnf(format, args...) } func (entry *Entry) Errorf(format string, args ...interface{}) { entry.Logf(ErrorLevel, format, args...) } func (entry *Entry) Fatalf(format string, args ...interface{}) { entry.Logf(FatalLevel, format, args...) entry.Logger.Exit(1) } func (entry *Entry) Panicf(format string, args ...interface{}) { entry.Logf(PanicLevel, format, args...) } // Entry Println family functions func (entry *Entry) Logln(level Level, args ...interface{}) { if entry.Logger.IsLevelEnabled(level) { entry.Log(level, entry.sprintlnn(args...)) } } func (entry *Entry) Traceln(args ...interface{}) { entry.Logln(TraceLevel, args...) } func (entry *Entry) Debugln(args ...interface{}) { entry.Logln(DebugLevel, args...) } func (entry *Entry) Infoln(args ...interface{}) { entry.Logln(InfoLevel, args...) } func (entry *Entry) Println(args ...interface{}) { entry.Infoln(args...) } func (entry *Entry) Warnln(args ...interface{}) { entry.Logln(WarnLevel, args...) } func (entry *Entry) Warningln(args ...interface{}) { entry.Warnln(args...) } func (entry *Entry) Errorln(args ...interface{}) { entry.Logln(ErrorLevel, args...) } func (entry *Entry) Fatalln(args ...interface{}) { entry.Logln(FatalLevel, args...) entry.Logger.Exit(1) } func (entry *Entry) Panicln(args ...interface{}) { entry.Logln(PanicLevel, args...) } // Sprintlnn => Sprint no newline. This is to get the behavior of how // fmt.Sprintln where spaces are always added between operands, regardless of // their type. Instead of vendoring the Sprintln implementation to spare a // string allocation, we do the simplest thing. func (entry *Entry) sprintlnn(args ...interface{}) string { msg := fmt.Sprintln(args...) return msg[:len(msg)-1] }
go
MIT
f4fc3669ca8eb67aa350a76503397192bf26f057
2026-01-07T08:35:43.570558Z
false
jesseduffield/lazydocker
https://github.com/jesseduffield/lazydocker/blob/f4fc3669ca8eb67aa350a76503397192bf26f057/vendor/github.com/sirupsen/logrus/logrus.go
vendor/github.com/sirupsen/logrus/logrus.go
package logrus import ( "fmt" "log" "strings" ) // Fields type, used to pass to `WithFields`. type Fields map[string]interface{} // Level type type Level uint32 // Convert the Level to a string. E.g. PanicLevel becomes "panic". func (level Level) String() string { if b, err := level.MarshalText(); err == nil { return string(b) } else { return "unknown" } } // ParseLevel takes a string level and returns the Logrus log level constant. func ParseLevel(lvl string) (Level, error) { switch strings.ToLower(lvl) { case "panic": return PanicLevel, nil case "fatal": return FatalLevel, nil case "error": return ErrorLevel, nil case "warn", "warning": return WarnLevel, nil case "info": return InfoLevel, nil case "debug": return DebugLevel, nil case "trace": return TraceLevel, nil } var l Level return l, fmt.Errorf("not a valid logrus Level: %q", lvl) } // UnmarshalText implements encoding.TextUnmarshaler. func (level *Level) UnmarshalText(text []byte) error { l, err := ParseLevel(string(text)) if err != nil { return err } *level = l return nil } func (level Level) MarshalText() ([]byte, error) { switch level { case TraceLevel: return []byte("trace"), nil case DebugLevel: return []byte("debug"), nil case InfoLevel: return []byte("info"), nil case WarnLevel: return []byte("warning"), nil case ErrorLevel: return []byte("error"), nil case FatalLevel: return []byte("fatal"), nil case PanicLevel: return []byte("panic"), nil } return nil, fmt.Errorf("not a valid logrus level %d", level) } // A constant exposing all logging levels var AllLevels = []Level{ PanicLevel, FatalLevel, ErrorLevel, WarnLevel, InfoLevel, DebugLevel, TraceLevel, } // These are the different logging levels. You can set the logging level to log // on your instance of logger, obtained with `logrus.New()`. const ( // PanicLevel level, highest level of severity. Logs and then calls panic with the // message passed to Debug, Info, ... PanicLevel Level = iota // FatalLevel level. Logs and then calls `logger.Exit(1)`. It will exit even if the // logging level is set to Panic. FatalLevel // ErrorLevel level. Logs. Used for errors that should definitely be noted. // Commonly used for hooks to send errors to an error tracking service. ErrorLevel // WarnLevel level. Non-critical entries that deserve eyes. WarnLevel // InfoLevel level. General operational entries about what's going on inside the // application. InfoLevel // DebugLevel level. Usually only enabled when debugging. Very verbose logging. DebugLevel // TraceLevel level. Designates finer-grained informational events than the Debug. TraceLevel ) // Won't compile if StdLogger can't be realized by a log.Logger var ( _ StdLogger = &log.Logger{} _ StdLogger = &Entry{} _ StdLogger = &Logger{} ) // StdLogger is what your logrus-enabled library should take, that way // it'll accept a stdlib logger and a logrus logger. There's no standard // interface, this is the closest we get, unfortunately. type StdLogger interface { Print(...interface{}) Printf(string, ...interface{}) Println(...interface{}) Fatal(...interface{}) Fatalf(string, ...interface{}) Fatalln(...interface{}) Panic(...interface{}) Panicf(string, ...interface{}) Panicln(...interface{}) } // The FieldLogger interface generalizes the Entry and Logger types type FieldLogger interface { WithField(key string, value interface{}) *Entry WithFields(fields Fields) *Entry WithError(err error) *Entry Debugf(format string, args ...interface{}) Infof(format string, args ...interface{}) Printf(format string, args ...interface{}) Warnf(format string, args ...interface{}) Warningf(format string, args ...interface{}) Errorf(format string, args ...interface{}) Fatalf(format string, args ...interface{}) Panicf(format string, args ...interface{}) Debug(args ...interface{}) Info(args ...interface{}) Print(args ...interface{}) Warn(args ...interface{}) Warning(args ...interface{}) Error(args ...interface{}) Fatal(args ...interface{}) Panic(args ...interface{}) Debugln(args ...interface{}) Infoln(args ...interface{}) Println(args ...interface{}) Warnln(args ...interface{}) Warningln(args ...interface{}) Errorln(args ...interface{}) Fatalln(args ...interface{}) Panicln(args ...interface{}) // IsDebugEnabled() bool // IsInfoEnabled() bool // IsWarnEnabled() bool // IsErrorEnabled() bool // IsFatalEnabled() bool // IsPanicEnabled() bool } // Ext1FieldLogger (the first extension to FieldLogger) is superfluous, it is // here for consistancy. Do not use. Use Logger or Entry instead. type Ext1FieldLogger interface { FieldLogger Tracef(format string, args ...interface{}) Trace(args ...interface{}) Traceln(args ...interface{}) }
go
MIT
f4fc3669ca8eb67aa350a76503397192bf26f057
2026-01-07T08:35:43.570558Z
false
jesseduffield/lazydocker
https://github.com/jesseduffield/lazydocker/blob/f4fc3669ca8eb67aa350a76503397192bf26f057/vendor/github.com/sirupsen/logrus/terminal_check_no_terminal.go
vendor/github.com/sirupsen/logrus/terminal_check_no_terminal.go
// +build js nacl plan9 package logrus import ( "io" ) func checkIfTerminal(w io.Writer) bool { return false }
go
MIT
f4fc3669ca8eb67aa350a76503397192bf26f057
2026-01-07T08:35:43.570558Z
false
jesseduffield/lazydocker
https://github.com/jesseduffield/lazydocker/blob/f4fc3669ca8eb67aa350a76503397192bf26f057/vendor/github.com/sirupsen/logrus/writer.go
vendor/github.com/sirupsen/logrus/writer.go
package logrus import ( "bufio" "io" "runtime" "strings" ) // Writer at INFO level. See WriterLevel for details. func (logger *Logger) Writer() *io.PipeWriter { return logger.WriterLevel(InfoLevel) } // WriterLevel returns an io.Writer that can be used to write arbitrary text to // the logger at the given log level. Each line written to the writer will be // printed in the usual way using formatters and hooks. The writer is part of an // io.Pipe and it is the callers responsibility to close the writer when done. // This can be used to override the standard library logger easily. func (logger *Logger) WriterLevel(level Level) *io.PipeWriter { return NewEntry(logger).WriterLevel(level) } // Writer returns an io.Writer that writes to the logger at the info log level func (entry *Entry) Writer() *io.PipeWriter { return entry.WriterLevel(InfoLevel) } // WriterLevel returns an io.Writer that writes to the logger at the given log level func (entry *Entry) WriterLevel(level Level) *io.PipeWriter { reader, writer := io.Pipe() var printFunc func(args ...interface{}) // Determine which log function to use based on the specified log level switch level { case TraceLevel: printFunc = entry.Trace case DebugLevel: printFunc = entry.Debug case InfoLevel: printFunc = entry.Info case WarnLevel: printFunc = entry.Warn case ErrorLevel: printFunc = entry.Error case FatalLevel: printFunc = entry.Fatal case PanicLevel: printFunc = entry.Panic default: printFunc = entry.Print } // Start a new goroutine to scan the input and write it to the logger using the specified print function. // It splits the input into chunks of up to 64KB to avoid buffer overflows. go entry.writerScanner(reader, printFunc) // Set a finalizer function to close the writer when it is garbage collected runtime.SetFinalizer(writer, writerFinalizer) return writer } // writerScanner scans the input from the reader and writes it to the logger func (entry *Entry) writerScanner(reader *io.PipeReader, printFunc func(args ...interface{})) { scanner := bufio.NewScanner(reader) // Set the buffer size to the maximum token size to avoid buffer overflows scanner.Buffer(make([]byte, bufio.MaxScanTokenSize), bufio.MaxScanTokenSize) // Define a split function to split the input into chunks of up to 64KB chunkSize := bufio.MaxScanTokenSize // 64KB splitFunc := func(data []byte, atEOF bool) (int, []byte, error) { if len(data) >= chunkSize { return chunkSize, data[:chunkSize], nil } return bufio.ScanLines(data, atEOF) } // Use the custom split function to split the input scanner.Split(splitFunc) // Scan the input and write it to the logger using the specified print function for scanner.Scan() { printFunc(strings.TrimRight(scanner.Text(), "\r\n")) } // If there was an error while scanning the input, log an error if err := scanner.Err(); err != nil { entry.Errorf("Error while reading from Writer: %s", err) } // Close the reader when we are done reader.Close() } // WriterFinalizer is a finalizer function that closes then given writer when it is garbage collected func writerFinalizer(writer *io.PipeWriter) { writer.Close() }
go
MIT
f4fc3669ca8eb67aa350a76503397192bf26f057
2026-01-07T08:35:43.570558Z
false
jesseduffield/lazydocker
https://github.com/jesseduffield/lazydocker/blob/f4fc3669ca8eb67aa350a76503397192bf26f057/vendor/github.com/sirupsen/logrus/terminal_check_windows.go
vendor/github.com/sirupsen/logrus/terminal_check_windows.go
// +build !appengine,!js,windows package logrus import ( "io" "os" "golang.org/x/sys/windows" ) func checkIfTerminal(w io.Writer) bool { switch v := w.(type) { case *os.File: handle := windows.Handle(v.Fd()) var mode uint32 if err := windows.GetConsoleMode(handle, &mode); err != nil { return false } mode |= windows.ENABLE_VIRTUAL_TERMINAL_PROCESSING if err := windows.SetConsoleMode(handle, mode); err != nil { return false } return true } return false }
go
MIT
f4fc3669ca8eb67aa350a76503397192bf26f057
2026-01-07T08:35:43.570558Z
false
jesseduffield/lazydocker
https://github.com/jesseduffield/lazydocker/blob/f4fc3669ca8eb67aa350a76503397192bf26f057/vendor/github.com/sirupsen/logrus/formatter.go
vendor/github.com/sirupsen/logrus/formatter.go
package logrus import "time" // Default key names for the default fields const ( defaultTimestampFormat = time.RFC3339 FieldKeyMsg = "msg" FieldKeyLevel = "level" FieldKeyTime = "time" FieldKeyLogrusError = "logrus_error" FieldKeyFunc = "func" FieldKeyFile = "file" ) // The Formatter interface is used to implement a custom Formatter. It takes an // `Entry`. It exposes all the fields, including the default ones: // // * `entry.Data["msg"]`. The message passed from Info, Warn, Error .. // * `entry.Data["time"]`. The timestamp. // * `entry.Data["level"]. The level the entry was logged at. // // Any additional fields added with `WithField` or `WithFields` are also in // `entry.Data`. Format is expected to return an array of bytes which are then // logged to `logger.Out`. type Formatter interface { Format(*Entry) ([]byte, error) } // This is to not silently overwrite `time`, `msg`, `func` and `level` fields when // dumping it. If this code wasn't there doing: // // logrus.WithField("level", 1).Info("hello") // // Would just silently drop the user provided level. Instead with this code // it'll logged as: // // {"level": "info", "fields.level": 1, "msg": "hello", "time": "..."} // // It's not exported because it's still using Data in an opinionated way. It's to // avoid code duplication between the two default formatters. func prefixFieldClashes(data Fields, fieldMap FieldMap, reportCaller bool) { timeKey := fieldMap.resolve(FieldKeyTime) if t, ok := data[timeKey]; ok { data["fields."+timeKey] = t delete(data, timeKey) } msgKey := fieldMap.resolve(FieldKeyMsg) if m, ok := data[msgKey]; ok { data["fields."+msgKey] = m delete(data, msgKey) } levelKey := fieldMap.resolve(FieldKeyLevel) if l, ok := data[levelKey]; ok { data["fields."+levelKey] = l delete(data, levelKey) } logrusErrKey := fieldMap.resolve(FieldKeyLogrusError) if l, ok := data[logrusErrKey]; ok { data["fields."+logrusErrKey] = l delete(data, logrusErrKey) } // If reportCaller is not set, 'func' will not conflict. if reportCaller { funcKey := fieldMap.resolve(FieldKeyFunc) if l, ok := data[funcKey]; ok { data["fields."+funcKey] = l } fileKey := fieldMap.resolve(FieldKeyFile) if l, ok := data[fileKey]; ok { data["fields."+fileKey] = l } } }
go
MIT
f4fc3669ca8eb67aa350a76503397192bf26f057
2026-01-07T08:35:43.570558Z
false
jesseduffield/lazydocker
https://github.com/jesseduffield/lazydocker/blob/f4fc3669ca8eb67aa350a76503397192bf26f057/vendor/github.com/sirupsen/logrus/buffer_pool.go
vendor/github.com/sirupsen/logrus/buffer_pool.go
package logrus import ( "bytes" "sync" ) var ( bufferPool BufferPool ) type BufferPool interface { Put(*bytes.Buffer) Get() *bytes.Buffer } type defaultPool struct { pool *sync.Pool } func (p *defaultPool) Put(buf *bytes.Buffer) { p.pool.Put(buf) } func (p *defaultPool) Get() *bytes.Buffer { return p.pool.Get().(*bytes.Buffer) } // SetBufferPool allows to replace the default logrus buffer pool // to better meets the specific needs of an application. func SetBufferPool(bp BufferPool) { bufferPool = bp } func init() { SetBufferPool(&defaultPool{ pool: &sync.Pool{ New: func() interface{} { return new(bytes.Buffer) }, }, }) }
go
MIT
f4fc3669ca8eb67aa350a76503397192bf26f057
2026-01-07T08:35:43.570558Z
false
jesseduffield/lazydocker
https://github.com/jesseduffield/lazydocker/blob/f4fc3669ca8eb67aa350a76503397192bf26f057/vendor/github.com/sirupsen/logrus/alt_exit.go
vendor/github.com/sirupsen/logrus/alt_exit.go
package logrus // The following code was sourced and modified from the // https://github.com/tebeka/atexit package governed by the following license: // // Copyright (c) 2012 Miki Tebeka <miki.tebeka@gmail.com>. // // 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. import ( "fmt" "os" ) var handlers = []func(){} func runHandler(handler func()) { defer func() { if err := recover(); err != nil { fmt.Fprintln(os.Stderr, "Error: Logrus exit handler error:", err) } }() handler() } func runHandlers() { for _, handler := range handlers { runHandler(handler) } } // Exit runs all the Logrus atexit handlers and then terminates the program using os.Exit(code) func Exit(code int) { runHandlers() os.Exit(code) } // RegisterExitHandler appends a Logrus Exit handler to the list of handlers, // call logrus.Exit to invoke all handlers. The handlers will also be invoked when // any Fatal log entry is made. // // This method is useful when a caller wishes to use logrus to log a fatal // message but also needs to gracefully shutdown. An example usecase could be // closing database connections, or sending a alert that the application is // closing. func RegisterExitHandler(handler func()) { handlers = append(handlers, handler) } // DeferExitHandler prepends a Logrus Exit handler to the list of handlers, // call logrus.Exit to invoke all handlers. The handlers will also be invoked when // any Fatal log entry is made. // // This method is useful when a caller wishes to use logrus to log a fatal // message but also needs to gracefully shutdown. An example usecase could be // closing database connections, or sending a alert that the application is // closing. func DeferExitHandler(handler func()) { handlers = append([]func(){handler}, handlers...) }
go
MIT
f4fc3669ca8eb67aa350a76503397192bf26f057
2026-01-07T08:35:43.570558Z
false
jesseduffield/lazydocker
https://github.com/jesseduffield/lazydocker/blob/f4fc3669ca8eb67aa350a76503397192bf26f057/vendor/github.com/sirupsen/logrus/hooks.go
vendor/github.com/sirupsen/logrus/hooks.go
package logrus // A hook to be fired when logging on the logging levels returned from // `Levels()` on your implementation of the interface. Note that this is not // fired in a goroutine or a channel with workers, you should handle such // functionality yourself if your call is non-blocking and you don't wish for // the logging calls for levels returned from `Levels()` to block. type Hook interface { Levels() []Level Fire(*Entry) error } // Internal type for storing the hooks on a logger instance. type LevelHooks map[Level][]Hook // Add a hook to an instance of logger. This is called with // `log.Hooks.Add(new(MyHook))` where `MyHook` implements the `Hook` interface. func (hooks LevelHooks) Add(hook Hook) { for _, level := range hook.Levels() { hooks[level] = append(hooks[level], hook) } } // Fire all the hooks for the passed level. Used by `entry.log` to fire // appropriate hooks for a log entry. func (hooks LevelHooks) Fire(level Level, entry *Entry) error { for _, hook := range hooks[level] { if err := hook.Fire(entry); err != nil { return err } } return nil }
go
MIT
f4fc3669ca8eb67aa350a76503397192bf26f057
2026-01-07T08:35:43.570558Z
false
jesseduffield/lazydocker
https://github.com/jesseduffield/lazydocker/blob/f4fc3669ca8eb67aa350a76503397192bf26f057/vendor/github.com/sirupsen/logrus/terminal_check_bsd.go
vendor/github.com/sirupsen/logrus/terminal_check_bsd.go
// +build darwin dragonfly freebsd netbsd openbsd // +build !js package logrus import "golang.org/x/sys/unix" const ioctlReadTermios = unix.TIOCGETA func isTerminal(fd int) bool { _, err := unix.IoctlGetTermios(fd, ioctlReadTermios) return err == nil }
go
MIT
f4fc3669ca8eb67aa350a76503397192bf26f057
2026-01-07T08:35:43.570558Z
false
jesseduffield/lazydocker
https://github.com/jesseduffield/lazydocker/blob/f4fc3669ca8eb67aa350a76503397192bf26f057/vendor/github.com/sirupsen/logrus/terminal_check_unix.go
vendor/github.com/sirupsen/logrus/terminal_check_unix.go
// +build linux aix zos // +build !js package logrus import "golang.org/x/sys/unix" const ioctlReadTermios = unix.TCGETS func isTerminal(fd int) bool { _, err := unix.IoctlGetTermios(fd, ioctlReadTermios) return err == nil }
go
MIT
f4fc3669ca8eb67aa350a76503397192bf26f057
2026-01-07T08:35:43.570558Z
false