groovy-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Remko Popma <>
Subject Re: next generation CliBuilder?
Date Wed, 21 Mar 2018 10:30:54 GMT
On Wed, Mar 21, 2018 at 5:23 PM, Jochen Theodorou <> wrote:

> Am 21.03.2018 um 02:11 schrieb Paul King:
>> Picocli has always looked like a nice alternative. It wasn't an option
>> for me before it had the api but picocli 3 seems to have that covered.
> can you refresh my memory about the position of JCommander in this? I see
> some overlap. And if we go with Picoli, we should probably explain the
> people in what case they should use what and how.
> Fair question. What distinguishes picocli from JCommander (and many other
CLI libraries):

   - JCommander has an annotations API, while picocli has both an
   annotations and a programmatic API
   The programmatic API is needed to support the dynamic features of
   - picocli has easily customized
   <> usage help with ANSI colors
   - picocli-based apps and scripts can have command line autocompletion
   <> in bash and zsh
   - picocli offers tight integration for Groovy scripts via the
   @PicocliScript annotation and AST transformation (see the Groovy Scripts
   on Steroids
   <> post)
   - in picocli, both options and positional parameters can be strongly
   typed.  JCommander has strongly typed options, but positional parameters is
   an untyped list of strings.
   - picocli supports clustered short options
   <>, so you can say <command>
   -xvfInputFile as well as <command> -x -v -f=InputFile. JCommander only
   supports the latter AFAIK.
   - picocli has a range-based arity model that allows a minimum, maximum
   and variable number of parameters, e.g, "1..*", "3..5". With JCommander
   one needs to choose between minimum arity or variable arity, and with
   variable arity one cannot have strong typing
   <> - Strings only.
   - picocli has convenience APIs
   <> that reduce the
   boilerplate code for command line applications to a single line of code

Picocli and JCommander both have:

   - quality documentation
   - support for subcommands
   - support for multi-value options, splitting an argument into multiple
   values, and map-like options (e.g., -Dkey=value)

JCommander features not in picocli (but on the todo list):

   - internationalization
   - support for suppressing password echo to the console
   - support for case-insensitive and abbreviated options

For more details, this CLI library comparison
<> page may be useful.
Dustin Marx‘s article series on command line interfaces, especially the summary
may also be of interest (although it covers an old version of picocli -


> bye Jochen

View raw message