Skip to content

Picocli 3.7.0

Compare
Choose a tag to compare
@remkop remkop released this 21 Oct 07:22

Picocli 3.7.0

The picocli community is pleased to announce picocli 3.7.0.

This release contains bugfixes and enhancements in the main picocli module, and adds two new modules:
picocli-codegen and picocli-shell-jline2.

Picocli Code Generation (picocli-codegen) contains tools for generating source code, documentation and configuration files
for picocli-based applications.

Picocli Shell JLine2 (picocli-shell-jline2) contains components and documentation for building
interactive shell command line applications with JLine 2 and picocli.

Many thanks to the many members of the picocli community who contributed!

This is the forty-first public release.
Picocli follows semantic versioning.

Table of Contents

New and Noteworthy

Improved Parsing of Quoted Values

This release improves parser behaviour of quoted arguments:

  • Quotes around command line parameters are now preserved by default (previously they were removed). This can be configured with CommandLine::setTrimQuotes.
  • When splitting parameters, quoted strings are no longer split. This can be configured with CommandLine::setSplitQuotedStrings.

Example:

@Option(names = "-x", split = ",")
String[] parts;

Given input like below:

<command> -x a,b,"c,d,e",f,"xxx,yyy"

This results in the parts array having the following values:

a
b
"c,d,e"
f
"xxx,yyy"

New Module picocli-codegen

Picocli Code Generation contains tools for generating source code, documentation and configuration files
for picocli-based applications.

This release contains the ReflectionConfigGenerator class.
ReflectionConfigGenerator generates a JSON String with the program elements that will be accessed reflectively in a picocli-based application, in order to compile this application ahead-of-time into a native executable with GraalVM.

The output of ReflectionConfigGenerator is intended to be passed to the -H:ReflectionConfigurationFiles=/path/to/reflectconfig option of the native-image GraalVM utility. This allows picocli-based applications to be compiled to a native image.

See Picocli on GraalVM: Blazingly Fast Command Line Apps for details.

The module's README explains how to configure your build to generate the configuration file automatically as part of your build.

New Module picocli-shell-jline2

Picocli Shell JLine2 contains components and documentation for building
interactive shell command line applications with JLine 2 and picocli.

This release contains the PicocliJLineCompleter class.
PicocliJLineCompleter is a small component that generates completion candidates to allow users to
get command line TAB auto-completion for a picocli-based application running in a JLine 2 shell.

See the module's README for more details.

Fixed issues

  • [#503] Build: Upgrade to gradle 4.10.2.
  • [#497] add module picocli-shell-jline2 for components and documentation for building interactive shell command line applications with JLine 2 and picocli.
  • [#499] add module picocli-codegen for tools to generate documentation, configuration, source code and other files from a picocli model
  • [#410] add ReflectionConfigGenerator class for GraalVM native-image
  • [#513] Enhancement: Simplify AutoCompletion script generator code.
  • [#481] Enhancement: Add @Command(usageHelpWidth = <int>) annotation attribute.
  • [#379] Option with split property should not split quoted strings. Thanks to Markus Kramer for the feature request.
  • [#514] Bugfix/Enhancement: picocli no longer removes opening and closing quotes around arguments by default. This is configurable with CommandLine::setTrimQuotes. Thanks to mshatalov for the bug report.
  • [#509] Bugfix: Long boolean options with arity 0 should not allow parameters. Thanks to Adam Zegelin for the bug report.
  • [#510] Documentation: Fix broken link for moved example files. Thanks to Anthony Keenan for the pull request.
  • [#24] Documentation: Added Chinese translations of "Picocli 2.0 Do More With Less" and "Picocli 2.0 Groovy Scripts on Steroids".

Deprecations

No features were deprecated in this release.

Potential breaking changes

From this release, picocli no longer removes opening and closing quotes around arguments by default.
This is configurable with CommandLine::setTrimQuotes.