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

Fix: 145 #146

Closed
wants to merge 7 commits into from
Closed

Fix: 145 #146

wants to merge 7 commits into from

Conversation

tristanMatthias
Copy link

This merge request fixes #145, and adds the ability to pass in string values for flags or parameters that contain a '-' as the leading character. EG:

const tokenize = require('./lib/tokenize-arg-string');
const parse = require('./');

const args = tokenize('--foo "-bar"');
// args is now [ '--foo', '"-bar"' ]. Notice the "..." (quotation marks) around the "-bar"
const parsed = parse(args);
// parsed is now { _: [], foo: '-bar' }

A risk with this is any value for a flag that has a value (as a string) starting with a dash is now returned with EXTRA quotation marks in the tokenized array. (See example above).

I've added a few extra test, and everything is running as normal, so it should be ok to merge in.

Let me know what you think!

@bcoe
Copy link
Member

bcoe commented Nov 9, 2018

see comment in #145 (comment)

@bcoe
Copy link
Member

bcoe commented Nov 19, 2018

@masaeedu mind giving this a bit of a review, I don't have too many cycles to dig in for a few days, and want to make sure it matches your thinking around handling strings that contain -.

@bcoe
Copy link
Member

bcoe commented Nov 19, 2018

@tristanMatthias also, mind rebasing.

@bcoe
Copy link
Member

bcoe commented Dec 25, 2018

I used this as a jumping off point for #153, which I'm closing this in favor of.

@bcoe bcoe closed this Dec 25, 2018
@bcoe
Copy link
Member

bcoe commented Dec 25, 2018

thank you for the contribution 👍

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

Successfully merging this pull request may close these issues.

String arguments that contain dashes do not parse properly
2 participants