Skip to content

CLI: Align alias listing with docker, Apple and other CLIs - #41439

Merged
David Bennett (dkbennett) merged 2 commits into
masterfrom
user/dkbennett/commandaliashelp
Aug 28, 2026
Merged

CLI: Align alias listing with docker, Apple and other CLIs#41439
David Bennett (dkbennett) merged 2 commits into
masterfrom
user/dkbennett/commandaliashelp

Conversation

@dkbennett

@dkbennett David Bennett (dkbennett) commented Aug 25, 2026

Copy link
Copy Markdown
Member

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:
image

Example wslc alias listing with this change:
image

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:

  1. Canonical grouped command.
  2. Grouped aliases in declared order.
  3. Root-level shortcut or alias.

If there is only one command and no aliases nothing is printed at all (and the same is true for wslc).

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

Alias lists now:

  • Use the executable name derived from argv[0].
  • Include grouped, root-level, and existing command aliases.
  • Handle root-specific names such as wslc images.
  • Wrap at the console width only between complete aliases.
  • Remain unwrapped when output is redirected.

Added tests for aliases.

Validation Steps Performed

  • Ran WSLCE2ETests::WSLCE2EAliasTests: 3 passed, 0 failed.
  • Deployed the generated MSI for manual testing.

Copilot AI lite review requested due to automatic review settings August 25, 2026 21:13

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 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.

Comment thread test/windows/wslc/e2e/WSLCE2EAliasTests.cpp
Copilot AI review requested due to automatic review settings August 26, 2026 18:02

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

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

@dkbennett
David Bennett (dkbennett) marked this pull request as ready for review August 27, 2026 17:24
@dkbennett
David Bennett (dkbennett) merged commit 4bfbaca into master Aug 28, 2026
12 checks passed
@dkbennett
David Bennett (dkbennett) deleted the user/dkbennett/commandaliashelp branch August 28, 2026 18:17
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.

3 participants