mirror of
https://github.com/jesseduffield/lazydocker.git
synced 2026-07-25 00:21:04 +00:00
Added h key binding
This commit is contained in:
parent
4dc13ebda5
commit
b89b02eee5
4 changed files with 25 additions and 1 deletions
|
|
@ -29,6 +29,7 @@ type DockerCommand struct {
|
||||||
Config *config.AppConfig
|
Config *config.AppConfig
|
||||||
Client *client.Client
|
Client *client.Client
|
||||||
InDockerComposeProject bool
|
InDockerComposeProject bool
|
||||||
|
ShowExited bool
|
||||||
ErrorChan chan error
|
ErrorChan chan error
|
||||||
ContainerMutex sync.Mutex
|
ContainerMutex sync.Mutex
|
||||||
ServiceMutex sync.Mutex
|
ServiceMutex sync.Mutex
|
||||||
|
|
|
||||||
|
|
@ -277,7 +277,17 @@ func (gui *Gui) refreshContainersAndServices() error {
|
||||||
gui.g.Update(func(g *gocui.Gui) error {
|
gui.g.Update(func(g *gocui.Gui) error {
|
||||||
containersView.Clear()
|
containersView.Clear()
|
||||||
isFocused := gui.g.CurrentView().Name() == "containers"
|
isFocused := gui.g.CurrentView().Name() == "containers"
|
||||||
list, err := utils.RenderList(gui.DockerCommand.DisplayContainers, utils.IsFocused(isFocused))
|
toRender := gui.DockerCommand.DisplayContainers
|
||||||
|
if !gui.DockerCommand.ShowExited {
|
||||||
|
toRender = []*commands.Container{}
|
||||||
|
for _, container := range gui.DockerCommand.DisplayContainers {
|
||||||
|
if container.Container.State != "exited" {
|
||||||
|
toRender = append(toRender, container)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
list, err := utils.RenderList(toRender, utils.IsFocused(isFocused))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
@ -371,6 +381,11 @@ func (r *removeContainerOption) GetDisplayStrings(isFocused bool) []string {
|
||||||
return []string{r.description, color.New(color.FgRed).Sprint(r.command)}
|
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 {
|
func (gui *Gui) handleContainersRemoveMenu(g *gocui.Gui, v *gocui.View) error {
|
||||||
container, err := gui.getSelectedContainer()
|
container, err := gui.getSelectedContainer()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
||||||
|
|
@ -211,6 +211,13 @@ func (gui *Gui) GetInitialKeybindings() []*Binding {
|
||||||
Handler: gui.handleContainersRemoveMenu,
|
Handler: gui.handleContainersRemoveMenu,
|
||||||
Description: gui.Tr.Remove,
|
Description: gui.Tr.Remove,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
ViewName: "containers",
|
||||||
|
Key: 'h',
|
||||||
|
Modifier: gocui.ModNone,
|
||||||
|
Handler: gui.handleHideStoppedContainers,
|
||||||
|
Description: gui.Tr.HideStopped,
|
||||||
|
},
|
||||||
{
|
{
|
||||||
ViewName: "containers",
|
ViewName: "containers",
|
||||||
Key: 's',
|
Key: 's',
|
||||||
|
|
|
||||||
|
|
@ -31,6 +31,7 @@ type TranslationSet struct {
|
||||||
Cancel string
|
Cancel string
|
||||||
CustomCommandTitle string
|
CustomCommandTitle string
|
||||||
Remove string
|
Remove string
|
||||||
|
HideStopped string
|
||||||
ForceRemove string
|
ForceRemove string
|
||||||
RemoveWithVolumes string
|
RemoveWithVolumes string
|
||||||
MustForceToRemoveContainer string
|
MustForceToRemoveContainer string
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue