Skip to content

wslc: add --all to image list for docker parity - #41456

Open
ggarzia-MSFT wants to merge 1 commit into
masterfrom
user/ggarzia/wslc-images-all
Open

wslc: add --all to image list for docker parity#41456
ggarzia-MSFT wants to merge 1 commit into
masterfrom
user/ggarzia/wslc-images-all

Conversation

@ggarzia-MSFT

Copy link
Copy Markdown
Contributor

Summary of the Pull Request

Adds --all / -a to wslc image list (and its image ls / images spellings), matching docker images --all. The service already accepted a WSLCListImagesFlagsAll flag; only the CLI needed to expose it.

PR Checklist

  • Closes: Link to issue #xxx
  • Communication: I've discussed this with core contributors already. If work hasn't been agreed, this work might be rejected
  • Tests: Added/updated if needed and all pass
  • Localization: All end user facing strings can be localized
  • Dev docs: Added/updated if needed
  • Documentation updated: If checked, please file a pull request on our docs repo and link it here: #xxx

Detailed Description of the Pull Request / Additional comments

WSLCListImagesFlagsAll was already defined in WSLCShared.idl and already honored end to end: WSLCSession::ListImages unpacks it and forwards it to Docker().ListImages(all, digests, filters). The CLI simply never set it, so there was no way to reach the behavior from wslc.

  • ImageListCommand registers ArgType::All with a description override, following the existing ImagePruneCommand / VolumePruneCommand pattern. ArgType::All already carries the -a alias, so no new argument type was needed.
  • ImageService::List takes a new defaulted bool all and sets the flag. Flag assembly switched to WI_SetFlagIf so the two independent flags compose instead of overwriting each other.
  • GetImages reads the argument and forwards it.
  • New localized description WSLCCLI_ImageListAllArgDescription, worded to match docker: "Show all images (default hides intermediate images)."

Validation Steps Performed

All new and existing tests in the touched areas were run against a locally deployed build. 21/21 pass.

Unit test:

  • WSLCCLICommandUnitTests::ImageListCommand_HasAllArgument — asserts both the image list and root-scoped images constructions register --all with the -a alias as an optional flag. The root spelling is built through a separate constructor overload, so it is covered explicitly.

E2E tests (WSLCE2EImageListTests, 20 total, 3 new):

  • All_IsSupersetOfDefault — every image ID listed by image list --quiet --no-trunc must also appear under --all, -a, and images --all. Asserting a superset rather than an exact set keeps the test stable whether or not intermediate images happen to exist.
  • All_ListsLoadedImage — the loaded Debian test image is still present with --all.
  • All_ListedInHelp--all and its localized description appear in image list --help.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI lite review requested due to automatic review settings August 26, 2026 22:07
@ggarzia-MSFT
ggarzia-MSFT marked this pull request as ready for review August 26, 2026 22:08
@ggarzia-MSFT
ggarzia-MSFT requested review from a team as code owners August 26, 2026 22:08

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR exposes the already-supported WSLCListImagesFlagsAll behavior via the wslc CLI by adding --all / -a to wslc image list (and the images spelling), aligning behavior with docker images --all.

Changes:

  • Add --all (-a) to ImageListCommand with a localized help description.
  • Thread the new CLI flag through GetImages into ImageService::List, composing flags via WI_SetFlagIf.
  • Add unit and E2E coverage validating argument registration, help output, and that --all is a superset of the default listing.

Reviewed changes

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

Show a summary per file
File Description
test/windows/wslc/WSLCCLICommandUnitTests.cpp Adds a unit test verifying --all/-a is registered for both image list and images.
test/windows/wslc/e2e/WSLCE2EImageListTests.cpp Adds E2E tests covering --all behavior (superset property), presence of loaded image, and help text.
src/windows/wslc/tasks/ImageTasks.cpp Plumbs ArgType::All from parsed args into the image listing call.
src/windows/wslc/services/ImageService.h Extends ImageService::List signature with a defaulted all parameter.
src/windows/wslc/services/ImageService.cpp Sets WSLCListImagesFlagsAll (and composes with other flags) when requested.
src/windows/wslc/commands/ImageListCommand.cpp Registers ArgType::All with a command-specific localized description override.
localization/strings/en-US/Resources.resw Adds WSLCCLI_ImageListAllArgDescription localized string for --all help text.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

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