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

kvp args #21

Open
wehowski opened this issue Jun 28, 2016 · 0 comments
Open

kvp args #21

wehowski opened this issue Jun 28, 2016 · 0 comments

Comments

@wehowski
Copy link

Hello,
first good job, thanks.

My arguments look like

    --key="value"

rather than

   -key value

So these changes worked for me:

        while(this._halt == false && (token = tokens.shift())) {
            var p = token.split('=');
             token=p[0];
             var arg = p[1] || true;
              if('string'===typeof arg && '"' === arg.substr(0,1) && '"' === arg.substr(arg.length-1,arg.length)){
                arg = arg.substr(1,arg.length-1);
              }


            if(LONG_SWITCH_RE.test(token) || SHORT_SWITCH_RE.test(token)) {

                // The token is a long or a short switch. Get the corresponding
                // rule, filter and handle it. Pass the switch to the default
                // handler if no rule matched.
                for(var i = 0; i < rules.length; i++) {
                    var rule = rules[i];
                    if(rule.long == token || rule.short == token) {
                        if(rule.filter !== undefined) {

                            if(arg && (!LONG_SWITCH_RE.test(arg) && !SHORT_SWITCH_RE.test(arg))) {
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