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

parser does not like equal signs in key=value HashMap options. #87

Open
dnozay opened this issue Oct 6, 2014 · 1 comment
Open

parser does not like equal signs in key=value HashMap options. #87

dnozay opened this issue Oct 6, 2014 · 1 comment

Comments

@dnozay
Copy link
Contributor

dnozay commented Oct 6, 2014

can't submit jobs to jenkins if parameters have '=' in them
e.g. JOB_PARAM="USER=damien DESTDIR=/tmp/$BUILDNUM"

here is my testcase:

import org.kohsuke.args4j.Argument;
import org.kohsuke.args4j.CmdLineException;
import org.kohsuke.args4j.CmdLineParser;
import org.kohsuke.args4j.Option;
import org.kohsuke.args4j.spi.BooleanOptionHandler;

import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

import java.util.Map.Entry;
import java.util.Map;
import java.util.HashMap;

public class SampleMain {
    @Option(name="-p",usage="Specify the build parameters in the key=value format.")
    Map<String,String> parameters = new HashMap<String, String>();
}

def test(String[] args) {
    println("test with args: " + args)
    main = new SampleMain()
    CmdLineParser parser = new CmdLineParser(main);
    parser.parseArgument(args)
    for (Entry<String, String> e : main.parameters.entrySet()) {
         String name = e.getKey();
         String value = e.getValue();
         println(name + ' := ' + value);
    }
}

test('-p', 'key=value')
test('-p', 'equal="i love = signs"')

here is the result:

Result

test with args: [-p, key=value]
key := value
test with args: [-p, equal="i love = signs"]
equal := "i love 

maybe related to issue #72, maybe not.

@dnozay
Copy link
Contributor Author

dnozay commented Oct 6, 2014

note, testcase is in groovy, I used that in the jenkins script console.

dnozay added a commit to dnozay/args4j that referenced this issue Oct 7, 2014
kohsuke added a commit that referenced this issue Mar 23, 2015
sebasjm pushed a commit to sebasjm/args4j that referenced this issue Mar 11, 2018
sebasjm pushed a commit to sebasjm/args4j that referenced this issue Mar 11, 2018
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