jesseduffield / lazydocker

The lazier way to manage everything docker

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Exec shell command doesn't appear in the menu for a service

dmi-dmi-dmi opened this issue · comments

Describe the bug
Exec shell command doesn't appear in the menu for a service

To Reproduce
Steps to reproduce the behavior:

  1. Focus on Services panel
  2. Open menu (x)
  3. Observe that there is no Exec shell entry

Expected behaviour
I expect Exec shell to be present for services too. Before lazydocker had custom command that opened shell and it worked for both standalone containers and services.

I should note that adding custom command as mentioned in the docs solves my problem (i.e. it works both for containers and services) but it makes me wonder if it is a bug as the yaml piece for customer command mentions only containers

P.S. It would be great to have template for Exec shell command in the config as we have for some commands alread. I am thinking about this since the command is not so simple.

This is an easy feature to implement given we already have the code there for containers. in pkg/gui/keybindings.go we have

		{
			ViewName:    "containers",
			Key:         'E',
			Modifier:    gocui.ModNone,
			Handler:     gui.handleContainersExecShell,
			Description: gui.Tr.ExecShell,
		},

handleContainersExecShell contains the logic for finding the current container and then running the shell on it. We should yank that logic out into a function which takes the container, so that we can then call that same function from a service-based equivalent called handleServicesExecShell (which can live in pkg/gui/services_panel.go).

So if we add a keybinding right under the snippet above which is exactly the same but pointing at the "services" view and pointing to gui.handleServicesExecShell, that will do the trick.

Any chance you'd be keen to give this a try @dmi-dmi-dmi ?

ezoic increase your site revenue