I'm curious: what do you use to parse command-line options in your Java programs?
You know, -r, -w, -rwl, --use-flibbert, --foobar=12 and all that kinda stuff.
Wednesday, July 9, 2008
Subscribe to:
Post Comments (Atom)
Personal ramblings of Kevin Bourrillion, senior software engineer at Google, Inc.
No, my opinions as expressed in this blog are not those of my employer. They're mine alone. That's why they're called "my opinions." Helloooo.
16 comments:
Apache commons CLI here...
http://commons.apache.org/cli
Commons CLI here too; I don't remember there being a lot of choices the last time I looked, but that was some time ago. And I probably didn't spend a huge amount of time looking.
CLI-parser (annotations based):
http://code.google.com/p/cli-parser/
It is < 10k and does a great, terse job.
You should read this: http://javathink.blogspot.com/2008/04/why-does-parsing-arguments-in-java-suck.html.
We tried Commons CLI on one project a few years ago, but at the time it seemed like a very odd, cumbersome API. Maybe that's changed, I don't know. For the few command line args I've had to parse, I just manually walk the array and hand-code it. For apps with a handful of args, this seems preferable to sucking in yet another "mini framework".
Eric:
Try out cli-parser.. it is tiny, has no dependencies and makes it much easier than your solution even for just a few arguments.
https://args4j.dev.java.net/
We've used JOpt Simple in a couple of small projects. I liked how easy it was to get things like help out of it's data structure, and how clear the construction of the options were in the code.
JASP http://www.martiansoftware.com/jsap/
Something I needed that Apache Commons CLI didn't do:
myprogram --foo xxx --foo yyy
would somehow get me a List<String> with xxx and yyy in it.
I've now settled on args4j
I found CLIs a bit too complex for my use on small prototype console applications.
I have created a project and uploaded the source using google-code.
I am a student of Java so I am sure a number of enhancements to this class are needed; fyi, have a look at:
http://code.google.com/p/parse-cmd/
btw: thanks to Bob and you for Guice; it is a real useful tool; simple and useful.
jf.zarama@gmail.com
I second args4j, it's insanely simple to use.
Yes, I do.
I haven't had an opportunity yet to use it, but I have been keeping my eye on Groovy's CLIBuilder, which seems dead simple. Here is an example of it being used, http://docs.codehaus.org/display/GROOVY/WrappingGroovyScript
LG Laptop Battery
SAMSUNG Laptop Battery
SONY Laptop Battery
TOSHIBA Laptop Battery
APPLE M8403 battery
APPLE A1078 Battery
APPLE A1079 battery
APPLE A1175 battery
APPLE a1185 battery
APPLE A1189 battery 1
Acer aspire 5920 battery
Acer btp-arj1 battery
Acer LC.BTP01.013 battery
Acer ASPIRE 1300 battery
Acer ASPIRE 1310 battery
Acer Aspire 1410 battery
Acer ASPIRE 1680 battery
ACER BTP-63D1 battery
ACER BTP-43D1 battery
Acer lc.btp05.001 battery
Acer aspire 3000 battery
Acer Travelmate 4000 battery
ACER aspire 5560 battery
ACER BATBL50L6 battery
ACER TravelMate 240 Battery
ACER BT.00803.004 Battery
ACER Travelmate 4002lmi battery
Acer travelmate 800 battery
Acer aspire 3613wlmi battery
Travelmate 2414wlmi battery
Acer batcl50l battery
Acer Travelmate 2300 battery
ACER aspire 3610 battery
ACER travelmate 4600 battery
Dell Latitude D800 battery
Compre documentos en línea, documentos originales y registrados.
Acerca de Permisodeespana, algunos dicen que somos los solucionadores de problemas, mientras que otros se refieren a nosotros como vendedores de soluciones. Contamos con cientos de clientes satisfechos a nivel mundial. Hacemos documentos falsos autorizados y aprobados como Permiso de Residencia Español, DNI, Pasaporte Español y Licencia de Conducir Española. Somos los fabricantes y proveedores de primer nivel de estos documentos, reconocidos a nivel mundial.
Comprar permiso de residencia,
permiso de residenciareal y falso en línea,
Compre licencia de conducir en línea,
Compre una licencia de conducir española falsa en línea,
Comprar tarjeta de identificación,
Licencia de conducir real y falsa,
Compre pasaporte real en línea,
Visit Here fpr more information. :- https://permisodeespana.com/licencia-de-conducir-espanola/
Address: 56 Guild Street, London, EC4A 3WU (UK)
Email: contact@permisodeespana.com
WhatsApp: +443455280186
Post a Comment