mirror of
https://github.com/jesseduffield/lazydocker.git
synced 2026-07-21 23:01:03 +00:00
Merge pull request #111 from mjarkk/f110
Added `e` keybinding for toggling visibility stopped containers
This commit is contained in:
commit
cca69e64f3
10 changed files with 41 additions and 6 deletions
|
|
@ -17,6 +17,7 @@
|
|||
<kbd>[</kbd>: vorheriges Tab
|
||||
<kbd>]</kbd>: nächstes Tab
|
||||
<kbd>d</kbd>: entfernen
|
||||
<kbd>e</kbd>: Hide/Show stopped containers
|
||||
<kbd>s</kbd>: anhalten
|
||||
<kbd>r</kbd>: neustarten
|
||||
<kbd>a</kbd>: anbinden
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@
|
|||
<kbd>[</kbd>: previous tab
|
||||
<kbd>]</kbd>: next tab
|
||||
<kbd>d</kbd>: remove
|
||||
<kbd>e</kbd>: Hide/Show stopped containers
|
||||
<kbd>s</kbd>: stop
|
||||
<kbd>r</kbd>: restart
|
||||
<kbd>a</kbd>: attach
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@
|
|||
<kbd>[</kbd>: vorige tab
|
||||
<kbd>]</kbd>: volgende tab
|
||||
<kbd>d</kbd>: verwijder
|
||||
<kbd>e</kbd>: Verberg gestopte containers
|
||||
<kbd>s</kbd>: stop
|
||||
<kbd>r</kbd>: herstart
|
||||
<kbd>a</kbd>: verbinden
|
||||
|
|
@ -36,7 +37,7 @@
|
|||
<kbd>m</kbd>: bekijk logs
|
||||
<kbd>[</kbd>: vorige tab
|
||||
<kbd>]</kbd>: volgende tab
|
||||
<kbd>R</kbd>: beijk herstart opties
|
||||
<kbd>R</kbd>: bekijk herstart opties
|
||||
<kbd>c</kbd>: draai een vooraf bedacht aangepaste opdracht
|
||||
<kbd>enter</kbd>: focus hooft panneel
|
||||
</pre>
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@
|
|||
<kbd>[</kbd>: poprzednia zakładka
|
||||
<kbd>]</kbd>: następna zakładka
|
||||
<kbd>d</kbd>: usuń
|
||||
<kbd>e</kbd>: Hide/Show stopped containers
|
||||
<kbd>s</kbd>: zatrzymaj
|
||||
<kbd>r</kbd>: restartuj
|
||||
<kbd>a</kbd>: przyczep
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@
|
|||
<kbd>[</kbd>: önceki sekme
|
||||
<kbd>]</kbd>: sonraki sekme
|
||||
<kbd>d</kbd>: kaldır
|
||||
<kbd>e</kbd>: Hide/Show stopped containers
|
||||
<kbd>s</kbd>: durdur
|
||||
<kbd>r</kbd>: yeniden başlat
|
||||
<kbd>a</kbd>: bağlan/iliştir
|
||||
|
|
|
|||
|
|
@ -29,6 +29,7 @@ type DockerCommand struct {
|
|||
Config *config.AppConfig
|
||||
Client *client.Client
|
||||
InDockerComposeProject bool
|
||||
ShowExited bool
|
||||
ErrorChan chan error
|
||||
ContainerMutex sync.Mutex
|
||||
ServiceMutex sync.Mutex
|
||||
|
|
@ -73,6 +74,7 @@ func NewDockerCommand(log *logrus.Entry, osCommand *OSCommand, tr *i18n.Translat
|
|||
Config: config,
|
||||
Client: cli,
|
||||
ErrorChan: errorChan,
|
||||
ShowExited: true,
|
||||
InDockerComposeProject: true,
|
||||
}
|
||||
|
||||
|
|
@ -213,10 +215,8 @@ func (c *DockerCommand) RefreshContainersAndServices() error {
|
|||
|
||||
c.assignContainersToServices(containers, services)
|
||||
|
||||
var displayContainers []*Container
|
||||
if c.Config.UserConfig.Gui.ShowAllContainers {
|
||||
displayContainers = containers
|
||||
} else {
|
||||
var displayContainers = containers
|
||||
if !c.Config.UserConfig.Gui.ShowAllContainers {
|
||||
displayContainers = c.obtainStandaloneContainers(containers, services)
|
||||
}
|
||||
|
||||
|
|
@ -235,7 +235,7 @@ func (c *DockerCommand) RefreshContainersAndServices() error {
|
|||
|
||||
c.Containers = containers
|
||||
c.Services = services
|
||||
c.DisplayContainers = displayContainers
|
||||
c.DisplayContainers = c.filterOutExited(displayContainers)
|
||||
|
||||
return nil
|
||||
}
|
||||
|
|
@ -253,6 +253,20 @@ L:
|
|||
}
|
||||
}
|
||||
|
||||
// filterOutExited filters out the exited containers if c.ShowExited is false
|
||||
func (c *DockerCommand) filterOutExited(containers []*Container) []*Container {
|
||||
if c.ShowExited {
|
||||
return containers
|
||||
}
|
||||
toReturn := []*Container{}
|
||||
for _, container := range containers {
|
||||
if container.Container.State != "exited" {
|
||||
toReturn = append(toReturn, container)
|
||||
}
|
||||
}
|
||||
return toReturn
|
||||
}
|
||||
|
||||
// obtainStandaloneContainers returns standalone containers. Standalone containers are containers which are either one-off containers, or whose service is not part of this docker-compose context
|
||||
func (c *DockerCommand) obtainStandaloneContainers(containers []*Container, services []*Service) []*Container {
|
||||
standaloneContainers := []*Container{}
|
||||
|
|
|
|||
|
|
@ -277,6 +277,7 @@ func (gui *Gui) refreshContainersAndServices() error {
|
|||
gui.g.Update(func(g *gocui.Gui) error {
|
||||
containersView.Clear()
|
||||
isFocused := gui.g.CurrentView().Name() == "containers"
|
||||
|
||||
list, err := utils.RenderList(gui.DockerCommand.DisplayContainers, utils.IsFocused(isFocused))
|
||||
if err != nil {
|
||||
return err
|
||||
|
|
@ -371,6 +372,11 @@ func (r *removeContainerOption) GetDisplayStrings(isFocused bool) []string {
|
|||
return []string{r.description, color.New(color.FgRed).Sprint(r.command)}
|
||||
}
|
||||
|
||||
func (gui *Gui) handleHideStoppedContainers(g *gocui.Gui, v *gocui.View) error {
|
||||
gui.DockerCommand.ShowExited = !gui.DockerCommand.ShowExited
|
||||
return nil
|
||||
}
|
||||
|
||||
func (gui *Gui) handleContainersRemoveMenu(g *gocui.Gui, v *gocui.View) error {
|
||||
container, err := gui.getSelectedContainer()
|
||||
if err != nil {
|
||||
|
|
|
|||
|
|
@ -211,6 +211,13 @@ func (gui *Gui) GetInitialKeybindings() []*Binding {
|
|||
Handler: gui.handleContainersRemoveMenu,
|
||||
Description: gui.Tr.Remove,
|
||||
},
|
||||
{
|
||||
ViewName: "containers",
|
||||
Key: 'e',
|
||||
Modifier: gocui.ModNone,
|
||||
Handler: gui.handleHideStoppedContainers,
|
||||
Description: gui.Tr.HideStopped,
|
||||
},
|
||||
{
|
||||
ViewName: "containers",
|
||||
Key: 's',
|
||||
|
|
|
|||
|
|
@ -31,6 +31,7 @@ func dutchSet() TranslationSet {
|
|||
EditConfig: "verander de lazydocker configuratie",
|
||||
Cancel: "annuleren",
|
||||
Remove: "verwijder",
|
||||
HideStopped: "Verberg gestopte containers",
|
||||
ForceRemove: "geforceerd verwijderen",
|
||||
RemoveWithVolumes: "verwijder met volumes",
|
||||
RemoveService: "verwijder containers",
|
||||
|
|
|
|||
|
|
@ -29,6 +29,7 @@ type TranslationSet struct {
|
|||
Cancel string
|
||||
CustomCommandTitle string
|
||||
Remove string
|
||||
HideStopped string
|
||||
ForceRemove string
|
||||
RemoveWithVolumes string
|
||||
MustForceToRemoveContainer string
|
||||
|
|
@ -113,6 +114,7 @@ func englishSet() TranslationSet {
|
|||
EditConfig: "edit lazydocker config",
|
||||
Cancel: "cancel",
|
||||
Remove: "remove",
|
||||
HideStopped: "Hide/Show stopped containers",
|
||||
ForceRemove: "force remove",
|
||||
RemoveWithVolumes: "remove with volumes",
|
||||
RemoveService: "remove containers",
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue