Skip to content

feat(docker): add environment display mode with container listing and filter support#7434

Open
Lurchfresser wants to merge 5 commits intoJanDeDobbeleer:mainfrom
Lurchfresser:main
Open

feat(docker): add environment display mode with container listing and filter support#7434
Lurchfresser wants to merge 5 commits intoJanDeDobbeleer:mainfrom
Lurchfresser:main

Conversation

@Lurchfresser
Copy link
Copy Markdown

Prerequisites

  • [✅ ] I have read and understood the contributing guide.
  • [ ✅] The commit message follows the conventional commits guidelines.
  • [ ✅] Tests for the changes have been added (for bug fixes / features).
  • [ ✅] Docs have been added/updated (for bug fixes / features).

Description

Added display_mode environment to the docker segment. When this displaymode is used, the block is active as long as the docker command exists.
If this display mode is chosen, docker ps is executed and the output is parsed and supplied in a list.
The user can add filters according to cli-spec.
The user can also provide an alias for the docker command

I did not change code for the other display_modes and did not change the template, to not break existing configs.

Copilot AI review requested due to automatic review settings April 5, 2026 00:22
Copy link
Copy Markdown
Contributor

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

Adds an environment display_mode to the Docker CLI segment to surface running container information (via docker ps) and exposes new configuration options for command aliasing and filtering.

Changes:

  • Added environment display mode to the Docker segment, including parsing docker ps --format output into a .Containers template property.
  • Extended config/schema to support docker_command and filter options.
  • Updated segment docs to document the new mode and properties, and added tests for environment mode behavior.

Reviewed changes

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

File Description
website/docs/segments/cli/docker.mdx Documents environment mode and new template properties/options.
themes/schema.json Extends Docker segment schema with environment, docker_command, and filter.
src/segments/docker.go Implements environment mode and container listing/parsing.
src/segments/docker_test.go Adds test coverage for environment mode enablement and parsing.

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings April 5, 2026 00:26
Copy link
Copy Markdown
Contributor

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

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

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings April 5, 2026 00:30
Copy link
Copy Markdown
Contributor

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

Copilot reviewed 4 out of 4 changed files in this pull request and generated no new comments.

Copilot AI review requested due to automatic review settings April 9, 2026 16:59
Copy link
Copy Markdown
Contributor

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

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.

## What

Display the current [Docker][docker] context. Will not be active when using the default context.
Display the current [Docker][docker] context, or a list of running containers when `display_mode` is set to `environment`.
Copy link

Copilot AI Apr 9, 2026

Choose a reason for hiding this comment

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

The updated “What” description no longer mentions that in context mode the segment is disabled when the active Docker context is default (the code still explicitly ignores default). Please update the docs to reflect that behavior so users don’t expect the segment to show in the default context.

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

@copilot apply changes based on this feedback

Comment on lines +118 to +125
containers, err := d.fetchContainers()
if err != nil {
return false
}

d.Containers = containers

return len(d.Containers) > 0
Copy link

Copilot AI Apr 9, 2026

Choose a reason for hiding this comment

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

environment mode currently enables the segment only when at least one container is returned (len(d.Containers) > 0). This conflicts with the PR description (“active as long as the docker command exists”) and makes it impossible to render a “0 running” state. Please align the behavior (or docs) by either enabling the segment whenever the command exists (and leaving .Containers empty), or updating the description to match the current behavior.

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

@copilot apply changes based on this feedback

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