Skip to content

feat(cli): add command and group aliases - #26

Merged
abraithwaite merged 1 commit into
mainfrom
alan-cli-aliases
Jul 15, 2026
Merged

feat(cli): add command and group aliases#26
abraithwaite merged 1 commit into
mainfrom
alan-cli-aliases

Conversation

@abraithwaite

Copy link
Copy Markdown
Member

What

Adds an Aliases(...) CmdOption to lib/cli so a command or group can answer to alternate names.

  • Aliases are matched during routing (routeArgsWithPath) and completion traversal (computeCompletions) via a new nodeMatches helper.
  • Aliases are hidden from parent help listings and completion suggestions (canonical names only).
  • A command's own --help shows an Aliases: line.

Why

Supports the runreveal runreveal api CLI cleanup (runreveal#TBD): several endpoints are being renamed to kebab-case, and the CLI keeps the old subcommand names working as aliases.

Tests

New table tests in cli_test.go (routing via canonical + aliases, group aliases, help visibility) and complete_test.go (aliases not suggested, flag completion works through an alias). go test ./cli/... passes.

Adds an Aliases(...) CmdOption so a command or group answers to alternate
names. Aliases are matched during routing and completion traversal but are
hidden from help listings and completion suggestions; a command's own --help
shows an "Aliases:" line. Useful for keeping old command names working after
a rename.
@abraithwaite
abraithwaite marked this pull request as ready for review July 15, 2026 21:42
@abraithwaite
abraithwaite merged commit 06ac0c2 into main Jul 15, 2026
1 check passed
@abraithwaite
abraithwaite deleted the alan-cli-aliases branch July 15, 2026 21:42
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.

1 participant