dthree / vorpal

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

no-arg option support #106

Closed mvayngrib closed 8 years ago

mvayngrib commented 8 years ago

some options, like --force, don't take an argument. Is there a way to specify such an option?

right now i have something like:

vorpal
  .command('rm-provider <handle>', 'Remove a provider (irreversible)')
  .option('-f, --force', 'Don\'t second guess me')
  .action(function (args, cb) {
    //...
  })

and I'm running:

rm-provider -f someProviderName

and get the missing argument error (because someProviderName is interpreted as an argument to the option, and is left undefined):


  Missing required argument. Showing Help:

  Usage: rm-provider [options] <handle>

  Remove a provider (irreversible)

  Options:

    --help       output usage information
    -f, --force  Same thing without the second guessing
dthree commented 8 years ago

This is a big problem, it's been annoying me as well. Minimist, the arg parser, doesn't really take this into account so I really have to get under the hood to fix. Will do soon.

mvayngrib commented 8 years ago

@dthree awesome, thanks :)

dthree commented 8 years ago

Fixed.

https://github.com/dthree/vorpal/commit/8c091f948be99d55bb7120233285638c620c98b1

jwthomp commented 8 years ago

Awesome, thank you.

It isn't clear to me how you push out new builds to npm, so just thought I'd ask when you expect this to be pushed? Thank you again!

I did see that you updated that you updated npm 12 hours ago, so this issue might be covered by that update?

[edit] And confirmed that this is in the 1.10.8 version in npm, so thank you again.

dthree commented 8 years ago

Yeah. If I close a bug, it usually means I pushed to NPM. Sorry about not being clear. I'll note the push version in the future.

jwthomp commented 8 years ago

No worries at all. You certainly left enough breadcrumbs for me to figure it out on my own.

Cheers!