Apache Commons CLI库提供API,用于解析传递给程序的命令行选项。
Commons CLI可以支持不同类型的选项:
POSIX类型选项,如tar -zxvf foo.tar.gz
GNU类型的长选项,如du --human-readable --max-depth=1
Java类型的属性,如java -Djava.awt.headless=true -Djava.net.useSystemProxies=true Foo
短选项值,如gcc -O2 foo.c
长选项单横线,如ant -projecthelp
usage: ls
-A,--almost-all do not list implied . and ..
-a,--all do not hide entries starting with .
-B,--ignore-backups do not list implied entried ending with ~
-b,--escape print octal escapes for nongraphic characters
--block-size <SIZE> use SIZE-byte blocks
-c with -lt: sort by, and show, ctime (time of last
modification of file status information) with
-l:show ctime and sort by name otherwise: sort
by ctime
-C list entries by columns