Commander.js: alias doesn't work with git-style commands

Created on 3 Jul 2015  路  7Comments  路  Source: tj/commander.js

Using alias with git-style commands like this doesn't work:

var program = require('commander');
program
  .version('0.0.1')
  .command('list', 'list some cool stuff')
  .alias('ls')
  .parse(process.argv);

Ideally I could just have pm and pm-list and the above would cause ./pm ls to invoke pm-list.

Most helpful comment

For anyone wondering,

This has apparently been fixed and merged into master, but not published to npm yet.

I'm pointing my dependency to the repo until the next release:

"commander": "git+https://github.com/tj/commander.js.git"

All 7 comments

This would be huge. These sub-commands are getting more and more popular.

+1

+1

This would be a really nice addition.

+1
Have been looking for this but found no solution. This would be a great addition.

For anyone wondering,

This has apparently been fixed and merged into master, but not published to npm yet.

I'm pointing my dependency to the repo until the next release:

"commander": "git+https://github.com/tj/commander.js.git"

+1
Yes @hedgerh solution works, but it would be nice to ship this in a new release :)
Any update? Sad... this project is almost dead, no release since October 2015.

any update?

I was not able to reproduce this. (Hopefully fixed!)

Feel free to open a new issue if it comes up again, with new information and renewed interest.

Thank you for your contributions.

Was this page helpful?
0 / 5 - 0 ratings