Skip to content

cli: resolve subcommand path in container help#1587

Merged
jglogan merged 2 commits into
apple:mainfrom
0xMH:fix/1509-help-subcommand
May 27, 2026
Merged

cli: resolve subcommand path in container help#1587
jglogan merged 2 commits into
apple:mainfrom
0xMH:fix/1509-help-subcommand

Conversation

@0xMH
Copy link
Copy Markdown
Contributor

@0xMH 0xMH commented May 22, 2026

Type of Change

  • Bug fix
  • New feature
  • Breaking change
  • Documentation update

Motivation and Context

Fixes #1509. The CLI's own help text tells users to run container help <subcommand>, but every form of that errored:

$ container help image delete
Error: 2 unexpected arguments: 'image', 'delete'
$ container help run
Error: Unexpected argument 'run'

The project's custom HelpCommand (registered so plugins show up in top-level help) had no positional @Argument, so swift-argument-parser routed help <x> to it and rejected the trailing tokens. Added a captured subcommand path, walked Application's subcommands + groupedSubcommands tree (matching commandName and aliases), and printed Application.helpMessage(for:) for the resolved target. Empty path keeps existing plugin-aware top-level help; unknown path throws ValidationError.

Testing

  • Tested locally
  • Added/updated tests
  • Added/updated docs

@0xMH 0xMH force-pushed the fix/1509-help-subcommand branch 2 times, most recently from 965d320 to 70107ce Compare May 26, 2026 19:56
@0xMH 0xMH force-pushed the fix/1509-help-subcommand branch from 70107ce to 43aa8f0 Compare May 26, 2026 20:02
@github-actions
Copy link
Copy Markdown

Code Coverage

Tier Line Coverage
Unit 33.49%
Integration 19.62%
Combined 52.56%

Copy link
Copy Markdown
Contributor

@jglogan jglogan left a comment

Choose a reason for hiding this comment

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

Looks really good @0xMH! Thanks for the contribution.

@jglogan jglogan merged commit 685966d into apple:main May 27, 2026
3 checks passed
@0xMH
Copy link
Copy Markdown
Contributor Author

0xMH commented May 27, 2026

You are welcome @jglogan. Thanks for reviewing!

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.

[Bug]: help subcommand doesn't work

3 participants