Update dependency info.picocli:picocli to v4.6.1 #231
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR contains the following updates:
4.4.0
->4.6.1
Release Notes
remkop/picocli
v4.6.1
The picocli community is pleased to announce picocli 4.6.1.
This release fixes a problem with dependency scope in the following sub-modules:
The problem was that these modules contained dependencies that were declared to have
implementation
scope instead ofapi
scope.However, these were transitive dependencies, and necessary to compile any project that uses the above picocli modules.
In this release, transitive dependencies are declared with
api
scope in the above modules.Special thanks to Sualeh Fatehi, Dejan Stojadinović and Semyon Levin for the quick community feedback, pull request and reviews!
This is the seventy-sixth public release.
Picocli follows semantic versioning.
Table of Contents
New and Noteworthy
Fixed issues
picocli-shell-jline3
. Thanks to Sualeh Fatehi for raising this.picocli-shell-jline3
. Thanks to Dejan Stojadinović for the pull request, and Semyon Levin for the review.picocli-spring-boot-starter
. Thanks to Semyon Levin for raising this.Deprecations
No features were deprecated in this release.
Potential breaking changes
This release has no breaking changes.
v4.6.0
The picocli community is pleased to announce picocli 4.6.0.
This release contains new features, bug fixes and other enhancements.
Community Contributions
This release contains many, many community contributions, for which I am extremely grateful. Let's give them some credit!
IModelTransformer
API for user-defined model transformations after initialization and before parsing.picocli-shell-jline3
module that adds a built-inclear
command and improves thehelp
command.echo
andprompt
for interactive options and positional parameters.Annotation::getClass
and assignment inif
condition.@ParentObject
should be@ParentCommand
.@Command
attributes withscope=INHERIT
.CommandSpec::removeSubcommand
method.Optional<T>
type for options and positional parameters.-Dkey
as well as-Dkey=value
).@Spec
-annotated members inArgGroup
classes.MissingParameterException
should not be thrown when subcommand has required options and help option is specified on parent command.ReflectionConfigGenerator
should not generate method section in subclass config for private superclass methods inreflect-config.json
.CommandLine::getFactory
accessor method.What is in this release
Improved Groovy support: this release introduces a new
@PicocliScript2
annotation that adds support for exit codes and@Command
-annotated methods to define subcommands. Also, from this release, Groovy programs can use closures in the picocli annotations instead of specifying a class.From this release, Map options accept key-only parameters, so end users can specify
-Dkey
as well as-Dkey=value
.There is a new
mapFallbackValue
attribute that enables this, which can be used to control the value that is put into the map when only a key was specified on the command line.Also, this release adds support for
java.util.Optional<T>
: single-value types can be wrapped in anOptional
container object when running on Java 8 or higher.If the option or positional parameter was not specified on the command line, picocli assigns the value
Optional.empty()
instead ofnull
.This release also adds support for commands with
scope = ScopeType.INHERIT
. Commands with this scope have their attributes copied to all subcommands (and sub-subcommands).New parser plugin:
IParameterPreprocessor
and new configuration plugin:IModelTransformer
.From this release,
@Spec
-annotated elements can be used inArgGroup
classes, which can be convenient for validation.Interactive options and positional parameters can now set
echo = true
(for non-security sensitive data) so that user input is echoed to the console, and control theprompt
text that is shown before asking the user for input.Help API: this release adds public methods
Help.Layout::colorScheme
,Help.Layout::textTable
,Help.Layout::optionRenderer
,Help.Layout::parameterRenderer
, andHelp::calcLongOptionColumnWidth
, making it easier to customize the table format used to lay out options and positional parameters in the usage help message.CommandSpec API: added method
CommandSpec::removeSubcommand
.This is the seventy-fifth public release.
Picocli follows semantic versioning.
Table of Contents
@PicocliScript2
annotationjava.util.Optional<T>
New and Noteworthy
New
@PicocliScript2
annotationThe older
@picocli.groovy.PicocliScript
annotation is deprecated from picocli 4.6.New scripts should use the
@picocli.groovy.PicocliScript2
annotation (and associatedpicocli.groovy.PicocliBaseScript2
base class) instead.The table below lists the differences between the
PicocliBaseScript2
andPicocliBaseScript
script base classes.PicocliBaseScript2
PicocliBaseScript
@Command
-annotated methods in the script.@Command
-annotated methods.help
subcommands (both the built-in one and custom ones).help
subcommands.afterExecution(CommandLine, int, Exception)
to callSystem.exit
.CommandLine::execute
. Scripts can overridebeforeParseArgs(CommandLine)
to install a customIExecutionStrategy
.PicocliBaseScript::run
and is not easy to customize. Any subcommand and the main script are both executed.beforeParseArgs(CommandLine)
to install a customIParameterExceptionHandler
.PicocliBaseScript::handleParameterException
.beforeParseArgs(CommandLine)
to install a customIExecutionExceptionHandler
.PicocliBaseScript::handleExecutionException
.Callable<Object>
, script body is transformed to thecall
method.runScriptBody
method.Groovy Closures in Annotations
From picocli 4.6, Groovy programs can use closures in the picocli annotations instead of specifying a class.
This can be especially useful in Groovy scripts, where one cannot define a static inner class.
Example:
When a class is specified, picocli creates an instance of the class. By contrast, when a closure is specified, picocli calls the closure to get an instance.
(To be precise, both of these are delegated to the configured factory, and the default factory implementation supports closures from picocli 4.6.)
As you can see in the above example, each closure in the annotation should contain another closure that has the required type (
IVersionProvider
,IDefaultValueProvider
, etc.)versionProvider
: note the empty parameter list before the->
arrow. This is needed to help the Groovy compiler. The closure must be cast toIVersionProvider
.defaultProvider
: return a default value for the specifiedArgSpec
parameter. The closure must be cast toIDefaultValueProvider
.completionCandidates
: return a list of Strings. No parameter list or casting is required.parameterConsumer
: given aStack
,ArgSpec
andCommandSpec
, process the remaining arguments. The closure must be cast toIParameterConsumer
.converter
takes an array of closures. Groovy 3.0.7 or greater is required: older versions of Groovy ignore closures in class array annotations. Each closure must have a parameter and be cast toITypeConverter
.Key-only map parameters
By default, picocli expects Map options and positional parameters to look like
key=value
, that is, the option parameter or positional parameter is expected to have a key part and a value part, separated by a=
character. If this is not the case, picocli shows a user-facing error message:Value for ... should be in KEY=VALUE format but was ...
.From picocli 4.6, applications can specify a
mapFallbackValue
to allow end users to specify only the key part. The specifiedmapFallbackValue
is put into the map when end users to specify only a key. The value type can be wrapped in ajava.util.Optional
. For example:This allows input like the following:
The above input would give the following results:
Note that the option description may contain the
${MAP-FALLBACK-VALUE}
variable which will be replaced with the actual map fallback value when the usage help is shown.System Properties
A common requirement for command line applications is to support the
-Dkey=value
syntax to allow end users to set system properties.The example below uses the
Map
type to define an@Option
-annotated method that delegates all key-value pairs toSystem::setProperty
.Note the use of
mapFallbackValue = ""
to allow key-only option parameters.java.util.Optional<T>
From version 4.6, picocli supports single-value types wrapped in a
java.util.Optional
container when running on Java 8 or higher.If the option or positional parameter was not specified on the command line, picocli assigns the value
Optional.empty()
instead ofnull
.For example:
WARNING: Picocli has only limited support for
java.util.Optional
types:only single-value types, and the values in a
Map
(but not the keys!) can be wrapped in anOptional
container.java.util.Optional
cannot be combined with arrays or otherCollection
classes.Inherited Command Attributes
Picocli 4.6 adds support for inheriting
@Command
attributes with thescope = ScopeType.INHERIT
annotation.Commands with this scope have their
@Command
attributes copied to all subcommands (and sub-subcommands, to any level of depth).When a subcommand specifies an explicit value in its
@Command
annotation, this value is used instead of the inherited value.For example:
The
app
command in the above example hasscope = ScopeType.INHERIT
, so its@Command
properties are inherited by thesub
subcommand.The
sub
subcommand defines its ownheader
anddescription
, so these are not inherited from the parent command.The help message for the subcommand looks like this:
Note that the subcommand has inherited the mixed-in standard help options (
--help
and--version
), the@file
usage help, and the footer and footer heading.It also inherited the version string, shown when the user invokes
app sub --version
.When a command has
scope = INHERIT
, the following attributes are copied to its subcommands:mixinStandardHelpOptions
helpCommand
Attributes that are not copied include:
mixinStandardHelpOptions
)mixinStandardHelpOptions
Preprocessor Parser Plugin
Introduced in picocli 4.6, the
IParameterPreprocessor
is also a parser plugin, similar toIParameterConsumer
, but more flexible.Options, positional parameters and commands can be assigned a
IParameterPreprocessor
that implements custom logic to preprocess the parameters for this option, position or command.When an option, positional parameter or command with a custom
IParameterPreprocessor
is matched on the command line, picocli's internal parser is temporarily suspended, and this custom logic is invoked.This custom logic may completely replace picocli's internal parsing for this option, positional parameter or command, or augment it by doing some preprocessing before picocli's internal parsing is resumed for this option, positional parameter or command.
The "preprocessing" actions can include modifying the stack of command line parameters, or modifying the model.
Example use case
This may be useful when disambiguating input for commands that have both a positional parameter and an option with an optional parameter.
For example, suppose we have a command with the following synopsis:
One of the limitations of options with an optional parameter is that they are difficult to combine with positional parameters.
With a custom parser plugin, we can customize the parser, such that
VALUE
in--option=VALUE
is interpreted as the option parameter, and in--option VALUE
(without the=
separator), VALUE is interpreted as the positional parameter.The code below demonstrates:
With this preprocessor, the following user input gives the following command state:
v4.5.2
The picocli community is pleased to announce picocli 4.5.2.
This release contains bug fixes and enhancements:
HelpCommand
now respects subcommands case-sensitivity and abbreviations.ArithmeticException: / by zero
exceptions.This is a work in progress: many examples still only have a Java version.
Contributions welcome!
Many thanks to the picocli community who contributed 28 pull requests in this release!
Please see the Fixed Issues section below for the individual contributors. Great work!
This is the seventy-fourth public release.
Picocli follows semantic versioning.
Table of Contents
New and Noteworthy
The user manual now has tabs showing examples in languages other than Java.
This is a work in progress: many examples still only have a Java version.
Contributions welcome!
Fixed issues
-x=3
). Thanks to Chris Laprun for raising this.HelpCommand
now respects subcommands case-sensitivity and abbreviations. Thanks to NewbieOrange for the pull request.@Parameters
in@ArgGroup
should not result inArithmeticException: / by zero
. Thanks to Loren Keagle for raising this.AnsiConsole::systemUninstall
infinally
clause. Thanks to David Walluck for raising this.org.jline.terminal.Terminal
is closed when done. Thanks to David Walluck for the pull request.picocli-shell-jline3/README.md
. Thanks to Nick Cross for raising this.picocli-shell-jline3
example to 3.16.0. Thanks to Nick Cross for the pull request.checksum
example can now be executed on the documentation page via JDoodle.com. Thanks to Andreas Deininger for the pull request.paramLabel
in examples. Thanks to Andreas Deininger for the pull request.checksum
example: add Kotlin source code on second tab. Thanks to Andreas Deininger for the pull request.checksum
example: add more tabs for Groovy, Groovy script and Scala. Thanks to Andreas Deininger for the pull request.subcommands
example: add tab with Kotlin source code. Thanks to Andreas Deininger for the pull request.subcommands
section: add several tabs with Kotlin source code. Thanks to Andreas Deininger for the pull request.ManPageGeneratorTest
regardless of environment. Thanks to David Walluck for the pull request.TracerTest
regardless of environment. Thanks to David Walluck for the pull request..invalid
domain name forInetAddress
test. Thanks to David Phillips for the pull request.Deprecations
No features were deprecated in this release.
Potential breaking changes
This release has no breaking changes.
v4.5.1
The picocli community is pleased to announce picocli 4.5.1.
This release contains bug fixes and enhancements.
Fixed bug in the
picocli-codegen
annotation processor that resulted in errors in native images that usedManPageGenerator
as subcommand.Suppress generation of Gradle Module Metadata, to fix Gradle build failures for projects using picocli 4.4.0 or 4.5.0.
Fixed terminal width detection on macOS.
The user manual now has a new section on Validation. Various other documentation improvements.
This is the seventy-third public release.
Picocli follows semantic versioning.
Table of Contents
New and Noteworthy
Fixed issues
ManPageGenerator
as subcommand with native-image throws exception. Thanks to Sebastian Hoß for raising this.Deprecations
No features were deprecated in this release.
Potential breaking changes
This release has no breaking changes.
v4.5.0
The picocli community is pleased to announce picocli 4.5.0.
This release contains bug fixes and enhancements.
The
ColorScheme
class now has new methodsstackTraceText
andrichStackTraceString
, which can be convenient when creating custom error handlers with colors.Various bugfixes in the
picocli-codegen
annotation processor.The user manual now has anchor links before all section titles.
This is the seventy-second public release.
Picocli follows semantic versioning.
Table of Contents
New and Noteworthy
Fixed issues
ColorScheme::stackTraceText(Throwable)
andColorScheme::richStackTraceString(Throwable)
.AutoComplete.GenerateCompletion
generated man page.ParameterException
caused byTypeConversionException
now have their cause exception set.picocli-codegen
annotation processor causes the build to fail with aClassCastException
when an option hascompletionCandidates
defined.picocli-codegen
annotation processor should allow@Spec
-annotated field in classes implementingIVersionProvider
.picocli-codegen
annotation processor no longer givesFATAL ERROR: picocli.CommandLine$InitializationException: ArgGroup has no options or positional parameters, and no subgroups
during incremental compilation in Intelli/J IDEA.Deprecations
No features were deprecated in this release.
Potential breaking changes
This release has no breaking changes.
Configuration
📅 Schedule: At any time (no schedule defined).
🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.
♻ Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.
🔕 Ignore: Close this PR and you won't be reminded about this update again.
This PR has been generated by WhiteSource Renovate. View repository job log here.