public class App {
@Parameter
private List<String> parameters = new ArrayList<>();
@Parameter(names = {"-log", "-verbose"}, description = "Level of verbosity")
private Integer verbose = 1;
@Parameter(names = {"-t", "-type"}, description = "Type of file (file = f), (directory = d)")
private String type;
@Parameter(names = {"-e", "-ext"}, description = "Extension of files to be filtered")
private String extension;
@Parameter(names = "-wc", description = "Processor to be used during processing results")
private String processor;
@Parameter(names = "--help", help = true)
private boolean help = false;
public static void main(String[] args) throws FileNotFoundException, URISyntaxException {
App main = new App();
JCommander.newBuilder()
.addObject(main)
.build()
.parse(args);
if(main.help) {
// display usage
}
}
}
How about
JCommander jc = JCommander.newBuilder()
.addObject(main)
.build();
jc.parse(args);
if(main.help) {
jc.usage();
}
--
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.