mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-11-23 22:24:51 +02:00
some refactoring in anticipation of the graph feature
This commit is contained in:
172
vendor/github.com/jesseduffield/gocui/gui.go
generated
vendored
172
vendor/github.com/jesseduffield/gocui/gui.go
generated
vendored
@@ -6,7 +6,6 @@ package gocui
|
||||
|
||||
import (
|
||||
standardErrors "errors"
|
||||
"fmt"
|
||||
"log"
|
||||
"runtime"
|
||||
"strings"
|
||||
@@ -76,6 +75,8 @@ type GuiMutexes struct {
|
||||
tickingMutex sync.Mutex
|
||||
|
||||
ViewsMutex sync.Mutex
|
||||
|
||||
drawMutex sync.Mutex
|
||||
}
|
||||
|
||||
type PlayMode int
|
||||
@@ -166,14 +167,14 @@ type Gui struct {
|
||||
}
|
||||
|
||||
// NewGui returns a new Gui object with a given output mode.
|
||||
func NewGui(mode OutputMode, supportOverlaps bool, playMode PlayMode, headless bool) (*Gui, error) {
|
||||
func NewGui(mode OutputMode, supportOverlaps bool, playMode PlayMode, headless bool, runeReplacements map[rune]string) (*Gui, error) {
|
||||
g := &Gui{}
|
||||
|
||||
var err error
|
||||
if headless {
|
||||
err = g.tcellInitSimulation()
|
||||
} else {
|
||||
err = g.tcellInit()
|
||||
err = g.tcellInit(runeReplacements)
|
||||
}
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@@ -664,79 +665,6 @@ func (g *Gui) onResize() {
|
||||
// g.screen.Sync()
|
||||
}
|
||||
|
||||
// flush updates the gui, re-drawing frames and buffers.
|
||||
func (g *Gui) flush() error {
|
||||
// pretty sure we don't need this, but keeping it here in case we get weird visual artifacts
|
||||
// g.clear(g.FgColor, g.BgColor)
|
||||
|
||||
maxX, maxY := Screen.Size()
|
||||
// if GUI's size has changed, we need to redraw all views
|
||||
if maxX != g.maxX || maxY != g.maxY {
|
||||
for _, v := range g.views {
|
||||
v.clearViewLines()
|
||||
}
|
||||
}
|
||||
g.maxX, g.maxY = maxX, maxY
|
||||
|
||||
for _, m := range g.managers {
|
||||
if err := m.Layout(g); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
for _, v := range g.views {
|
||||
if !v.Visible || v.y1 < v.y0 {
|
||||
continue
|
||||
}
|
||||
if v.Frame {
|
||||
var fgColor, bgColor, frameColor Attribute
|
||||
if g.Highlight && v == g.currentView {
|
||||
fgColor = g.SelFgColor
|
||||
bgColor = g.SelBgColor
|
||||
frameColor = g.SelFrameColor
|
||||
} else {
|
||||
bgColor = g.BgColor
|
||||
if v.TitleColor != ColorDefault {
|
||||
fgColor = v.TitleColor
|
||||
} else {
|
||||
fgColor = g.FgColor
|
||||
}
|
||||
if v.FrameColor != ColorDefault {
|
||||
frameColor = v.FrameColor
|
||||
} else {
|
||||
frameColor = g.FrameColor
|
||||
}
|
||||
}
|
||||
|
||||
if err := g.drawFrameEdges(v, frameColor, bgColor); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := g.drawFrameCorners(v, frameColor, bgColor); err != nil {
|
||||
return err
|
||||
}
|
||||
if v.Title != "" || len(v.Tabs) > 0 {
|
||||
if err := g.drawTitle(v, fgColor, bgColor); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
if v.Subtitle != "" {
|
||||
if err := g.drawSubtitle(v, fgColor, bgColor); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
if v.ContainsList && g.ShowListFooter {
|
||||
if err := g.drawListFooter(v, fgColor, bgColor); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
}
|
||||
if err := g.draw(v); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
Screen.Show()
|
||||
return nil
|
||||
}
|
||||
|
||||
func (g *Gui) clear(fg, bg Attribute) (int, int) {
|
||||
st := getTcellStyle(oldStyle{fg: fg, bg: bg, outputMode: g.outputMode})
|
||||
w, h := Screen.Size()
|
||||
@@ -983,7 +911,7 @@ func (g *Gui) drawListFooter(v *View, fgColor, bgColor Attribute) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
message := fmt.Sprintf("%d of %d", v.cy+v.oy+1, len(v.lines))
|
||||
message := v.Footer
|
||||
|
||||
if v.y1 < 0 || v.y1 >= g.maxY {
|
||||
return nil
|
||||
@@ -1006,12 +934,102 @@ func (g *Gui) drawListFooter(v *View, fgColor, bgColor Attribute) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// flush updates the gui, re-drawing frames and buffers.
|
||||
func (g *Gui) flush() error {
|
||||
g.Mutexes.drawMutex.Lock()
|
||||
defer g.Mutexes.drawMutex.Unlock()
|
||||
|
||||
// pretty sure we don't need this, but keeping it here in case we get weird visual artifacts
|
||||
// g.clear(g.FgColor, g.BgColor)
|
||||
|
||||
maxX, maxY := Screen.Size()
|
||||
// if GUI's size has changed, we need to redraw all views
|
||||
if maxX != g.maxX || maxY != g.maxY {
|
||||
for _, v := range g.views {
|
||||
v.clearViewLines()
|
||||
}
|
||||
}
|
||||
g.maxX, g.maxY = maxX, maxY
|
||||
|
||||
for _, m := range g.managers {
|
||||
if err := m.Layout(g); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
for _, v := range g.views {
|
||||
if err := g.draw(v); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
Screen.Show()
|
||||
return nil
|
||||
}
|
||||
|
||||
func (g *Gui) Draw(v *View) error {
|
||||
g.Mutexes.drawMutex.Lock()
|
||||
defer g.Mutexes.drawMutex.Unlock()
|
||||
|
||||
if err := g.draw(v); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
Screen.Show()
|
||||
return nil
|
||||
}
|
||||
|
||||
// draw manages the cursor and calls the draw function of a view.
|
||||
func (g *Gui) draw(v *View) error {
|
||||
if g.suspended {
|
||||
return nil
|
||||
}
|
||||
|
||||
if !v.Visible || v.y1 < v.y0 {
|
||||
return nil
|
||||
}
|
||||
if v.Frame {
|
||||
var fgColor, bgColor, frameColor Attribute
|
||||
if g.Highlight && v == g.currentView {
|
||||
fgColor = g.SelFgColor
|
||||
bgColor = g.SelBgColor
|
||||
frameColor = g.SelFrameColor
|
||||
} else {
|
||||
bgColor = g.BgColor
|
||||
if v.TitleColor != ColorDefault {
|
||||
fgColor = v.TitleColor
|
||||
} else {
|
||||
fgColor = g.FgColor
|
||||
}
|
||||
if v.FrameColor != ColorDefault {
|
||||
frameColor = v.FrameColor
|
||||
} else {
|
||||
frameColor = g.FrameColor
|
||||
}
|
||||
}
|
||||
|
||||
if err := g.drawFrameEdges(v, frameColor, bgColor); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := g.drawFrameCorners(v, frameColor, bgColor); err != nil {
|
||||
return err
|
||||
}
|
||||
if v.Title != "" || len(v.Tabs) > 0 {
|
||||
if err := g.drawTitle(v, fgColor, bgColor); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
if v.Subtitle != "" {
|
||||
if err := g.drawSubtitle(v, fgColor, bgColor); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
if v.Footer != "" && g.ShowListFooter {
|
||||
if err := g.drawListFooter(v, fgColor, bgColor); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if g.Cursor {
|
||||
if curview := g.currentView; curview != nil {
|
||||
vMaxX, vMaxY := curview.Size()
|
||||
|
||||
17
vendor/github.com/jesseduffield/gocui/tcell_driver.go
generated
vendored
17
vendor/github.com/jesseduffield/gocui/tcell_driver.go
generated
vendored
@@ -26,6 +26,10 @@ var runeReplacements = map[rune]string{
|
||||
'┐': "+",
|
||||
'└': "+",
|
||||
'┘': "+",
|
||||
'╭': "+",
|
||||
'╮': "+",
|
||||
'╰': "+",
|
||||
'╯': "+",
|
||||
'─': "-",
|
||||
|
||||
// using a hyphen here actually looks weird.
|
||||
@@ -33,6 +37,9 @@ var runeReplacements = map[rune]string{
|
||||
'╶': " ",
|
||||
'╴': " ",
|
||||
|
||||
'┴': "+",
|
||||
'┬': "+",
|
||||
'╷': "|",
|
||||
'├': "+",
|
||||
'│': "|",
|
||||
'▼': "v",
|
||||
@@ -42,7 +49,7 @@ var runeReplacements = map[rune]string{
|
||||
}
|
||||
|
||||
// tcellInit initializes tcell screen for use.
|
||||
func (g *Gui) tcellInit() error {
|
||||
func (g *Gui) tcellInit(runeReplacements map[rune]string) error {
|
||||
runewidth.DefaultCondition.EastAsianWidth = false
|
||||
tcell.SetEncodingFallback(tcell.EncodingFallbackASCII)
|
||||
|
||||
@@ -51,7 +58,7 @@ func (g *Gui) tcellInit() error {
|
||||
} else if e = s.Init(); e != nil {
|
||||
return e
|
||||
} else {
|
||||
registerRuneFallbacks(s)
|
||||
registerRuneFallbacks(s, runeReplacements)
|
||||
|
||||
g.screen = s
|
||||
Screen = s
|
||||
@@ -59,10 +66,14 @@ func (g *Gui) tcellInit() error {
|
||||
}
|
||||
}
|
||||
|
||||
func registerRuneFallbacks(s tcell.Screen) {
|
||||
func registerRuneFallbacks(s tcell.Screen, additional map[rune]string) {
|
||||
for before, after := range runeReplacements {
|
||||
s.RegisterRuneFallback(before, after)
|
||||
}
|
||||
|
||||
for before, after := range additional {
|
||||
s.RegisterRuneFallback(before, after)
|
||||
}
|
||||
}
|
||||
|
||||
// tcellInitSimulation initializes tcell screen for use.
|
||||
|
||||
69
vendor/github.com/jesseduffield/gocui/view.go
generated
vendored
69
vendor/github.com/jesseduffield/gocui/view.go
generated
vendored
@@ -153,14 +153,14 @@ type View struct {
|
||||
|
||||
searcher *searcher
|
||||
|
||||
// when ContainsList is true, we show the current index and total count in the view
|
||||
ContainsList bool
|
||||
|
||||
// KeybindOnEdit should be set to true when you want to execute keybindings even when the view is editable
|
||||
// (this is usually not the case)
|
||||
KeybindOnEdit bool
|
||||
|
||||
TextArea *TextArea
|
||||
|
||||
// something like '1 of 20' for a list view
|
||||
Footer string
|
||||
}
|
||||
|
||||
// call this in the event of a view resize, or if you want to render new content
|
||||
@@ -372,11 +372,21 @@ func (v *View) Height() int {
|
||||
|
||||
// if a view has a frame, that leaves less space for its writeable area
|
||||
func (v *View) InnerWidth() int {
|
||||
return v.Width() - v.frameOffset()
|
||||
innerWidth := v.Width() - v.frameOffset()
|
||||
if innerWidth < 0 {
|
||||
return 0
|
||||
}
|
||||
|
||||
return innerWidth
|
||||
}
|
||||
|
||||
func (v *View) InnerHeight() int {
|
||||
return v.Height() - v.frameOffset()
|
||||
innerHeight := v.Height() - v.frameOffset()
|
||||
if innerHeight < 0 {
|
||||
return 0
|
||||
}
|
||||
|
||||
return innerHeight
|
||||
}
|
||||
|
||||
func (v *View) frameOffset() int {
|
||||
@@ -563,8 +573,6 @@ func (v *View) Write(p []byte) (n int, err error) {
|
||||
v.writeMutex.Lock()
|
||||
defer v.writeMutex.Unlock()
|
||||
|
||||
v.tainted = true
|
||||
v.makeWriteable(v.wx, v.wy)
|
||||
v.writeRunes(bytes.Runes(p))
|
||||
|
||||
return len(p), nil
|
||||
@@ -574,20 +582,16 @@ func (v *View) WriteRunes(p []rune) {
|
||||
v.writeMutex.Lock()
|
||||
defer v.writeMutex.Unlock()
|
||||
|
||||
v.writeRunes(p)
|
||||
}
|
||||
|
||||
// writeRunes copies slice of runes into internal lines buffer.
|
||||
func (v *View) writeRunes(p []rune) {
|
||||
v.tainted = true
|
||||
|
||||
// Fill with empty cells, if writing outside current view buffer
|
||||
v.makeWriteable(v.wx, v.wy)
|
||||
v.writeRunes(p)
|
||||
}
|
||||
|
||||
func (v *View) WriteString(s string) {
|
||||
v.WriteRunes([]rune(s))
|
||||
}
|
||||
|
||||
// writeRunes copies slice of runes into internal lines buffer.
|
||||
// caller must make sure that writing position is accessable.
|
||||
func (v *View) writeRunes(p []rune) {
|
||||
for _, r := range p {
|
||||
switch r {
|
||||
case '\n':
|
||||
@@ -613,6 +617,16 @@ func (v *View) writeRunes(p []rune) {
|
||||
}
|
||||
}
|
||||
|
||||
// exported functions use the mutex. Non-exported functions are for internal use
|
||||
// and a calling function should use a mutex
|
||||
func (v *View) WriteString(s string) {
|
||||
v.WriteRunes([]rune(s))
|
||||
}
|
||||
|
||||
func (v *View) writeString(s string) {
|
||||
v.writeRunes([]rune(s))
|
||||
}
|
||||
|
||||
// parseInput parses char by char the input written to the View. It returns nil
|
||||
// while processing ESC sequences. Otherwise, it returns a cell slice that
|
||||
// contains the processed data.
|
||||
@@ -696,16 +710,28 @@ func (v *View) Read(p []byte) (n int, err error) {
|
||||
return offset, io.EOF
|
||||
}
|
||||
|
||||
// only use this if the calling function has a lock on writeMutex
|
||||
func (v *View) clear() {
|
||||
v.rewind()
|
||||
v.lines = nil
|
||||
v.clearViewLines()
|
||||
}
|
||||
|
||||
// Clear empties the view's internal buffer.
|
||||
// And resets reading and writing offsets.
|
||||
func (v *View) Clear() {
|
||||
v.writeMutex.Lock()
|
||||
defer v.writeMutex.Unlock()
|
||||
|
||||
v.rewind()
|
||||
v.lines = nil
|
||||
v.clearViewLines()
|
||||
v.clearRunes()
|
||||
v.clear()
|
||||
}
|
||||
|
||||
func (v *View) SetContent(str string) {
|
||||
v.writeMutex.Lock()
|
||||
defer v.writeMutex.Unlock()
|
||||
|
||||
v.clear()
|
||||
v.writeString(str)
|
||||
}
|
||||
|
||||
// Rewind sets read and write pos to (0, 0).
|
||||
@@ -802,6 +828,9 @@ func (v *View) IsTainted() bool {
|
||||
|
||||
// draw re-draws the view's contents.
|
||||
func (v *View) draw() error {
|
||||
v.writeMutex.Lock()
|
||||
defer v.writeMutex.Unlock()
|
||||
|
||||
v.clearRunes()
|
||||
|
||||
if !v.Visible {
|
||||
|
||||
2
vendor/github.com/mattn/go-colorable/README.md
generated
vendored
2
vendor/github.com/mattn/go-colorable/README.md
generated
vendored
@@ -1,6 +1,6 @@
|
||||
# go-colorable
|
||||
|
||||
[](https://travis-ci.org/mattn/go-colorable)
|
||||
[](https://github.com/mattn/go-colorable/actions?query=workflow%3Atest)
|
||||
[](https://codecov.io/gh/mattn/go-colorable)
|
||||
[](http://godoc.org/github.com/mattn/go-colorable)
|
||||
[](https://goreportcard.com/report/mattn/go-colorable)
|
||||
|
||||
1
vendor/github.com/mattn/go-colorable/colorable_appengine.go
generated
vendored
1
vendor/github.com/mattn/go-colorable/colorable_appengine.go
generated
vendored
@@ -1,3 +1,4 @@
|
||||
//go:build appengine
|
||||
// +build appengine
|
||||
|
||||
package colorable
|
||||
|
||||
4
vendor/github.com/mattn/go-colorable/colorable_others.go
generated
vendored
4
vendor/github.com/mattn/go-colorable/colorable_others.go
generated
vendored
@@ -1,5 +1,5 @@
|
||||
// +build !windows
|
||||
// +build !appengine
|
||||
//go:build !windows && !appengine
|
||||
// +build !windows,!appengine
|
||||
|
||||
package colorable
|
||||
|
||||
|
||||
18
vendor/github.com/mattn/go-colorable/colorable_windows.go
generated
vendored
18
vendor/github.com/mattn/go-colorable/colorable_windows.go
generated
vendored
@@ -1,5 +1,5 @@
|
||||
// +build windows
|
||||
// +build !appengine
|
||||
//go:build windows && !appengine
|
||||
// +build windows,!appengine
|
||||
|
||||
package colorable
|
||||
|
||||
@@ -452,18 +452,22 @@ func (w *Writer) Write(data []byte) (n int, err error) {
|
||||
} else {
|
||||
er = bytes.NewReader(data)
|
||||
}
|
||||
var bw [1]byte
|
||||
var plaintext bytes.Buffer
|
||||
loop:
|
||||
for {
|
||||
c1, err := er.ReadByte()
|
||||
if err != nil {
|
||||
plaintext.WriteTo(w.out)
|
||||
break loop
|
||||
}
|
||||
if c1 != 0x1b {
|
||||
bw[0] = c1
|
||||
w.out.Write(bw[:])
|
||||
plaintext.WriteByte(c1)
|
||||
continue
|
||||
}
|
||||
_, err = plaintext.WriteTo(w.out)
|
||||
if err != nil {
|
||||
break loop
|
||||
}
|
||||
c2, err := er.ReadByte()
|
||||
if err != nil {
|
||||
break loop
|
||||
@@ -719,7 +723,7 @@ loop:
|
||||
n256setup()
|
||||
}
|
||||
attr &= backgroundMask
|
||||
attr |= n256foreAttr[n256]
|
||||
attr |= n256foreAttr[n256%len(n256foreAttr)]
|
||||
i += 2
|
||||
}
|
||||
} else if len(token) == 5 && token[i+1] == "2" {
|
||||
@@ -761,7 +765,7 @@ loop:
|
||||
n256setup()
|
||||
}
|
||||
attr &= foregroundMask
|
||||
attr |= n256backAttr[n256]
|
||||
attr |= n256backAttr[n256%len(n256backAttr)]
|
||||
i += 2
|
||||
}
|
||||
} else if len(token) == 5 && token[i+1] == "2" {
|
||||
|
||||
4
vendor/github.com/mattn/go-colorable/go.mod
generated
vendored
4
vendor/github.com/mattn/go-colorable/go.mod
generated
vendored
@@ -1,8 +1,8 @@
|
||||
module github.com/mattn/go-colorable
|
||||
|
||||
require (
|
||||
github.com/mattn/go-isatty v0.0.12
|
||||
golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae // indirect
|
||||
github.com/mattn/go-isatty v0.0.14
|
||||
golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6 // indirect
|
||||
)
|
||||
|
||||
go 1.13
|
||||
|
||||
10
vendor/github.com/mattn/go-colorable/go.sum
generated
vendored
10
vendor/github.com/mattn/go-colorable/go.sum
generated
vendored
@@ -1,5 +1,5 @@
|
||||
github.com/mattn/go-isatty v0.0.12 h1:wuysRhFDzyxgEmMf5xjvJ2M9dZoWAXNNr5LSBS7uHXY=
|
||||
github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU=
|
||||
golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae h1:/WDfKMnPU+m5M4xB+6x4kaepxRw6jWvR5iDRdvjHgy8=
|
||||
golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
github.com/mattn/go-isatty v0.0.14 h1:yVuAays6BHfxijgZPzw+3Zlu5yQgKGP2/hcQbHb7S9Y=
|
||||
github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94=
|
||||
golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6 h1:foEbQz/B0Oz6YIqu/69kfXPYeFQAuuMYFkjaqXzl5Wo=
|
||||
golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
|
||||
10
vendor/github.com/mattn/go-colorable/noncolorable.go
generated
vendored
10
vendor/github.com/mattn/go-colorable/noncolorable.go
generated
vendored
@@ -18,18 +18,22 @@ func NewNonColorable(w io.Writer) io.Writer {
|
||||
// Write writes data on console
|
||||
func (w *NonColorable) Write(data []byte) (n int, err error) {
|
||||
er := bytes.NewReader(data)
|
||||
var bw [1]byte
|
||||
var plaintext bytes.Buffer
|
||||
loop:
|
||||
for {
|
||||
c1, err := er.ReadByte()
|
||||
if err != nil {
|
||||
plaintext.WriteTo(w.out)
|
||||
break loop
|
||||
}
|
||||
if c1 != 0x1b {
|
||||
bw[0] = c1
|
||||
w.out.Write(bw[:])
|
||||
plaintext.WriteByte(c1)
|
||||
continue
|
||||
}
|
||||
_, err = plaintext.WriteTo(w.out)
|
||||
if err != nil {
|
||||
break loop
|
||||
}
|
||||
c2, err := er.ReadByte()
|
||||
if err != nil {
|
||||
break loop
|
||||
|
||||
2
vendor/github.com/mattn/go-isatty/go.mod
generated
vendored
2
vendor/github.com/mattn/go-isatty/go.mod
generated
vendored
@@ -2,4 +2,4 @@ module github.com/mattn/go-isatty
|
||||
|
||||
go 1.12
|
||||
|
||||
require golang.org/x/sys v0.0.0-20200116001909-b77594299b42
|
||||
require golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c
|
||||
|
||||
1
vendor/github.com/mattn/go-isatty/isatty_bsd.go
generated
vendored
1
vendor/github.com/mattn/go-isatty/isatty_bsd.go
generated
vendored
@@ -1,3 +1,4 @@
|
||||
//go:build (darwin || freebsd || openbsd || netbsd || dragonfly) && !appengine
|
||||
// +build darwin freebsd openbsd netbsd dragonfly
|
||||
// +build !appengine
|
||||
|
||||
|
||||
3
vendor/github.com/mattn/go-isatty/isatty_others.go
generated
vendored
3
vendor/github.com/mattn/go-isatty/isatty_others.go
generated
vendored
@@ -1,4 +1,5 @@
|
||||
// +build appengine js nacl
|
||||
//go:build appengine || js || nacl || wasm
|
||||
// +build appengine js nacl wasm
|
||||
|
||||
package isatty
|
||||
|
||||
|
||||
1
vendor/github.com/mattn/go-isatty/isatty_plan9.go
generated
vendored
1
vendor/github.com/mattn/go-isatty/isatty_plan9.go
generated
vendored
@@ -1,3 +1,4 @@
|
||||
//go:build plan9
|
||||
// +build plan9
|
||||
|
||||
package isatty
|
||||
|
||||
9
vendor/github.com/mattn/go-isatty/isatty_solaris.go
generated
vendored
9
vendor/github.com/mattn/go-isatty/isatty_solaris.go
generated
vendored
@@ -1,5 +1,5 @@
|
||||
// +build solaris
|
||||
// +build !appengine
|
||||
//go:build solaris && !appengine
|
||||
// +build solaris,!appengine
|
||||
|
||||
package isatty
|
||||
|
||||
@@ -8,10 +8,9 @@ import (
|
||||
)
|
||||
|
||||
// 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
|
||||
// see: https://src.illumos.org/source/xref/illumos-gate/usr/src/lib/libc/port/gen/isatty.c
|
||||
func IsTerminal(fd uintptr) bool {
|
||||
var termio unix.Termio
|
||||
err := unix.IoctlSetTermio(int(fd), unix.TCGETA, &termio)
|
||||
_, err := unix.IoctlGetTermio(int(fd), unix.TCGETA)
|
||||
return err == nil
|
||||
}
|
||||
|
||||
|
||||
3
vendor/github.com/mattn/go-isatty/isatty_tcgets.go
generated
vendored
3
vendor/github.com/mattn/go-isatty/isatty_tcgets.go
generated
vendored
@@ -1,4 +1,5 @@
|
||||
// +build linux aix
|
||||
//go:build (linux || aix || zos) && !appengine
|
||||
// +build linux aix zos
|
||||
// +build !appengine
|
||||
|
||||
package isatty
|
||||
|
||||
6
vendor/github.com/mattn/go-isatty/isatty_windows.go
generated
vendored
6
vendor/github.com/mattn/go-isatty/isatty_windows.go
generated
vendored
@@ -1,5 +1,5 @@
|
||||
// +build windows
|
||||
// +build !appengine
|
||||
//go:build windows && !appengine
|
||||
// +build windows,!appengine
|
||||
|
||||
package isatty
|
||||
|
||||
@@ -76,7 +76,7 @@ func isCygwinPipeName(name string) bool {
|
||||
}
|
||||
|
||||
// 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
|
||||
// since GetFileInformationByHandleEx is not available 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
|
||||
|
||||
8
vendor/github.com/mattn/go-isatty/renovate.json
generated
vendored
8
vendor/github.com/mattn/go-isatty/renovate.json
generated
vendored
@@ -1,8 +0,0 @@
|
||||
{
|
||||
"extends": [
|
||||
"config:base"
|
||||
],
|
||||
"postUpdateOptions": [
|
||||
"gomodTidy"
|
||||
]
|
||||
}
|
||||
31
vendor/golang.org/x/sys/unix/sockcmsg_linux.go
generated
vendored
31
vendor/golang.org/x/sys/unix/sockcmsg_linux.go
generated
vendored
@@ -56,3 +56,34 @@ func PktInfo6(info *Inet6Pktinfo) []byte {
|
||||
*(*Inet6Pktinfo)(h.data(0)) = *info
|
||||
return b
|
||||
}
|
||||
|
||||
// ParseOrigDstAddr decodes a socket control message containing the original
|
||||
// destination address. To receive such a message the IP_RECVORIGDSTADDR or
|
||||
// IPV6_RECVORIGDSTADDR option must be enabled on the socket.
|
||||
func ParseOrigDstAddr(m *SocketControlMessage) (Sockaddr, error) {
|
||||
switch {
|
||||
case m.Header.Level == SOL_IP && m.Header.Type == IP_ORIGDSTADDR:
|
||||
pp := (*RawSockaddrInet4)(unsafe.Pointer(&m.Data[0]))
|
||||
sa := new(SockaddrInet4)
|
||||
p := (*[2]byte)(unsafe.Pointer(&pp.Port))
|
||||
sa.Port = int(p[0])<<8 + int(p[1])
|
||||
for i := 0; i < len(sa.Addr); i++ {
|
||||
sa.Addr[i] = pp.Addr[i]
|
||||
}
|
||||
return sa, nil
|
||||
|
||||
case m.Header.Level == SOL_IPV6 && m.Header.Type == IPV6_ORIGDSTADDR:
|
||||
pp := (*RawSockaddrInet6)(unsafe.Pointer(&m.Data[0]))
|
||||
sa := new(SockaddrInet6)
|
||||
p := (*[2]byte)(unsafe.Pointer(&pp.Port))
|
||||
sa.Port = int(p[0])<<8 + int(p[1])
|
||||
sa.ZoneId = pp.Scope_id
|
||||
for i := 0; i < len(sa.Addr); i++ {
|
||||
sa.Addr[i] = pp.Addr[i]
|
||||
}
|
||||
return sa, nil
|
||||
|
||||
default:
|
||||
return nil, EINVAL
|
||||
}
|
||||
}
|
||||
|
||||
6
vendor/golang.org/x/sys/unix/ztypes_darwin_amd64.go
generated
vendored
6
vendor/golang.org/x/sys/unix/ztypes_darwin_amd64.go
generated
vendored
@@ -641,13 +641,13 @@ type Eproc struct {
|
||||
Tdev int32
|
||||
Tpgid int32
|
||||
Tsess uintptr
|
||||
Wmesg [8]int8
|
||||
Wmesg [8]byte
|
||||
Xsize int32
|
||||
Xrssize int16
|
||||
Xccount int16
|
||||
Xswrss int16
|
||||
Flag int32
|
||||
Login [12]int8
|
||||
Login [12]byte
|
||||
Spare [4]int32
|
||||
_ [4]byte
|
||||
}
|
||||
@@ -688,7 +688,7 @@ type ExternProc struct {
|
||||
P_priority uint8
|
||||
P_usrpri uint8
|
||||
P_nice int8
|
||||
P_comm [17]int8
|
||||
P_comm [17]byte
|
||||
P_pgrp uintptr
|
||||
P_addr uintptr
|
||||
P_xstat uint16
|
||||
|
||||
6
vendor/golang.org/x/sys/unix/ztypes_darwin_arm64.go
generated
vendored
6
vendor/golang.org/x/sys/unix/ztypes_darwin_arm64.go
generated
vendored
@@ -641,13 +641,13 @@ type Eproc struct {
|
||||
Tdev int32
|
||||
Tpgid int32
|
||||
Tsess uintptr
|
||||
Wmesg [8]int8
|
||||
Wmesg [8]byte
|
||||
Xsize int32
|
||||
Xrssize int16
|
||||
Xccount int16
|
||||
Xswrss int16
|
||||
Flag int32
|
||||
Login [12]int8
|
||||
Login [12]byte
|
||||
Spare [4]int32
|
||||
_ [4]byte
|
||||
}
|
||||
@@ -688,7 +688,7 @@ type ExternProc struct {
|
||||
P_priority uint8
|
||||
P_usrpri uint8
|
||||
P_nice int8
|
||||
P_comm [17]int8
|
||||
P_comm [17]byte
|
||||
P_pgrp uintptr
|
||||
P_addr uintptr
|
||||
P_xstat uint16
|
||||
|
||||
12
vendor/golang.org/x/sys/windows/service.go
generated
vendored
12
vendor/golang.org/x/sys/windows/service.go
generated
vendored
@@ -17,8 +17,6 @@ const (
|
||||
SC_MANAGER_ALL_ACCESS = 0xf003f
|
||||
)
|
||||
|
||||
//sys OpenSCManager(machineName *uint16, databaseName *uint16, access uint32) (handle Handle, err error) [failretval==0] = advapi32.OpenSCManagerW
|
||||
|
||||
const (
|
||||
SERVICE_KERNEL_DRIVER = 1
|
||||
SERVICE_FILE_SYSTEM_DRIVER = 2
|
||||
@@ -133,6 +131,14 @@ const (
|
||||
SC_EVENT_DATABASE_CHANGE = 0
|
||||
SC_EVENT_PROPERTY_CHANGE = 1
|
||||
SC_EVENT_STATUS_CHANGE = 2
|
||||
|
||||
SERVICE_START_REASON_DEMAND = 0x00000001
|
||||
SERVICE_START_REASON_AUTO = 0x00000002
|
||||
SERVICE_START_REASON_TRIGGER = 0x00000004
|
||||
SERVICE_START_REASON_RESTART_ON_FAILURE = 0x00000008
|
||||
SERVICE_START_REASON_DELAYEDAUTO = 0x00000010
|
||||
|
||||
SERVICE_DYNAMIC_INFORMATION_LEVEL_START_REASON = 1
|
||||
)
|
||||
|
||||
type SERVICE_STATUS struct {
|
||||
@@ -217,6 +223,7 @@ type QUERY_SERVICE_LOCK_STATUS struct {
|
||||
LockDuration uint32
|
||||
}
|
||||
|
||||
//sys OpenSCManager(machineName *uint16, databaseName *uint16, access uint32) (handle Handle, err error) [failretval==0] = advapi32.OpenSCManagerW
|
||||
//sys CloseServiceHandle(handle Handle) (err error) = advapi32.CloseServiceHandle
|
||||
//sys CreateService(mgr Handle, serviceName *uint16, displayName *uint16, access uint32, srvType uint32, startType uint32, errCtl uint32, pathName *uint16, loadOrderGroup *uint16, tagId *uint32, dependencies *uint16, serviceStartName *uint16, password *uint16) (handle Handle, err error) [failretval==0] = advapi32.CreateServiceW
|
||||
//sys OpenService(mgr Handle, serviceName *uint16, access uint32) (handle Handle, err error) [failretval==0] = advapi32.OpenServiceW
|
||||
@@ -237,3 +244,4 @@ type QUERY_SERVICE_LOCK_STATUS struct {
|
||||
//sys SubscribeServiceChangeNotifications(service Handle, eventType uint32, callback uintptr, callbackCtx uintptr, subscription *uintptr) (ret error) = sechost.SubscribeServiceChangeNotifications?
|
||||
//sys UnsubscribeServiceChangeNotifications(subscription uintptr) = sechost.UnsubscribeServiceChangeNotifications?
|
||||
//sys RegisterServiceCtrlHandlerEx(serviceName *uint16, handlerProc uintptr, context uintptr) (handle Handle, err error) = advapi32.RegisterServiceCtrlHandlerExW
|
||||
//sys QueryServiceDynamicInformation(service Handle, infoLevel uint32, dynamicInfo unsafe.Pointer) (err error) = advapi32.QueryServiceDynamicInformation?
|
||||
|
||||
31
vendor/golang.org/x/sys/windows/zsyscall_windows.go
generated
vendored
31
vendor/golang.org/x/sys/windows/zsyscall_windows.go
generated
vendored
@@ -115,6 +115,7 @@ var (
|
||||
procOpenThreadToken = modadvapi32.NewProc("OpenThreadToken")
|
||||
procQueryServiceConfig2W = modadvapi32.NewProc("QueryServiceConfig2W")
|
||||
procQueryServiceConfigW = modadvapi32.NewProc("QueryServiceConfigW")
|
||||
procQueryServiceDynamicInformation = modadvapi32.NewProc("QueryServiceDynamicInformation")
|
||||
procQueryServiceLockStatusW = modadvapi32.NewProc("QueryServiceLockStatusW")
|
||||
procQueryServiceStatus = modadvapi32.NewProc("QueryServiceStatus")
|
||||
procQueryServiceStatusEx = modadvapi32.NewProc("QueryServiceStatusEx")
|
||||
@@ -366,9 +367,9 @@ var (
|
||||
procNetUserGetInfo = modnetapi32.NewProc("NetUserGetInfo")
|
||||
procNtCreateFile = modntdll.NewProc("NtCreateFile")
|
||||
procNtCreateNamedPipeFile = modntdll.NewProc("NtCreateNamedPipeFile")
|
||||
procNtSetInformationFile = modntdll.NewProc("NtSetInformationFile")
|
||||
procNtQueryInformationProcess = modntdll.NewProc("NtQueryInformationProcess")
|
||||
procNtQuerySystemInformation = modntdll.NewProc("NtQuerySystemInformation")
|
||||
procNtSetInformationFile = modntdll.NewProc("NtSetInformationFile")
|
||||
procNtSetInformationProcess = modntdll.NewProc("NtSetInformationProcess")
|
||||
procNtSetSystemInformation = modntdll.NewProc("NtSetSystemInformation")
|
||||
procRtlAddFunctionTable = modntdll.NewProc("RtlAddFunctionTable")
|
||||
@@ -976,6 +977,18 @@ func QueryServiceConfig(service Handle, serviceConfig *QUERY_SERVICE_CONFIG, buf
|
||||
return
|
||||
}
|
||||
|
||||
func QueryServiceDynamicInformation(service Handle, infoLevel uint32, dynamicInfo unsafe.Pointer) (err error) {
|
||||
err = procQueryServiceDynamicInformation.Find()
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
r1, _, e1 := syscall.Syscall(procQueryServiceDynamicInformation.Addr(), 3, uintptr(service), uintptr(infoLevel), uintptr(dynamicInfo))
|
||||
if r1 == 0 {
|
||||
err = errnoErr(e1)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func QueryServiceLockStatus(mgr Handle, lockStatus *QUERY_SERVICE_LOCK_STATUS, bufSize uint32, bytesNeeded *uint32) (err error) {
|
||||
r1, _, e1 := syscall.Syscall6(procQueryServiceLockStatusW.Addr(), 4, uintptr(mgr), uintptr(unsafe.Pointer(lockStatus)), uintptr(bufSize), uintptr(unsafe.Pointer(bytesNeeded)), 0, 0)
|
||||
if r1 == 0 {
|
||||
@@ -3171,14 +3184,6 @@ func NtCreateNamedPipeFile(pipe *Handle, access uint32, oa *OBJECT_ATTRIBUTES, i
|
||||
return
|
||||
}
|
||||
|
||||
func NtSetInformationFile(handle Handle, iosb *IO_STATUS_BLOCK, inBuffer *byte, inBufferLen uint32, class uint32) (ntstatus error) {
|
||||
r0, _, _ := syscall.Syscall6(procNtSetInformationFile.Addr(), 5, uintptr(handle), uintptr(unsafe.Pointer(iosb)), uintptr(unsafe.Pointer(inBuffer)), uintptr(inBufferLen), uintptr(class), 0)
|
||||
if r0 != 0 {
|
||||
ntstatus = NTStatus(r0)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func NtQueryInformationProcess(proc Handle, procInfoClass int32, procInfo unsafe.Pointer, procInfoLen uint32, retLen *uint32) (ntstatus error) {
|
||||
r0, _, _ := syscall.Syscall6(procNtQueryInformationProcess.Addr(), 5, uintptr(proc), uintptr(procInfoClass), uintptr(procInfo), uintptr(procInfoLen), uintptr(unsafe.Pointer(retLen)), 0)
|
||||
if r0 != 0 {
|
||||
@@ -3195,6 +3200,14 @@ func NtQuerySystemInformation(sysInfoClass int32, sysInfo unsafe.Pointer, sysInf
|
||||
return
|
||||
}
|
||||
|
||||
func NtSetInformationFile(handle Handle, iosb *IO_STATUS_BLOCK, inBuffer *byte, inBufferLen uint32, class uint32) (ntstatus error) {
|
||||
r0, _, _ := syscall.Syscall6(procNtSetInformationFile.Addr(), 5, uintptr(handle), uintptr(unsafe.Pointer(iosb)), uintptr(unsafe.Pointer(inBuffer)), uintptr(inBufferLen), uintptr(class), 0)
|
||||
if r0 != 0 {
|
||||
ntstatus = NTStatus(r0)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func NtSetInformationProcess(proc Handle, procInfoClass int32, procInfo unsafe.Pointer, procInfoLen uint32) (ntstatus error) {
|
||||
r0, _, _ := syscall.Syscall6(procNtSetInformationProcess.Addr(), 4, uintptr(proc), uintptr(procInfoClass), uintptr(procInfo), uintptr(procInfoLen), 0, 0)
|
||||
if r0 != 0 {
|
||||
|
||||
15
vendor/modules.txt
vendored
15
vendor/modules.txt
vendored
@@ -17,7 +17,6 @@ github.com/cloudfoundry/jibber_jabber
|
||||
## explicit
|
||||
github.com/creack/pty
|
||||
# github.com/davecgh/go-spew v1.1.1
|
||||
## explicit
|
||||
github.com/davecgh/go-spew/spew
|
||||
# github.com/emirpasic/gods v1.12.0
|
||||
github.com/emirpasic/gods/containers
|
||||
@@ -105,7 +104,7 @@ github.com/gobwas/glob/util/strings
|
||||
github.com/golang-collections/collections/stack
|
||||
# github.com/golang/protobuf v1.3.2
|
||||
## explicit
|
||||
# github.com/google/go-cmp v0.3.1
|
||||
# github.com/google/go-cmp v0.5.6
|
||||
## explicit
|
||||
# github.com/gookit/color v1.4.2
|
||||
## explicit
|
||||
@@ -116,8 +115,6 @@ github.com/imdario/mergo
|
||||
# github.com/integrii/flaggy v1.4.0
|
||||
## explicit
|
||||
github.com/integrii/flaggy
|
||||
# github.com/iriri/minimal/gitignore v0.3.2
|
||||
## explicit
|
||||
# github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99
|
||||
github.com/jbenet/go-context/io
|
||||
# github.com/jesseduffield/go-git/v5 v5.1.2-0.20201006095850-341962be15a4
|
||||
@@ -164,7 +161,7 @@ github.com/jesseduffield/go-git/v5/utils/merkletrie/filesystem
|
||||
github.com/jesseduffield/go-git/v5/utils/merkletrie/index
|
||||
github.com/jesseduffield/go-git/v5/utils/merkletrie/internal/frame
|
||||
github.com/jesseduffield/go-git/v5/utils/merkletrie/noder
|
||||
# github.com/jesseduffield/gocui v0.3.1-0.20211024041248-681a61c53ed0
|
||||
# github.com/jesseduffield/gocui v0.3.1-0.20211031223253-24baf341da75
|
||||
## explicit
|
||||
github.com/jesseduffield/gocui
|
||||
# github.com/jesseduffield/minimal/gitignore v0.3.3-0.20211018110810-9cde264e6b1e
|
||||
@@ -191,10 +188,10 @@ github.com/kyokomi/emoji/v2
|
||||
# github.com/lucasb-eyer/go-colorful v1.2.0
|
||||
## explicit
|
||||
github.com/lucasb-eyer/go-colorful
|
||||
# github.com/mattn/go-colorable v0.1.7
|
||||
# github.com/mattn/go-colorable v0.1.11
|
||||
## explicit
|
||||
github.com/mattn/go-colorable
|
||||
# github.com/mattn/go-isatty v0.0.12
|
||||
# github.com/mattn/go-isatty v0.0.14
|
||||
github.com/mattn/go-isatty
|
||||
# github.com/mattn/go-runewidth v0.0.13
|
||||
## explicit
|
||||
@@ -208,8 +205,6 @@ github.com/mitchellh/go-homedir
|
||||
## explicit
|
||||
# github.com/onsi/gomega v1.7.1
|
||||
## explicit
|
||||
# github.com/ozeidan/fuzzy-patricia v3.0.0+incompatible
|
||||
## explicit
|
||||
# github.com/pmezard/go-difflib v1.0.0
|
||||
github.com/pmezard/go-difflib/difflib
|
||||
# github.com/rivo/uniseg v0.2.0
|
||||
@@ -258,7 +253,7 @@ golang.org/x/crypto/ssh/knownhosts
|
||||
golang.org/x/net/context
|
||||
golang.org/x/net/internal/socks
|
||||
golang.org/x/net/proxy
|
||||
# golang.org/x/sys v0.0.0-20211023085530-d6a326fbbf70
|
||||
# golang.org/x/sys v0.0.0-20211031064116-611d5d643895
|
||||
## explicit
|
||||
golang.org/x/sys/cpu
|
||||
golang.org/x/sys/internal/unsafeheader
|
||||
|
||||
Reference in New Issue
Block a user