/**
* 提供程序的帮助文档
*/
static void printHelp(Options opts) {
HelpFormatter hf = new HelpFormatter();
hf.printHelp("The Cli app. Show how to use Apache common cli.", opts);
}
public static void main (String [] args) throws ParseException {
// 解析参数
CommandLineParser parser = new PosixParser();
CommandLine cl = parser.parse(opts, args);
m-lv:cli lvjian$ java -jar cli.jar -h
usage: The Cli app. Show how to use Apache common cli.
-f,--file <arg> Input your file name.
-h,--help The command help
m-lv:cli lvjian$ java -jar cli.jar -f fileparameter
fileparameter
m-lv:cli lvjian$ java -jar cli.jar -file fileparameter
fileparameter