saka1 / simple-cl-parser

An another implementation of command-line parser in Java

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

simple-cl-parser

Summary

An implementation of command line parser in Java. It has some features as follows:

  • Easy to use
  • A little fluent inteterface
  • POSIX compatible(incomplete)

Requirements

  • TestNG (for unittest)

Sample

SimpleCLParser parser = new SimpleCLParser();
parser.addOption("a").withArgument();
parser.addOption("b").withArgumentList();

CommandLine result = parser.parse(args);
if (result.isParseSuccess()) {
	System.out.println("Parse Success");
	for (Iterator<String> it = result.optionNameIterator(); it.hasNext();) {
		String optionName = it.next();
		System.out.println("Option " + optionName + ": " +
		                   result.getOptionArgumentList(optionName));
	}
} else {
	System.out.println("Parse failed");
}

License

MIT License

About

An another implementation of command-line parser in Java

License:MIT License


Languages

Language:Java 100.0%