Skip to content

Support -p flag again#797

Merged
jesseduffield merged 3 commits into
masterfrom
support-p-flag
Apr 19, 2026
Merged

Support -p flag again#797
jesseduffield merged 3 commits into
masterfrom
support-p-flag

Conversation

@jesseduffield
Copy link
Copy Markdown
Owner

No description provided.

Copilot AI review requested due to automatic review settings April 19, 2026 02:19
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Restores “project-scoped” UI behavior when running lazydocker with -p outside of a docker-compose project directory, so project/services panels can appear again and container filtering can be applied.

Changes:

  • Introduce DockerCommand.IsProjectScoped() and use it to decide when to show project/services panels and apply container filtering.
  • Initialize LocalProjectName from -p when not in a compose directory.
  • Add a guard message for compose config rendering when not launched from a compose directory.
  • Add repo guidance for vendored Go builds/tests and adjust Claude hook formatting behavior.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
pkg/gui/services_panel.go Show/hide services panel based on IsProjectScoped()
pkg/gui/project_panel.go Show/hide project panel via IsProjectScoped(); guard compose config rendering outside compose dir
pkg/gui/containers_panel.go Apply project/standalone filtering when IsProjectScoped()
pkg/commands/docker.go Add IsProjectScoped() and LocalProjectName init when -p is used outside compose dir
CLAUDE.md Document vendored Go build/test commands
.claude/settings.json Update PostToolUse hook matcher/command for formatting
Comments suppressed due to low confidence (1)

pkg/gui/containers_panel.go:98

  • The inline comment still refers to an “InDockerComposeProject guard”, but the condition is now IsProjectScoped(). This makes the rationale unclear/misleading—update the comment to reference the new guard (or clarify the actual condition that needs to hold).
				// This check must be inside the InDockerComposeProject guard:
				// outside a compose project, services are still derived from
				// container labels, so compose-managed containers from other
				// projects would be incorrectly hidden.
				//

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread pkg/commands/docker.go
Comment on lines +157 to +163
// When the user passes -p outside of a compose directory, treat it as the
// local project so the project/services panels still appear and filtering
// is applied. Inside a compose dir, LocalProjectName is derived from
// container labels later in RefreshContainersAndServices.
if !dockerCommand.InDockerComposeProject && config.ProjectName != "" {
dockerCommand.LocalProjectName = config.ProjectName
}
Comment thread pkg/commands/docker.go
Comment on lines +168 to +174
// IsProjectScoped reports whether lazydocker should be scoped to a single
// compose project — either because we're inside a compose directory or
// because the user passed -p. When false, the project/services panels are
// hidden and all containers are shown in a flat list.
func (c *DockerCommand) IsProjectScoped() bool {
return c.InDockerComposeProject || c.Config.ProjectName != ""
}
Addresses Copilot review comments on PR #797:
- Containers panel title, initial focus selection, and the local-project
  inclusion in getDiscoveredProjects all switched from
  InDockerComposeProject to IsProjectScoped, so they stay consistent
  when -p is given outside a compose dir.
- Adds TestIsProjectScoped table test covering all four combinations.

InDockerComposeProject is still used at the call sites that genuinely
require a compose dir (renderDockerComposeConfig, GetServices).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@jesseduffield jesseduffield merged commit 7e7aadc into master Apr 19, 2026
5 checks passed
@jesseduffield jesseduffield deleted the support-p-flag branch April 19, 2026 02:50
tmeijn pushed a commit to tmeijn/dotfiles that referenced this pull request Apr 21, 2026
This MR contains the following updates:

| Package | Update | Change |
|---|---|---|
| [jesseduffield/lazydocker](https://github.com/jesseduffield/lazydocker) | patch | `v0.25.0` → `v0.25.2` |

MR created with the help of [el-capitano/tools/renovate-bot](https://gitlab.com/el-capitano/tools/renovate-bot).

**Proposed changes to behavior should be submitted there as MRs.**

---

### Release Notes

<details>
<summary>jesseduffield/lazydocker (jesseduffield/lazydocker)</summary>

### [`v0.25.2`](https://github.com/jesseduffield/lazydocker/releases/tag/v0.25.2)

[Compare Source](jesseduffield/lazydocker@v0.25.0...v0.25.2)

#### Changelog

- [`697cd44`](jesseduffield/lazydocker@697cd44) Add some claude stuff
- [`b17d474`](jesseduffield/lazydocker@b17d474) Fixed forced project view
- [`e3c1c86`](jesseduffield/lazydocker@e3c1c86) Hide project/services panels when not in a docker-compose project
- [`ebce4fc`](jesseduffield/lazydocker@ebce4fc) Initial plan
- [`9134abe`](jesseduffield/lazydocker@9134abe) Merge pull request [#&#8203;776](jesseduffield/lazydocker#776) from jesseduffield/copilot/disable-forced-project-view
- [`8106125`](jesseduffield/lazydocker@8106125) Merge pull request [#&#8203;795](jesseduffield/lazydocker#795) from ddibiasi/copilot/disable-forced-project-view
- [`7e7aadc`](jesseduffield/lazydocker@7e7aadc) Merge pull request [#&#8203;797](jesseduffield/lazydocker#797) from jesseduffield/support-p-flag
- [`3974f6f`](jesseduffield/lazydocker@3974f6f) Support -p flag and DRY up code
- [`f5ff116`](jesseduffield/lazydocker@f5ff116) Use IsProjectScoped at remaining call sites + add test

</details>

---

### Configuration

📅 **Schedule**: (UTC)

- Branch creation
  - At any time (no schedule defined)
- Automerge
  - At any time (no schedule defined)

🚦 **Automerge**: Enabled.

♻ **Rebasing**: Whenever MR is behind base branch, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this MR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this MR, check this box

---

This MR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0My4xMzYuMiIsInVwZGF0ZWRJblZlciI6IjQzLjEzNi4yIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJSZW5vdmF0ZSBCb3QiLCJhdXRvbWF0aW9uOmJvdC1hdXRob3JlZCIsImRlcGVuZGVuY3ktdHlwZTo6cGF0Y2giXX0=-->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants