cac icon indicating copy to clipboard operation
cac copied to clipboard

Can't create command with alias to default command

Open domdomegg opened this issue 1 year ago • 0 comments

Issue Type

  • [x] Bug Report
  • [ ] Feature Request
  • [ ] Other

Expected

cli
  .command("something", "Do something")
  .alias("!")
  .action(async () => {
    console.log("Did something!");
  });

Should log 'Did something!' if you run cli something or cli

Actual

Only logs when running cli something

Possible Solutions

https://github.com/cacjs/cac/blob/abe662b577429b854b1eb6f811d828d23f21ce1c/src/CAC.ts#L200-L210 should use command.isDefaultCommand rather than the name.

We should also add documentation explaining the ! alias.

Info

  • CAC version: 6.7.14
  • Reproduction link: https://replit.com/@domdomegg/cac-151#index.js

domdomegg avatar Feb 17 '23 13:02 domdomegg