Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Which Java CLI library with currently active community is more feature-rich?

Main goal of this question is to create a table with easy-to-use, wide-spread (more or less) Java CLI libraries (and their features). So, if someone need such library, he could select one from this page, filtering table for required features.

Restrictions

  1. OpenSource libraries only.
  2. That's not the goal of this question to cover ALL existing CLI libraries. It's easier to select something useful if we don't add "almost dead" libraries with hard-to-find documentation. If you unsure about your CLI library, but proud of it's features and could describe why it's better than others, then add answer/comment with info. If answer/comment gets 10 upvotes, it's OK to add such library to table.
  3. Same applies to addition of features to table. If feature is not very useful and you are unsure - check with "10 upvotes" method.
like image 716
Vadim Ponomarev Avatar asked Apr 15 '12 18:04

Vadim Ponomarev


2 Answers

Java CLI libraries and features table

Java CLI libraries and features table.
If you want to update this table, you should edit CSV-data at the end of this answer. Copy data to file, import file to GoogleDocs spreadsheet. Share spreadsheet for read-only with everyone and replace the link above.

Abbreviations used in table:

  • y (yes - good)
  • p (partial - average)
  • n (no - bad)
  • u (unknown - feel free to insert correct value)

Description of features in table

Functionality related (lib A can do something that lib B can't)

  1. Supports generation of usage/help text for all arguments/subarguments.
  2. Support for at least one additional level of subarguments (like "commands" in JCommander).
  3. Internationalization.

Project status related (library and docs still updated or no updates for several years)

Comment: In all cases below by Maven assumed Maven Central Repository and by Ivy - IvyRoundup Repository.

  1. Date of latest release (in Maven/Ivy if available).
  2. Latest version available (in Maven/Ivy if available).
  3. Number of available versions in Maven/Ivy (count only releases, not milestones or snapshots).

Coding style related features

  1. Uses annotations to provide arguments format.

List of libraries with links (don't add links to table)

Commons CLI - examples
JOpt Simple - examples
args4j - example
JCommander - all examples on the main page

Placeholder for list of knowingly ignored libraries/features


CSV-data for shared editing of table. It is good to update link at the top of this answer at the same revision as you update CSV-data. But it's also could be updated later.

Records in table sorted according to Google-query "Java CLI". More cited results will be first and no one could said that I was biased.

Name,Date of latest release,Latest version available from Maven/Ivy,Number of available versions for Maven/Ivy,Uses annotations to provide arguments format,Generates usage text for all arguments,Support for at least one additional level of subarguments,Internationalization
Commons CLI,2015-06-17,1.3.1,5,n,y,n,n
JOpt Simple,2016-09-25,5.0.3,23,n,y,n,n
args4j,2016-01-31,2.33,31,y,y,n,n
JCommander,2017-02-12,1.64,31,y,y,y,y
like image 80
Vadim Ponomarev Avatar answered Oct 13 '22 00:10

Vadim Ponomarev


I normally did go to args4j for all CLI needs but lately I'm using mostly JCommander which is missing from your list. What I would never use is Commons CLI since like most commons libraries there is little activity and better solutions are available.

JCommander is also available here on github with the last commit being 3 days ago.

Your requirement of subarguments is probably solved best with JCommander's commands which are explained in context of the GIT CLI on its webpage.

Usage generation is supported, based on the descriptions enclosed the @Parameter annotation.

Here is the CSV line for JCommander for your table:

jcommander,2012-01-11,1.23,19,y,y,y

like image 34
Johannes Wachter Avatar answered Oct 12 '22 22:10

Johannes Wachter