I just released JCommander 1.3, here are the new features:
- @ResourceBundle is deprecated and replaced with @Parameters:
@Parameters(resourceBundle = "MessageBundle") public class ArgsI18N2New {
I had to deprecate @ResourceBundle because I needed a more general annotation in order to implement the next new feature.
- You can now use different separators for your options:
java Main -log:3
or
java Main -level=42
You define the separator with the @Parameters annotation:
@Parameters(separators = "=") public class SeparatorEqual { @Parameter(names = "-level") public Integer level = 2; }
- Parameters can now be hidden, in which case they will not appear in the usage:
@Parameter(names = "-debug", description = "Debug mode", hidden = true) public boolean debug = false;
- The usage output is now sorted alphabetically and cleanly aligned:
Usage: [main class] [options] list of files Options: -b, --bonjour enable Bonjour. -e, --export-preferences export preferences into the given file. -F, --flush-preferences flush gui preferences. -h, --help show this help. -i, --import-preferences import preferences from the given file.
Download either directly or with Maven:
com.beust jcommander 1.3