mirror of
https://github.com/jesseduffield/lazydocker.git
synced 2026-07-21 23:01:03 +00:00
more progess
This commit is contained in:
parent
736e168adc
commit
d3eea00139
3 changed files with 24 additions and 7 deletions
|
|
@ -72,13 +72,24 @@ func (gui *Gui) handleContainerSelect(g *gocui.Gui, v *gocui.View, alreadySelect
|
|||
|
||||
gui.State.MainWriterID++
|
||||
writerID := gui.State.MainWriterID
|
||||
|
||||
mainView.Clear()
|
||||
mainView.SetOrigin(0, 0)
|
||||
mainView.SetCursor(0, 0)
|
||||
|
||||
if err := gui.renderLogs(mainView, container, writerID); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (gui *Gui) renderLogs(mainView *gocui.View, container *commands.Container, writerID int) error {
|
||||
|
||||
mainView.Autoscroll = true
|
||||
|
||||
var cmd *exec.Cmd
|
||||
cmd = gui.OSCommand.RunCustomCommand("docker logs --since=60m --timestamps " + container.ID)
|
||||
cmd = gui.OSCommand.RunCustomCommand("docker logs --since=60m --timestamps --follow " + container.ID)
|
||||
|
||||
cmd.Stdout = mainView
|
||||
cmd.Start()
|
||||
|
|
|
|||
|
|
@ -143,11 +143,13 @@ func (gui *Gui) scrollDownMain(g *gocui.Gui, v *gocui.View) error {
|
|||
_, sy := mainView.Size()
|
||||
y += sy
|
||||
}
|
||||
if y < len(mainView.BufferLines()) {
|
||||
return mainView.SetOrigin(ox, oy+gui.Config.GetUserConfig().GetInt("gui.scrollHeight"))
|
||||
}
|
||||
// for some reason we can't work out whether we've hit the bottomq
|
||||
// there is a large discrepancy in the origin's y value and the length of BufferLines
|
||||
return mainView.SetOrigin(ox, oy+gui.Config.GetUserConfig().GetInt("gui.scrollHeight"))
|
||||
}
|
||||
|
||||
mainView.Autoscroll = true
|
||||
func (gui *Gui) autoScrollMain(g *gocui.Gui, v *gocui.View) error {
|
||||
gui.getMainView().Autoscroll = true
|
||||
return nil
|
||||
}
|
||||
|
||||
|
|
@ -251,11 +253,10 @@ func (gui *Gui) layout(g *gocui.Gui) error {
|
|||
}
|
||||
|
||||
usableSpace := height - 4
|
||||
extraSpace := usableSpace - (usableSpace/3)*3
|
||||
|
||||
vHeights := map[string]int{
|
||||
"status": 3,
|
||||
"containers": (usableSpace) + extraSpace,
|
||||
"containers": usableSpace,
|
||||
"options": 1,
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -94,6 +94,11 @@ func (gui *Gui) GetInitialKeybindings() []*Binding {
|
|||
Key: gocui.KeyCtrlD,
|
||||
Modifier: gocui.ModNone,
|
||||
Handler: gui.scrollDownMain,
|
||||
}, {
|
||||
ViewName: "",
|
||||
Key: gocui.KeyEnd,
|
||||
Modifier: gocui.ModNone,
|
||||
Handler: gui.autoScrollMain,
|
||||
}, {
|
||||
ViewName: "",
|
||||
Key: 'x',
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue