lazydocker/pkg/gui
Tim Abell 9545538106
Add docker-compose profile support
Implements the design captured in docs/adr/0001-docker-compose-profile-support.md
(jesseduffield/lazydocker#423). Profiles render as pseudo-projects in the
project panel; selecting one filters the services and containers panels to
the services that activate with that profile, and Up/Down/Restart on the
selection use docker compose --profile X invocations.

Key choices:

- Profile is a flag on Project (IsProfile bool), not a new type. Avoids a
  generic-type split across the SideListPanel and CommandObject.

- Reuse existing command templates (Up, Down, DownWithVolumes, Restart,
  AllLogs, DockerComposeConfig). NewCommandObject appends --profile X when
  a profile context is set, so no separate UpProfile/DownProfile/... family
  is needed. Adds a new Restart template (master had no project-level
  restart at all).

- Discovery via 'docker compose config --profiles' and
  'docker compose --profile X config --services', cached on DockerCommand
  for the session. Soft-fails on error (logs once, caches empty) so the UI
  degrades to "no profile rows" rather than popping an error.

- Per-profile service filtering uses the local project and the profile's
  service set (default services + profile-X services, per docker semantics).

- No new keybinding for project/profile restart in this PR; handler exists
  for follow-up discussion.

- New unit tests cover NewCommandObject --profile injection, GetProfiles
  caching, GetProfileServices caching, and the soft-fail path.

fixes: https://github.com/jesseduffield/lazydocker/issues/423

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-19 14:48:50 +01:00
..
panels Improve projects support 2026-03-15 14:53:48 +11:00
presentation Add docker-compose profile support 2026-05-19 14:48:50 +01:00
types move things into presentation package 2022-11-09 21:21:36 +11:00
app_status_manager.go clean up some things 2022-10-09 18:36:42 -07:00
arrangement.go Hide project/services panels when not in a docker-compose project 2026-03-15 22:26:03 +00:00
confirmation_panel.go Remove loader code for confirmation panel 2024-05-26 14:04:25 +10:00
container_logs.go go.mod: github.com/docker/docker, docker/cli v25.0.5 2024-07-15 11:25:11 +02:00
containers_panel.go Add docker-compose profile support 2026-05-19 14:48:50 +01:00
custom_commands.go Re-enable custom command template application (#470) 2023-08-03 20:38:53 +10:00
filtering.go more refactoring of list panels 2022-11-09 21:21:36 +11:00
focus.go more refactoring of list panels 2022-11-09 21:21:36 +11:00
gocui.go changed "white" colors to "default" to work in both light and dark terminals 2022-08-16 13:53:33 +02:00
gui.go Use IsProjectScoped at remaining call sites + add test 2026-04-19 12:47:30 +10:00
images_panel.go go.mod: github.com/docker/docker, docker/cli v26.1.4 2024-07-15 11:37:10 +02:00
keybindings.go Add navigation via numbers 2024-07-26 15:58:45 +02:00
layout.go Improve projects support 2026-03-15 14:53:48 +11:00
main_panel.go use context instead of struct channel 2022-11-10 19:38:49 +11:00
menu_panel.go separate quit and close options 2022-11-10 19:45:32 +11:00
networks_panel.go Add networks panel 2023-03-06 01:25:23 +03:00
options_menu_panel.go use context instead of struct channel 2022-11-10 19:38:49 +11:00
panels.go more refactoring of list panels 2022-11-09 21:21:36 +11:00
project_panel.go Add docker-compose profile support 2026-05-19 14:48:50 +01:00
services_panel.go Add docker-compose profile support 2026-05-19 14:48:50 +01:00
sort_container_test.go Fix types 2025-11-14 21:20:28 +11:00
subprocess.go Appease linter 2023-10-10 17:39:09 +11:00
tasks_adapter.go use context instead of struct channel 2022-11-10 19:38:49 +11:00
theme.go allow changing window size 2022-10-09 18:02:11 -07:00
view_helpers.go Add navigation via numbers 2024-07-26 15:58:45 +02:00
views.go Use IsProjectScoped at remaining call sites + add test 2026-04-19 12:47:30 +10:00
volumes_panel.go better way of rendering to the main view 2022-11-10 19:14:12 +11:00
window.go clean up some things 2022-10-09 18:36:42 -07:00