{"id":971,"date":"2018-07-29T00:29:32","date_gmt":"2018-07-29T05:29:32","guid":{"rendered":"http:\/\/tiemensfamily.com\/TimOnCS\/?p=971"},"modified":"2018-07-29T00:29:32","modified_gmt":"2018-07-29T05:29:32","slug":"java-command-line-argument-parser-taxonomy","status":"publish","type":"post","link":"https:\/\/tiemensfamily.com\/timoncs\/2018\/07\/29\/java-command-line-argument-parser-taxonomy\/","title":{"rendered":"Java command-line argument parser taxonomy"},"content":{"rendered":"<p>Every once in a while, at the beginning of a new project, I start the search for a command-line argument parsing library in Java.  This post shows the results of examining the field as of mid 2018.  This post serves both as a &#8220;which to use&#8221; and as a &#8220;which have been evaluated, and found wanting&#8221; guide.<\/p>\n<p>* Best So Far<br \/>\nJCommander v1.71<br \/>\n<a href=\"http:\/\/jcommander.org\/\">http:\/\/jcommander.org\/<\/a><br \/>\nannotation, good documentation, custom parser, validation<\/p>\n<p>* Honorable Mention<br \/>\npicocli v3.3<br \/>\n<a href=\"http:\/\/picocli.info\/\">http:\/\/picocli.info\/<\/a><br \/>\nannotation, good documentation &#8212; documentation looks suspiciously like it is patterned after JCommander<\/p>\n<p>* Pretty Good<br \/>\nargs4j<br \/>\n<a href=\"http:\/\/args4j.kohsuke.org\/\">http:\/\/args4j.kohsuke.org\/<\/a><br \/>\nfield-based, annotation-based,  unclear if &#8220;&#8211;long-Name&#8221; is supported<\/p>\n<p>JewelCLI<br \/>\n<a href=\"http:\/\/jewelcli.lexicalscope.com\/\">http:\/\/jewelcli.lexicalscope.com\/<\/a><br \/>\nannotation-based, interface-based but can be instance-based with setters, has short and long names<\/p>\n<p>* Also-Rans<\/p>\n<p>jopt-simple<br \/>\n<a href=\"https:\/\/pholser.github.io\/jopt-simple\/\">https:\/\/pholser.github.io\/jopt-simple\/<\/a><br \/>\nKey-Value &#8211; the opposite of a good library.  Many of the libraries below share this same deficiency.<\/p>\n<p>JArgs<br \/>\n<a href=\"http:\/\/jargs.sourceforge.net\/\">http:\/\/jargs.sourceforge.net\/<\/a><br \/>\nsingle &#8220;parse&#8221; call with array of options,  Key-Value get value where key is the option<\/p>\n<p>Jakarta Commons CLI<br \/>\n<a href=\"http:\/\/commons.apache.org\/proper\/commons-cli\/\">http:\/\/commons.apache.org\/proper\/commons-cli\/<\/a><br \/>\nlike JArgs, except key is &#8220;String&#8221;, not option object<\/p>\n<p>argparser<br \/>\n<a href=\"http:\/\/www.cs.ubc.ca\/~lloyd\/java\/argparser.html\">http:\/\/www.cs.ubc.ca\/~lloyd\/java\/argparser.html<\/a><br \/>\ncreate individual options, where options are &#8220;holders&#8221;, parse() into the holders<\/p>\n<p>JSAP<br \/>\n<a href=\"http:\/\/www.martiansoftware.com\/jsap\/\">http:\/\/www.martiansoftware.com\/jsap\/<\/a><br \/>\nold (2008), not well documented<\/p>\n<p>JCommando<br \/>\n<a href=\"http:\/\/jcommando.sourceforge.net\/\">http:\/\/jcommando.sourceforge.net\/<\/a><br \/>\nit generates .java, but still requires an additional .jar<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Every once in a while, at the beginning of a new project, I start the search for a command-line argument parsing library in Java. This post shows the results of examining the field as of mid 2018. This post serves &hellip; <a href=\"https:\/\/tiemensfamily.com\/timoncs\/2018\/07\/29\/java-command-line-argument-parser-taxonomy\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[5],"tags":[],"_links":{"self":[{"href":"https:\/\/tiemensfamily.com\/timoncs\/wp-json\/wp\/v2\/posts\/971"}],"collection":[{"href":"https:\/\/tiemensfamily.com\/timoncs\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/tiemensfamily.com\/timoncs\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/tiemensfamily.com\/timoncs\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/tiemensfamily.com\/timoncs\/wp-json\/wp\/v2\/comments?post=971"}],"version-history":[{"count":0,"href":"https:\/\/tiemensfamily.com\/timoncs\/wp-json\/wp\/v2\/posts\/971\/revisions"}],"wp:attachment":[{"href":"https:\/\/tiemensfamily.com\/timoncs\/wp-json\/wp\/v2\/media?parent=971"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/tiemensfamily.com\/timoncs\/wp-json\/wp\/v2\/categories?post=971"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/tiemensfamily.com\/timoncs\/wp-json\/wp\/v2\/tags?post=971"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}