mirror of
https://github.com/jesseduffield/lazydocker.git
synced 2026-07-22 07:11:01 +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
|
||||
Client *client.Client
|
||||
InDockerComposeProject bool
|
||||
ShowExited bool
|
||||
ErrorChan chan error
|
||||
ContainerMutex sync.Mutex
|
||||
ServiceMutex sync.Mutex
|
||||
|
|
|
|||
|
|
@ -277,7 +277,17 @@ 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))
|
||||
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 {
|
||||
return err
|
||||
}
|
||||
|
|
@ -371,6 +381,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: 'h',
|
||||
Modifier: gocui.ModNone,
|
||||
Handler: gui.handleHideStoppedContainers,
|
||||
Description: gui.Tr.HideStopped,
|
||||
},
|
||||
{
|
||||
ViewName: "containers",
|
||||
Key: 's',
|
||||
|
|
|
|||
|
|
@ -31,6 +31,7 @@ type TranslationSet struct {
|
|||
Cancel string
|
||||
CustomCommandTitle string
|
||||
Remove string
|
||||
HideStopped string
|
||||
ForceRemove string
|
||||
RemoveWithVolumes string
|
||||
MustForceToRemoveContainer string
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue