--
You received this message because you are subscribed to the Google Groups "jcommander" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jcommander+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Any chance of this being implemented?
Not in the near future by me, but you are welcome to send a pull request if you are interested in implementing this yourself.
--Cédric
On Sun, Jan 22, 2017 at 1:41 PM, gbakewell7 <gbake...@gmail.com> wrote:
Any chance of this being implemented?
--
You received this message because you are subscribed to the Google Groups "jcommander" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jcommander+...@googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to jcommander+unsubscribe@googlegroups.com.
I just deployed a new JCommander to JCenter which no longer requires options to have a prefix. As a consequence, the following test passes:
public void noDash() {
class Arguments {
private int bar;
@Parameter(names = { "bar", "foo" })
private void setBar(int value) {
bar = value;
}
@Parameter(names = "otherName")
private String otherName;
}
Arguments a = new Arguments();
new JCommander(a, "bar", "1");
Assert.assertEquals(a.bar, 1);
}
There might be a few edge cases here and there but all the tests are passing so I’m pretty sure there are no regressions.
File issues if you encounter any difficulties.
Thanks!
cannot find symbolsymbol: method help()
This issue was brought up twice in the past few weeks (somebody else mentioned it before you) and it's been nagging me since then because there was no reason why JCommander should have relied on option prefixes in the first place.And I was glad to see it was as easy to fix as I expected :)
--Cédric
On Tue, Jan 24, 2017 at 12:55 PM, gbakewell7 <gbake...@gmail.com> wrote:
Thank you so much Cédric for being so helpful! It's awesome that
you've managed to update it in such a short time, I haven't actually
tested it yet but I'll be sure to file an issue if I encounter any!
Thanks :)
--
You received this message because you are subscribed to the Google Groups "jcommander" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jcommander+...@googlegroups.com.
This issue was brought up twice in the past few weeks (somebody else mentioned it before you) and it's been nagging me since then because there was no reason why JCommander should have relied on option prefixes in the first place.And I was glad to see it was as easy to fix as I expected :)
--Cédric
On Tue, Jan 24, 2017 at 12:55 PM, gbakewell7 <gbake...@gmail.com> wrote:
Thank you so much Cédric for being so helpful! It's awesome that
you've managed to update it in such a short time, I haven't actually
tested it yet but I'll be sure to file an issue if I encounter any!
Thanks :)
--
You received this message because you are subscribed to the Google Groups "jcommander" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jcommander+...@googlegroups.com.
Seems to work for me. I pasted your code verbatim and when I run it:
Usage: prog [options]
Options:
help
The compilation error appears to be in your code?
static class CommandTemplate {
@Parameter
private List<String> parameters = new ArrayList<>();
@Parameter(names = "help", help = true)
private boolean help;
}
@Test(enabled = false)
public static void main(String[] args) {
CommandTemplate template = new CommandTemplate();
JCommander jcommander = new JCommander(template);
jcommander.setProgramName("prog");
jcommander.parse("help");
if (template.help) {
jcommander.usage();
}
}
To unsubscribe from this group and stop receiving emails from it, send an email to jcommander+unsubscribe@googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to jcommander+unsubscribe@googlegroups.com.