CLI: Align alias listing with docker, Apple and other CLIs - #41439
Merged
David Bennett (dkbennett) merged 2 commits intoAug 28, 2026
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates WSLC CLI help output so the Aliases section lists each command’s aliases as fully-qualified invocations (including equivalent root-level forms like wslc images), and wraps alias output at console width boundaries when writing to an interactive console.
Changes:
- Build a full-invocation alias list by discovering all registrations of the same command (including root-scoped equivalents) and formatting them with the current executable name.
- Wrap alias listings at console width only between alias tokens, preserving indentation.
- Add E2E coverage asserting the new alias listing format for a few representative commands.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| test/windows/wslc/e2e/WSLCE2EAliasTests.cpp | Adds E2E assertions for the new “full invocation” alias listing in --help output. |
| src/windows/wslc/core/Command.cpp | Implements discovery/formatting of full invocation aliases and wraps alias output based on console width when interactive. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
David Bennett (dkbennett)
marked this pull request as ready for review
August 27, 2026 17:24
ggarzia-MSFT
approved these changes
Aug 27, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary of the Pull Request
Improves WSLC command help by displaying every registered invocation of a command as a fully qualified alias, including equivalent commands exposed at the root. This aligns with docker. If the list is longer than console width it wraps at the alias boundary and keeps at same indentation.
Example docker alias listing:

Example wslc alias listing with this change:

Note that the difference in ordering is due to docker treating "image ls" as the canonical and "image list" as the alias, while wslc treats "image list" as the canonical and "image ls" as the alias. This is the way the command is defined and not a result of the alias listing being incorrect. The canonical is listed first always in the alias list.
The conventional order for alias lists is:
If there is only one command and no aliases nothing is printed at all (and the same is true for wslc).
PR Checklist
Detailed Description of the Pull Request / Additional comments
Alias lists now:
argv[0].wslc images.Added tests for aliases.
Validation Steps Performed
WSLCE2ETests::WSLCE2EAliasTests: 3 passed, 0 failed.