| JunkUtil (1.1.0) | 2012-04-29 13:38 |
| JunkUtil安定版 (1.1.0) | 2012-04-29 13:45 |
このクラスはPerlのライブラリにヒントを得ました。
java junkutil.sample.BatchTest -a -c CCC.txt ARG1.txt ARG2.txt
OptGets optGets = new OptGets("abc:"); //-a -b -c XXX を定義している
Map opts = optGets.parse();
List argList = optGets.getArgList();
このとき、optsとargListの中は
opts.get("a") == Boolean.TRUE;
opts.get("b") == Boolean.FALSE;
((String)opts.get("c")).equals("CCC.txt");
argList.toString().equals("[AAA.txt, BBB.txt]");
となっています。