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

Parsing with option value delimiter other than "=" does not work #151

Open
sbyrx opened this issue May 16, 2017 · 2 comments
Open

Parsing with option value delimiter other than "=" does not work #151

sbyrx opened this issue May 16, 2017 · 2 comments

Comments

@sbyrx
Copy link

sbyrx commented May 16, 2017

In this commit CommandLineParser was modified to use parserProperties.getOptionValueDelimiter() instead of supporting only "=" as a delimiter.

However, it appears as though the splitToken() method inside of CmdLineImpl was missed in this change:

         /**
         * Used when the current token is of the form "-option=value",
         * to replace the current token by "value", as if this was given as two tokens "-option value"
         */
        void splitToken() {
            if (pos < args.length && pos >= 0) {
                int idx = args[pos].indexOf("=");
                if (idx > 0) {
                    args[pos] = args[pos].substring(idx + 1);
                }
            }
        }

It is still using a hard-coded equals sign to determine the index of the parameter to remove instead of calling parserProperties.getOptionValueDelimiter().

This means that, for example, when I change the option value delimiter to ":", and try and parse something like "-e:testing" what gets passed through as a parameter value is "-e:testing" when I would expect to have just "testing" as a value.

@sbyrx
Copy link
Author

sbyrx commented May 18, 2017

@kohsuke I have implemented a fix for this issue, and I would like to contribute it. Could you please give me permission to push up a branch and create a PR?

@sbyrx
Copy link
Author

sbyrx commented May 18, 2017

Scratch that, PR opened!

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