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

Doesn't handle negative numbers for an arg #6

Open
jprichardson opened this issue Mar 1, 2013 · 5 comments
Open

Doesn't handle negative numbers for an arg #6

jprichardson opened this issue Mar 1, 2013 · 5 comments

Comments

@jprichardson
Copy link

If you want to have a program that has a negative number for an arg, commander.c causes a segfault.

./myprog --n -5

or...

./myprog -n "-5"

Any thoughts on why?

@jprichardson
Copy link
Author

Doesn't actually crash, that's a result of my strtod code trying to convert a null value. But it does print: unrecognized flag -5.

@tj
Copy link
Member

tj commented Mar 1, 2013

commander interprets it as a flag currently, we could special-case digits, might as well

@chrisledet
Copy link
Contributor

Seems like any value that starts with - is misinterpreted as a flag.

For example, if I pass in "--- No way jose" I get the following message:

unrecognized flag --- No way jose"

I tried wrapping it in quotes but that didn't help. Any way around this?

@tj
Copy link
Member

tj commented Dec 18, 2013

not currently, but we should support -- for separating args

@tj
Copy link
Member

tj commented Dec 18, 2013

oh we do :D

./test foo -- --stuff --here
additional args:
  - 'foo'
  - '--stuff'
  - '--here'

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

3 participants