mirror of
https://github.com/jesseduffield/lazydocker.git
synced 2026-07-25 08:31:03 +00:00
Merge d5f6eee69f into 7e7aadc207
This commit is contained in:
commit
9034ab8f7e
15 changed files with 126 additions and 4 deletions
|
|
@ -25,6 +25,7 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||||
<kbd>a</kbd>: anbinden
|
<kbd>a</kbd>: anbinden
|
||||||
<kbd>m</kbd>: zeige Protokolle
|
<kbd>m</kbd>: zeige Protokolle
|
||||||
<kbd>E</kbd>: exec shell
|
<kbd>E</kbd>: exec shell
|
||||||
|
<kbd>t</kbd>: cycle how many log lines are shown
|
||||||
<kbd>c</kbd>: führe vordefinierten benutzerdefinierten Befehl aus
|
<kbd>c</kbd>: führe vordefinierten benutzerdefinierten Befehl aus
|
||||||
<kbd>b</kbd>: view bulk commands
|
<kbd>b</kbd>: view bulk commands
|
||||||
<kbd>w</kbd>: open in browser (first port is http)
|
<kbd>w</kbd>: open in browser (first port is http)
|
||||||
|
|
@ -45,6 +46,7 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||||
<kbd>S</kbd>: start
|
<kbd>S</kbd>: start
|
||||||
<kbd>a</kbd>: anbinden
|
<kbd>a</kbd>: anbinden
|
||||||
<kbd>m</kbd>: zeige Protokolle
|
<kbd>m</kbd>: zeige Protokolle
|
||||||
|
<kbd>t</kbd>: cycle how many log lines are shown
|
||||||
<kbd>U</kbd>: up project
|
<kbd>U</kbd>: up project
|
||||||
<kbd>D</kbd>: down project
|
<kbd>D</kbd>: down project
|
||||||
<kbd>R</kbd>: zeige Neustartoptionen
|
<kbd>R</kbd>: zeige Neustartoptionen
|
||||||
|
|
|
||||||
|
|
@ -25,6 +25,7 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||||
<kbd>a</kbd>: attach
|
<kbd>a</kbd>: attach
|
||||||
<kbd>m</kbd>: view logs
|
<kbd>m</kbd>: view logs
|
||||||
<kbd>E</kbd>: exec shell
|
<kbd>E</kbd>: exec shell
|
||||||
|
<kbd>t</kbd>: cycle how many log lines are shown
|
||||||
<kbd>c</kbd>: run predefined custom command
|
<kbd>c</kbd>: run predefined custom command
|
||||||
<kbd>b</kbd>: view bulk commands
|
<kbd>b</kbd>: view bulk commands
|
||||||
<kbd>w</kbd>: open in browser (first port is http)
|
<kbd>w</kbd>: open in browser (first port is http)
|
||||||
|
|
@ -45,6 +46,7 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||||
<kbd>S</kbd>: start
|
<kbd>S</kbd>: start
|
||||||
<kbd>a</kbd>: attach
|
<kbd>a</kbd>: attach
|
||||||
<kbd>m</kbd>: view logs
|
<kbd>m</kbd>: view logs
|
||||||
|
<kbd>t</kbd>: cycle how many log lines are shown
|
||||||
<kbd>U</kbd>: up project
|
<kbd>U</kbd>: up project
|
||||||
<kbd>D</kbd>: down project
|
<kbd>D</kbd>: down project
|
||||||
<kbd>R</kbd>: view restart options
|
<kbd>R</kbd>: view restart options
|
||||||
|
|
|
||||||
|
|
@ -25,6 +25,7 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||||
<kbd>a</kbd>: attach
|
<kbd>a</kbd>: attach
|
||||||
<kbd>m</kbd>: ver logs
|
<kbd>m</kbd>: ver logs
|
||||||
<kbd>E</kbd>: ejecutar shell
|
<kbd>E</kbd>: ejecutar shell
|
||||||
|
<kbd>t</kbd>: cycle how many log lines are shown
|
||||||
<kbd>c</kbd>: ejecutar comando personalizado
|
<kbd>c</kbd>: ejecutar comando personalizado
|
||||||
<kbd>b</kbd>: ver comandos masivos
|
<kbd>b</kbd>: ver comandos masivos
|
||||||
<kbd>w</kbd>: abrir en navegador (first port is http)
|
<kbd>w</kbd>: abrir en navegador (first port is http)
|
||||||
|
|
@ -45,6 +46,7 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||||
<kbd>S</kbd>: iniciar
|
<kbd>S</kbd>: iniciar
|
||||||
<kbd>a</kbd>: attach
|
<kbd>a</kbd>: attach
|
||||||
<kbd>m</kbd>: ver logs
|
<kbd>m</kbd>: ver logs
|
||||||
|
<kbd>t</kbd>: cycle how many log lines are shown
|
||||||
<kbd>U</kbd>: levantar proyecto
|
<kbd>U</kbd>: levantar proyecto
|
||||||
<kbd>D</kbd>: dar de baja el proyecto
|
<kbd>D</kbd>: dar de baja el proyecto
|
||||||
<kbd>R</kbd>: ver opciones de reinicio
|
<kbd>R</kbd>: ver opciones de reinicio
|
||||||
|
|
|
||||||
|
|
@ -25,6 +25,7 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||||
<kbd>a</kbd>: attacher
|
<kbd>a</kbd>: attacher
|
||||||
<kbd>m</kbd>: voir les enregistrements
|
<kbd>m</kbd>: voir les enregistrements
|
||||||
<kbd>E</kbd>: exécuter le shell
|
<kbd>E</kbd>: exécuter le shell
|
||||||
|
<kbd>t</kbd>: cycle how many log lines are shown
|
||||||
<kbd>c</kbd>: exécuter une commande prédéfinie
|
<kbd>c</kbd>: exécuter une commande prédéfinie
|
||||||
<kbd>b</kbd>: voir les commandes groupées
|
<kbd>b</kbd>: voir les commandes groupées
|
||||||
<kbd>w</kbd>: ouvrir dans le navigateur (le premier port est http)
|
<kbd>w</kbd>: ouvrir dans le navigateur (le premier port est http)
|
||||||
|
|
@ -45,6 +46,7 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||||
<kbd>S</kbd>: démarrer
|
<kbd>S</kbd>: démarrer
|
||||||
<kbd>a</kbd>: attacher
|
<kbd>a</kbd>: attacher
|
||||||
<kbd>m</kbd>: voir les enregistrements
|
<kbd>m</kbd>: voir les enregistrements
|
||||||
|
<kbd>t</kbd>: cycle how many log lines are shown
|
||||||
<kbd>U</kbd>: up project
|
<kbd>U</kbd>: up project
|
||||||
<kbd>D</kbd>: down project
|
<kbd>D</kbd>: down project
|
||||||
<kbd>R</kbd>: voir les options de redémarrage
|
<kbd>R</kbd>: voir les options de redémarrage
|
||||||
|
|
|
||||||
|
|
@ -25,6 +25,7 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||||
<kbd>a</kbd>: verbinden
|
<kbd>a</kbd>: verbinden
|
||||||
<kbd>m</kbd>: bekijk logs
|
<kbd>m</kbd>: bekijk logs
|
||||||
<kbd>E</kbd>: exec shell
|
<kbd>E</kbd>: exec shell
|
||||||
|
<kbd>t</kbd>: cycle how many log lines are shown
|
||||||
<kbd>c</kbd>: draai een vooraf bedacht aangepaste opdracht
|
<kbd>c</kbd>: draai een vooraf bedacht aangepaste opdracht
|
||||||
<kbd>b</kbd>: view bulk commands
|
<kbd>b</kbd>: view bulk commands
|
||||||
<kbd>w</kbd>: open in browser (first port is http)
|
<kbd>w</kbd>: open in browser (first port is http)
|
||||||
|
|
@ -45,6 +46,7 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||||
<kbd>S</kbd>: start
|
<kbd>S</kbd>: start
|
||||||
<kbd>a</kbd>: verbinden
|
<kbd>a</kbd>: verbinden
|
||||||
<kbd>m</kbd>: bekijk logs
|
<kbd>m</kbd>: bekijk logs
|
||||||
|
<kbd>t</kbd>: cycle how many log lines are shown
|
||||||
<kbd>U</kbd>: up project
|
<kbd>U</kbd>: up project
|
||||||
<kbd>D</kbd>: down project
|
<kbd>D</kbd>: down project
|
||||||
<kbd>R</kbd>: bekijk herstart opties
|
<kbd>R</kbd>: bekijk herstart opties
|
||||||
|
|
|
||||||
|
|
@ -25,6 +25,7 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||||
<kbd>a</kbd>: przyczep
|
<kbd>a</kbd>: przyczep
|
||||||
<kbd>m</kbd>: pokaż logi
|
<kbd>m</kbd>: pokaż logi
|
||||||
<kbd>E</kbd>: exec shell
|
<kbd>E</kbd>: exec shell
|
||||||
|
<kbd>t</kbd>: cycle how many log lines are shown
|
||||||
<kbd>c</kbd>: wykonaj predefiniowaną własną komende
|
<kbd>c</kbd>: wykonaj predefiniowaną własną komende
|
||||||
<kbd>b</kbd>: view bulk commands
|
<kbd>b</kbd>: view bulk commands
|
||||||
<kbd>w</kbd>: open in browser (first port is http)
|
<kbd>w</kbd>: open in browser (first port is http)
|
||||||
|
|
@ -45,6 +46,7 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||||
<kbd>S</kbd>: start
|
<kbd>S</kbd>: start
|
||||||
<kbd>a</kbd>: przyczep
|
<kbd>a</kbd>: przyczep
|
||||||
<kbd>m</kbd>: pokaż logi
|
<kbd>m</kbd>: pokaż logi
|
||||||
|
<kbd>t</kbd>: cycle how many log lines are shown
|
||||||
<kbd>U</kbd>: up project
|
<kbd>U</kbd>: up project
|
||||||
<kbd>D</kbd>: down project
|
<kbd>D</kbd>: down project
|
||||||
<kbd>R</kbd>: pokaż opcje restartu
|
<kbd>R</kbd>: pokaż opcje restartu
|
||||||
|
|
|
||||||
|
|
@ -25,6 +25,7 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||||
<kbd>a</kbd>: anexar
|
<kbd>a</kbd>: anexar
|
||||||
<kbd>m</kbd>: ver logs
|
<kbd>m</kbd>: ver logs
|
||||||
<kbd>E</kbd>: executar shell
|
<kbd>E</kbd>: executar shell
|
||||||
|
<kbd>t</kbd>: cycle how many log lines are shown
|
||||||
<kbd>c</kbd>: executar comando personalizado predefinido
|
<kbd>c</kbd>: executar comando personalizado predefinido
|
||||||
<kbd>b</kbd>: ver comandos em massa
|
<kbd>b</kbd>: ver comandos em massa
|
||||||
<kbd>w</kbd>: abrir no navegador (primeira porta é http)
|
<kbd>w</kbd>: abrir no navegador (primeira porta é http)
|
||||||
|
|
@ -45,6 +46,7 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||||
<kbd>S</kbd>: iniciar
|
<kbd>S</kbd>: iniciar
|
||||||
<kbd>a</kbd>: anexar
|
<kbd>a</kbd>: anexar
|
||||||
<kbd>m</kbd>: ver logs
|
<kbd>m</kbd>: ver logs
|
||||||
|
<kbd>t</kbd>: cycle how many log lines are shown
|
||||||
<kbd>U</kbd>: subir projeto
|
<kbd>U</kbd>: subir projeto
|
||||||
<kbd>D</kbd>: derrubar projeto
|
<kbd>D</kbd>: derrubar projeto
|
||||||
<kbd>R</kbd>: ver opções de reinício
|
<kbd>R</kbd>: ver opções de reinício
|
||||||
|
|
|
||||||
|
|
@ -25,6 +25,7 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||||
<kbd>a</kbd>: bağlan/iliştir
|
<kbd>a</kbd>: bağlan/iliştir
|
||||||
<kbd>m</kbd>: kayıt defterini görüntüle
|
<kbd>m</kbd>: kayıt defterini görüntüle
|
||||||
<kbd>E</kbd>: exec shell
|
<kbd>E</kbd>: exec shell
|
||||||
|
<kbd>t</kbd>: cycle how many log lines are shown
|
||||||
<kbd>c</kbd>: önceden tanımlanmış özel komutu çalıştır
|
<kbd>c</kbd>: önceden tanımlanmış özel komutu çalıştır
|
||||||
<kbd>b</kbd>: view bulk commands
|
<kbd>b</kbd>: view bulk commands
|
||||||
<kbd>w</kbd>: open in browser (first port is http)
|
<kbd>w</kbd>: open in browser (first port is http)
|
||||||
|
|
@ -45,6 +46,7 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||||
<kbd>S</kbd>: start
|
<kbd>S</kbd>: start
|
||||||
<kbd>a</kbd>: bağlan/iliştir
|
<kbd>a</kbd>: bağlan/iliştir
|
||||||
<kbd>m</kbd>: kayıt defterini görüntüle
|
<kbd>m</kbd>: kayıt defterini görüntüle
|
||||||
|
<kbd>t</kbd>: cycle how many log lines are shown
|
||||||
<kbd>U</kbd>: up project
|
<kbd>U</kbd>: up project
|
||||||
<kbd>D</kbd>: down project
|
<kbd>D</kbd>: down project
|
||||||
<kbd>R</kbd>: yeniden başlatma seçeneklerini görüntüle
|
<kbd>R</kbd>: yeniden başlatma seçeneklerini görüntüle
|
||||||
|
|
|
||||||
|
|
@ -25,6 +25,7 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||||
<kbd>a</kbd>: attach
|
<kbd>a</kbd>: attach
|
||||||
<kbd>m</kbd>: 查看日志
|
<kbd>m</kbd>: 查看日志
|
||||||
<kbd>E</kbd>: 执行shell
|
<kbd>E</kbd>: 执行shell
|
||||||
|
<kbd>t</kbd>: cycle how many log lines are shown
|
||||||
<kbd>c</kbd>: 运行预定义的自定义命令
|
<kbd>c</kbd>: 运行预定义的自定义命令
|
||||||
<kbd>b</kbd>: 查看批量命令
|
<kbd>b</kbd>: 查看批量命令
|
||||||
<kbd>w</kbd>: 在浏览器中打开(第一个端口为http)
|
<kbd>w</kbd>: 在浏览器中打开(第一个端口为http)
|
||||||
|
|
@ -45,6 +46,7 @@ _This file is auto-generated. To update, make the changes in the pkg/i18n direct
|
||||||
<kbd>S</kbd>: 启动项目
|
<kbd>S</kbd>: 启动项目
|
||||||
<kbd>a</kbd>: attach
|
<kbd>a</kbd>: attach
|
||||||
<kbd>m</kbd>: 查看日志
|
<kbd>m</kbd>: 查看日志
|
||||||
|
<kbd>t</kbd>: cycle how many log lines are shown
|
||||||
<kbd>U</kbd>: 创建并启动容器
|
<kbd>U</kbd>: 创建并启动容器
|
||||||
<kbd>D</kbd>: 停止并移除容器
|
<kbd>D</kbd>: 停止并移除容器
|
||||||
<kbd>R</kbd>: 查看重启选项
|
<kbd>R</kbd>: 查看重启选项
|
||||||
|
|
|
||||||
|
|
@ -6,16 +6,88 @@ import (
|
||||||
"io"
|
"io"
|
||||||
"os"
|
"os"
|
||||||
"os/signal"
|
"os/signal"
|
||||||
|
"strconv"
|
||||||
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/docker/docker/api/types/container"
|
"github.com/docker/docker/api/types/container"
|
||||||
"github.com/docker/docker/pkg/stdcopy"
|
"github.com/docker/docker/pkg/stdcopy"
|
||||||
"github.com/fatih/color"
|
"github.com/fatih/color"
|
||||||
|
"github.com/jesseduffield/gocui"
|
||||||
"github.com/jesseduffield/lazydocker/pkg/commands"
|
"github.com/jesseduffield/lazydocker/pkg/commands"
|
||||||
"github.com/jesseduffield/lazydocker/pkg/tasks"
|
"github.com/jesseduffield/lazydocker/pkg/tasks"
|
||||||
"github.com/jesseduffield/lazydocker/pkg/utils"
|
"github.com/jesseduffield/lazydocker/pkg/utils"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// containerLogsTailPresets are the values we cycle through when the user asks to
|
||||||
|
// change how many lines of logs are displayed. An empty string means 'show all logs'.
|
||||||
|
var containerLogsTailPresets = []string{"", "50", "100", "200", "500"}
|
||||||
|
|
||||||
|
func containerLogsTailLabel(tail string) string {
|
||||||
|
if tail == "" {
|
||||||
|
return "all"
|
||||||
|
}
|
||||||
|
|
||||||
|
return tail
|
||||||
|
}
|
||||||
|
|
||||||
|
// cycleContainerLogsTail moves to the next tail preset (wrapping back to the start)
|
||||||
|
// and forces the logs tab to re-render with the new value.
|
||||||
|
func (gui *Gui) cycleContainerLogsTail(g *gocui.Gui, v *gocui.View) error {
|
||||||
|
currentIdx := 0
|
||||||
|
for i, preset := range containerLogsTailPresets {
|
||||||
|
if preset == gui.State.ContainerLogsTail {
|
||||||
|
currentIdx = i
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
gui.State.ContainerLogsTail = containerLogsTailPresets[(currentIdx+1)%len(containerLogsTailPresets)]
|
||||||
|
|
||||||
|
if v != nil && v.Name() == "services" {
|
||||||
|
return gui.Panels.Services.HandleSelect()
|
||||||
|
}
|
||||||
|
|
||||||
|
return gui.Panels.Containers.HandleSelect()
|
||||||
|
}
|
||||||
|
|
||||||
|
// tailLimitingWriter wraps a writer and re-renders it on every line so that it only
|
||||||
|
// ever displays the last maxLines lines, keeping a true sliding window rather than
|
||||||
|
// just applying `--tail` to the initial snapshot and then growing forever as new
|
||||||
|
// lines are followed in.
|
||||||
|
type tailLimitingWriter struct {
|
||||||
|
view *gocui.View
|
||||||
|
maxLines int
|
||||||
|
lines []string
|
||||||
|
partial string
|
||||||
|
}
|
||||||
|
|
||||||
|
func newTailLimitingWriter(view *gocui.View, maxLines int) *tailLimitingWriter {
|
||||||
|
return &tailLimitingWriter{view: view, maxLines: maxLines}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (w *tailLimitingWriter) Write(p []byte) (int, error) {
|
||||||
|
w.partial += string(p)
|
||||||
|
split := strings.Split(w.partial, "\n")
|
||||||
|
w.partial = split[len(split)-1]
|
||||||
|
newLines := split[:len(split)-1]
|
||||||
|
|
||||||
|
if len(newLines) == 0 {
|
||||||
|
return len(p), nil
|
||||||
|
}
|
||||||
|
|
||||||
|
w.lines = append(w.lines, newLines...)
|
||||||
|
if excess := len(w.lines) - w.maxLines; excess > 0 {
|
||||||
|
w.lines = w.lines[excess:]
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetContent clears and rewrites atomically, so the view never renders empty
|
||||||
|
// in between
|
||||||
|
w.view.SetContent(strings.Join(w.lines, "\n") + "\n")
|
||||||
|
|
||||||
|
return len(p), nil
|
||||||
|
}
|
||||||
|
|
||||||
func (gui *Gui) renderContainerLogsToMain(container *commands.Container) tasks.TaskFunc {
|
func (gui *Gui) renderContainerLogsToMain(container *commands.Container) tasks.TaskFunc {
|
||||||
return gui.NewTickerTask(TickerTaskOpts{
|
return gui.NewTickerTask(TickerTaskOpts{
|
||||||
Func: func(ctx context.Context, notifyStopped chan struct{}) {
|
Func: func(ctx context.Context, notifyStopped chan struct{}) {
|
||||||
|
|
@ -36,8 +108,17 @@ func (gui *Gui) renderContainerLogsToMainAux(container *commands.Container, ctx
|
||||||
}()
|
}()
|
||||||
|
|
||||||
mainView := gui.Views.Main
|
mainView := gui.Views.Main
|
||||||
|
tail := gui.State.ContainerLogsTail
|
||||||
|
mainView.Subtitle = fmt.Sprintf("tail: %s (%s to cycle)", containerLogsTailLabel(tail), "t")
|
||||||
|
|
||||||
if err := gui.writeContainerLogs(container, ctx, mainView); err != nil {
|
var writer io.Writer = mainView
|
||||||
|
if maxLines, err := strconv.Atoi(tail); err == nil && maxLines > 0 {
|
||||||
|
// keep re-truncating to the chosen number of lines as new ones stream in,
|
||||||
|
// instead of just limiting the initial snapshot and growing unbounded after that
|
||||||
|
writer = newTailLimitingWriter(mainView, maxLines)
|
||||||
|
}
|
||||||
|
|
||||||
|
if err := gui.writeContainerLogs(container, ctx, writer); err != nil {
|
||||||
gui.Log.Error(err)
|
gui.Log.Error(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -110,7 +191,7 @@ func (gui *Gui) writeContainerLogs(ctr *commands.Container, ctx context.Context,
|
||||||
ShowStderr: true,
|
ShowStderr: true,
|
||||||
Timestamps: gui.Config.UserConfig.Logs.Timestamps,
|
Timestamps: gui.Config.UserConfig.Logs.Timestamps,
|
||||||
Since: gui.Config.UserConfig.Logs.Since,
|
Since: gui.Config.UserConfig.Logs.Since,
|
||||||
Tail: gui.Config.UserConfig.Logs.Tail,
|
Tail: gui.State.ContainerLogsTail,
|
||||||
Follow: true,
|
Follow: true,
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
||||||
|
|
@ -68,7 +68,7 @@ func (gui *Gui) getContainersPanel() *panels.SideListPanel[*commands.Container]
|
||||||
// where a container restarts but the new logs don't get read.
|
// where a container restarts but the new logs don't get read.
|
||||||
// Note that this might be jarring if we have a lot of logs and the container
|
// Note that this might be jarring if we have a lot of logs and the container
|
||||||
// restarts a lot, so let's keep an eye on it.
|
// restarts a lot, so let's keep an eye on it.
|
||||||
return "containers-" + container.ID + "-" + container.Container.State
|
return "containers-" + container.ID + "-" + container.Container.State + "-" + gui.State.ContainerLogsTail
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
ListPanel: panels.ListPanel[*commands.Container]{
|
ListPanel: panels.ListPanel[*commands.Container]{
|
||||||
|
|
|
||||||
|
|
@ -82,6 +82,12 @@ type guiState struct {
|
||||||
// if true, we show containers with an 'exited' status in the containers panel
|
// if true, we show containers with an 'exited' status in the containers panel
|
||||||
ShowExitedContainers bool
|
ShowExitedContainers bool
|
||||||
|
|
||||||
|
// the number of lines to pass as `--tail` when reading a container's logs. Empty
|
||||||
|
// string means we show all of the logs. This starts out as whatever is configured
|
||||||
|
// in the user's config, and can be cycled through ContainerLogsTailPresets via a
|
||||||
|
// keybinding.
|
||||||
|
ContainerLogsTail string
|
||||||
|
|
||||||
ScreenMode WindowMaximisation
|
ScreenMode WindowMaximisation
|
||||||
|
|
||||||
// Maintains the state of manual filtering i.e. typing in a substring
|
// Maintains the state of manual filtering i.e. typing in a substring
|
||||||
|
|
@ -136,6 +142,7 @@ func NewGui(log *logrus.Entry, dockerCommand *commands.DockerCommand, oSCommand
|
||||||
ViewStack: []string{},
|
ViewStack: []string{},
|
||||||
|
|
||||||
ShowExitedContainers: true,
|
ShowExitedContainers: true,
|
||||||
|
ContainerLogsTail: config.UserConfig.Logs.Tail,
|
||||||
ScreenMode: getScreenMode(config),
|
ScreenMode: getScreenMode(config),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -241,6 +241,13 @@ func (gui *Gui) GetInitialKeybindings() []*Binding {
|
||||||
Handler: gui.handleContainersExecShell,
|
Handler: gui.handleContainersExecShell,
|
||||||
Description: gui.Tr.ExecShell,
|
Description: gui.Tr.ExecShell,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
ViewName: "containers",
|
||||||
|
Key: 't',
|
||||||
|
Modifier: gocui.ModNone,
|
||||||
|
Handler: gui.cycleContainerLogsTail,
|
||||||
|
Description: gui.Tr.CycleContainerLogsTail,
|
||||||
|
},
|
||||||
{
|
{
|
||||||
ViewName: "containers",
|
ViewName: "containers",
|
||||||
Key: 'c',
|
Key: 'c',
|
||||||
|
|
@ -318,6 +325,13 @@ func (gui *Gui) GetInitialKeybindings() []*Binding {
|
||||||
Handler: gui.handleServiceRenderLogsToMain,
|
Handler: gui.handleServiceRenderLogsToMain,
|
||||||
Description: gui.Tr.ViewLogs,
|
Description: gui.Tr.ViewLogs,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
ViewName: "services",
|
||||||
|
Key: 't',
|
||||||
|
Modifier: gocui.ModNone,
|
||||||
|
Handler: gui.cycleContainerLogsTail,
|
||||||
|
Description: gui.Tr.CycleContainerLogsTail,
|
||||||
|
},
|
||||||
{
|
{
|
||||||
ViewName: "services",
|
ViewName: "services",
|
||||||
Key: 'U',
|
Key: 'U',
|
||||||
|
|
|
||||||
|
|
@ -53,7 +53,7 @@ func (gui *Gui) getServicesPanel() *panels.SideListPanel[*commands.Service] {
|
||||||
if service.Container == nil {
|
if service.Container == nil {
|
||||||
return "services-" + service.ID
|
return "services-" + service.ID
|
||||||
}
|
}
|
||||||
return "services-" + service.ID + "-" + service.Container.ID + "-" + service.Container.Container.State
|
return "services-" + service.ID + "-" + service.Container.ID + "-" + service.Container.Container.State + "-" + gui.State.ContainerLogsTail
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
ListPanel: panels.ListPanel[*commands.Service]{
|
ListPanel: panels.ListPanel[*commands.Service]{
|
||||||
|
|
|
||||||
|
|
@ -65,6 +65,7 @@ type TranslationSet struct {
|
||||||
NextContext string
|
NextContext string
|
||||||
Attach string
|
Attach string
|
||||||
ViewLogs string
|
ViewLogs string
|
||||||
|
CycleContainerLogsTail string
|
||||||
UpProject string
|
UpProject string
|
||||||
DownProject string
|
DownProject string
|
||||||
ServicesTitle string
|
ServicesTitle string
|
||||||
|
|
@ -196,6 +197,7 @@ func englishSet() TranslationSet {
|
||||||
NextContext: "next tab",
|
NextContext: "next tab",
|
||||||
Attach: "attach",
|
Attach: "attach",
|
||||||
ViewLogs: "view logs",
|
ViewLogs: "view logs",
|
||||||
|
CycleContainerLogsTail: "cycle how many log lines are shown",
|
||||||
UpProject: "up project",
|
UpProject: "up project",
|
||||||
DownProject: "down project",
|
DownProject: "down project",
|
||||||
RemoveImage: "remove image",
|
RemoveImage: "remove image",
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue