wslc: add --all to image list for docker parity - #41456
Conversation
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
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) toImageListCommandwith a localized help description. - Thread the new CLI flag through
GetImagesintoImageService::List, composing flags viaWI_SetFlagIf. - Add unit and E2E coverage validating argument registration, help output, and that
--allis 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.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
🟢 Approval recommended
The CLI wiring is minimal and consistent with existing patterns, and the added unit/E2E tests directly validate the new --all/-a surface area and behavior.
Review details
- Files reviewed: 7/7 changed files
- Comments generated: 0 new
- Review effort level: Lite
…helper Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
🟡 Changes recommended
A couple of newly-added test lines are likely to exceed the repo’s enforced 130-column clang-format limit and can fail formatting verification in CI.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Review details
Suppressed comments (1)
Previously missed (1) — in code that hasn't changed since the last review.
test/windows/wslc/WSLCCLICommandUnitTests.cpp:160
- This initializer list is on a single long line that exceeds the repo's clang-format ColumnLimit (130), which will cause
FormatSource.ps1 -Verifyto fail. Please split the entries across lines so clang-format doesn't need to reflow it.
- Files reviewed: 9/9 changed files
- Comments generated: 1
- Review effort level: Lite
Summary of the Pull Request
Adds
--all/-atowslc image list(and itsimage ls/imagesspellings), matchingdocker images --all. The service already accepted aWSLCListImagesFlagsAllflag; only the CLI needed to expose it.PR Checklist
Detailed Description of the Pull Request / Additional comments
WSLCListImagesFlagsAllwas already defined inWSLCShared.idland already honored end to end:WSLCSession::ListImagesunpacks it and forwards it toDocker().ListImages(all, digests, filters). The CLI simply never set it, so there was no way to reach the behavior fromwslc.ImageListCommandregistersArgType::Allwith a description override, following the existingImagePruneCommand/VolumePruneCommandpattern.ArgType::Allalready carries the-aalias, so no new argument type was needed.ImageService::Listtakes a new defaultedbool alland sets the flag. Flag assembly switched toWI_SetFlagIfso the two independent flags compose instead of overwriting each other.GetImagesreads the argument and forwards it.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 theimage listand root-scopedimagesconstructions register--allwith the-aalias 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 byimage list --quiet --no-truncmust also appear under--all,-a, andimages --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—--alland its localized description appear inimage list --help.