镜像站点 · 本页由第三方 GitHub 只读镜像提供,非 GitHub 官方站点,不接受任何登录或凭据输入。前往 github.com
Skip to content

feat(command): support multiple aliases in alias() - #183

Open
ychampion wants to merge 1 commit into
cacjs:mainfrom
ychampion:feat/multiple-aliases
Open

ychampion wants to merge 1 commit into
cacjs:mainfrom
ychampion:feat/multiple-aliases

Conversation

@ychampion

Copy link
Copy Markdown

Fixes #57

Summary

Allow command.alias() to register multiple aliases in a single call via either separate arguments or string arrays, while keeping single-string and chained .alias() calls unchanged:

cli
  .command('format [...files]', 'Format files')
  .alias(['fmt', 'fromat', 'foramt'])
  // or
  .alias('fmt', 'fromat', 'foramt')

Changes

  • Update Command#alias in src/command.ts to accept ...names: (string | readonly string[])[] and flatten into this.aliasNames.
  • Update command.alias signature documentation in README.md and skills/cac/SKILL.md.
  • Add unit tests in tests/index.test.ts covering rest arguments, string/readonly arrays, chained .alias() calls, and default-command '!' combined with named aliases.

Allow command.alias() to register multiple aliases via rest arguments
or string arrays while preserving single-string and chained calls.

Fixes cacjs#57
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.

alias() to support multiple aliases

1 participant