Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Passing empty string for option on command is set to undefined #727

Closed
sorohan opened this issue Dec 4, 2017 · 0 comments
Closed

Passing empty string for option on command is set to undefined #727

sorohan opened this issue Dec 4, 2017 · 0 comments

Comments

@sorohan
Copy link
Contributor

sorohan commented Dec 4, 2017

For this program:

program
  .name('test')
  .command('mycommand')
  .option('-c, --cheese [type]', 'optionally specify the type of cheese')
  .action(function(cmd) {
    val = cmd.cheese;
  });

And calling it like this:

test mycommand --cheese ""

I would expect the value of "val" to be an empty string, but it is actually undefined.

sorohan pushed a commit to sorohan/commander.js that referenced this issue Dec 4, 2017
abetomo added a commit that referenced this issue Jan 30, 2018
Fixes issue #727: Passing empty string for option on command is set to undefined
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

No branches or pull requests

1 participant