dthree / vorpal

Node's framework for interactive CLIs
http://vorpal.js.org
MIT License
5.64k stars 280 forks source link

Optional and required arguments #11

Closed AljoschaMeyer closed 9 years ago

AljoschaMeyer commented 9 years ago

Hi, the issues just keep coming. I guess I'll have to take a look at the code soon and try to hack a pullrequest or two. I'm starting to feel bad for just posting these without trying to implement anything. Anyways, here we go:

vorpal.command('test <required> [optional]')

test foo works as expected: { options: {}, required: 'foo' }.
However:

vorpal.command('test [optional] <required>')

test foo results in Missing required argument. Showing Help:

It would be great if vorpal was smart enough to recognize that foo should be the value for <required>, not for [optional].

dthree commented 9 years ago

Really, there's no problem at all. Vorpal is an infant so real-world feedback is very appreciated - issue or not!

That's a good idea, and should be pretty easy to implement. I think I'm just going to switch it around for the user if they do it like that.

dthree commented 9 years ago

This should be good now.