jesseduffield / jesseduffield/lazydocker
Custom commands can't be opened when there are no items in the list
- Dominant language
- Go
- Stars
- 52.8k
- Forks
- 1.7k
- PR merge metrics
- No merged PRs in 30d
Description
**Custom commands can't be opened when there are no items in the list (containers, images, volumes, services respectively).**
I'm not sure whether this is a bug report or feature request. For my use case, it feels like a bug, but I can see how it could be intended behavior.
**To Reproduce**
Add some custom command to the `~/.config/lazydocker/config.yml`:
```
customCommands:
containers:
- name: My custom command
attach: false
command: '{{ .DockerCompose }} -f /home/user/my-docker-compose.yml up -d'
serviceNames: []
```
On an empty "Containers" list (see screenshot):
1. Highlight the "Containers" area
2. Press the shortcut to open the custom command selection (default: c)
3. Notice the custom command selection does not open
**Expected behaviour**
The custom command selection opens, even when there are no containers in the list.
Ideally, only custom commands that do not depend on a highlighted context item (container, image, volume, service) are listed. The example above does not depend on anything and could run even when no context item is available.
I never used a custom command that depends on a context item of the list, so I'm not sure this is correct, but an example command that I can think of which references an item maybe looks something like: `{{ .DockerCompose }} something something {{ .Container.Name }}` (where .Container.Name is the name of the highlighted container?).
Or, would it perhaps make sense to have a new kind of custom command that's independent of any of the areas?
Or maybe I am using lazydocker wrong, also possible. I really love the custom command feature, but I might be abusing it. Where would I put my small collection of commands that do not depend on a highlighted item?
**Screenshots**
An empty "containers" list:

**Desktop (please complete the following information):**
- OS: Pop!_OS 21.10
- Lazydocker Version 0.12
Contributor guide
Assessment
This issue has not been assessed yet.