Skip to content

Releases: remkop/picocli

Picocli 4.7.5

26 Aug 23:07
Compare
Choose a tag to compare

Picocli 4.7.5

The picocli community is pleased to announce picocli 4.7.5.

This release includes bugfixes and enhancements.

Many thanks to the picocli community for raising these issues and providing the pull requests to address them!

This is the eighty-forth public release.
Picocli follows semantic versioning.
Artifacts in this release are signed by Remko Popma (6601 E5C0 8DCC BB96).

Table of Contents

New and Noteworthy

Fixed issues

  • [#2083][#2084] Enhancement: Java 22 update: improve logic for detecting if the output stream is connected to a terminal. Thanks to Liam Miller-Cushon for the pull request.
  • [#2087] Enhancement: Mask parameters in trace log when echo=false for interactive options and positional parameters. Thanks to szzsolt for raising this.
  • [#2060] Bugfix: Fix positional parameters bug with late-resolved arity variable. Thanks to daisukeoto for raising this.
  • [#2074][#2075] Bugfix: Don't generate auto-complete for hidden attributes in picocli.shell.jline3.PicoCommand. Thanks to clebertsuconic for the pull request.
  • [#2059] Bugfix: ArgGroup with exclusive=false and multiplicity=1 should require at least one option; fix regression and refine solution introduced in [#1848][#2030]. Thanks to Utkarsh Mittal for raising this.
  • [#2080] DOC: Improve GraalVM documentation: add graalvm-native-image-plugin. Thanks to Bhavik Patel for the pull request.
  • [#2045] DOC: Commit html files with LF line-endings. Thanks to Fridrich Strba for the pull request.

Deprecations

No features were deprecated in this release.

Potential breaking changes

This release has no breaking changes.

Picocli 4.7.4

03 Jun 01:14
Compare
Choose a tag to compare

Picocli 4.7.4

The picocli community is pleased to announce picocli 4.7.4.

This release includes bugfixes and enhancements.

Many thanks to the picocli community for raising these issues and providing the pull requests to address them!

This is the eighty-third public release.
Picocli follows semantic versioning.
Artifacts in this release are signed by Remko Popma (6601 E5C0 8DCC BB96).

Table of Contents

New and Noteworthy

See fixed items below.

I cheated on the semantic versioning in this release: a public setter method was added in a class in the picocli.shell.jline3 module. In spite of that, the version number went from 4.7.3 to 4.7.4 (not 4.8.0). My apologies.

Fixed issues

  • [#2028][#2031] API: Add setter for name in picocli.shell.jline3.PicocliCommands. Thanks to Irina Leontyuk for raising this.
  • [#2026][#2027] Enhancement: Improved feedback on mistyped subcommands. Thanks to David Pond for the pull request.
  • [#2029][#2034] Enhancement: prevent java.nio.charset.UnsupportedCharsetException: cp0 on windows, and fall back to the default charset if the charset provided by System property sun.stdout.encoding is invalid. Thanks to
    Bartosz Spyrko-Smietanko
    for the pull request.
  • [#2035][#2036] Bugfix: Option "mapFallbackValue" ignored when inherited to subcommand. Thanks to Dan Ziemba for the pull request.
  • [#1848][#2030] Bugfix: fix issue with required options in ArgGroup becoming optional when combined with DefaultValueProvider. Thanks to Ruud Senden and Mike Snowden for the pull request.
  • [#2020] DEP: Bump step-security/harden-runner from 2.3.0 to 2.4.0
  • [#2033] DEP: Bump github/codeql-action from 2.2.12 to 2.3.5
  • [#2015] DEP: Bump junit5Version from 5.9.2 to 5.9.3
  • [#2014] DEP: Bump org.jetbrains.kotlin:kotlin-gradle-plugin from 1.8.20 to 1.8.21
  • [#2013] DEP: Bump org.jetbrains.kotlin:kotlin-script-runtime from 1.8.20 to 1.8.21
  • [#2008] DEP: Bump springBootVersion from 2.7.10 to 2.7.11
  • [#2007] DEP: Bump org.asciidoctor:asciidoctorj-pdf from 2.3.6 to 2.3.7

Deprecations

No features were deprecated in this release.

Potential breaking changes

This release has no breaking changes.

Picocli 4.7.3

16 Apr 07:27
Compare
Choose a tag to compare

Picocli 4.7.3

The picocli community is pleased to announce picocli 4.7.3.

This release includes bugfixes and enhancements.

This is the eighty-second public release.
Picocli follows semantic versioning.
Artifacts in this release are signed by Remko Popma (6601 E5C0 8DCC BB96).

Table of Contents

New and Noteworthy

Fixed a regression introduced in picocli 4.7.2.
Multi-value options whose fallbackValue is set to CommandLine.Option.NULL_VALUE, may see a NullPointerException if the option is specified on the command line without a parameter but with a = attached, like --option=.

Also, this release fixes broken links in the Javadoc.

Known issues

NOTE: A minor issue with this release is that the version string in the info.picocli.CommandLine.VERSION field is incorrectly set to 4.7.3-SNAPSHOT (should have been 4.7.3).

Fixed issues

  • [#1998] Bugfix: ParameterException: NullPointerException: null while processing argument at or before arg[0]. Thanks to Jiri Daněk for raising this.
  • [#1957] DOC: Fixed broken links in the javadoc. Thanks to Andreas Deininger for raising this.
  • [#2002] DEP: Bump actions/checkout from 3.5.0 to 3.5.2
  • [#2005] DEP: Bump gradle/gradle-build-action from 2.4.0 to 2.4.2
  • [#2003] DEP: Bump github/codeql-action from 2.2.11 to 2.2.12
  • [#1997] DEP: Bump org.asciidoctor:asciidoctorj-pdf from 2.3.4 to 2.3.6

Deprecations

No features were deprecated in this release.

Potential breaking changes

This release has no breaking changes.

Picocli 4.7.2

09 Apr 09:56
Compare
Choose a tag to compare

Picocli 4.7.2

The picocli community is pleased to announce picocli 4.7.2.

This release includes bugfixes and enhancements.

This is the eighty-first public release.
Picocli follows semantic versioning.
Artifacts in this release are signed by Remko Popma (6601 E5C0 8DCC BB96).

Table of Contents

New and Noteworthy

  • Bugfix: fallbackValue=Option.NULL_VALUE did not work for Collection or array options.
  • Fixed isJansiConsoleInstalled performance issue.
  • Kotlin enhancement: improved paramLabel string auto-generated from Kotlin internal methods which have mangled names with embedded "$".
  • Various documentation fixes.

Fixed issues

  • [#1959] API: Add ability to enable loading resource bundles in annotation processor for tests.
  • [#1993] Bugfix: fallbackValue=Option.NULL_VALUE did not work for Collection or array options. Thanks to Jiri Daněk for raising this.
  • [#1975][#1976] Enhancement: Fixed isJansiConsoleInstalled performance issue. Thanks to ChrisTrenkamp for the pull request.
  • [#1932] Enhancement: Move System-Rules tests to Java 5 test module; move System-Lambda tests to Java 8+ test module. Facilitate testing with recent JRE's.
  • [#1984] Enhancement (Kotlin): improve paramLabel string auto-generated from Kotlin internal methods which have mangled names with embedded "$". Thanks to Ken Yee for raising this.
  • [#1945] DOC: Code sample: add Java version. Thanks to Andreas Deininger for the pull request.
  • [#1956] Doc: Fix broken link in user manual. Thanks to Andreas Deininger for the pull request.
  • [#1955] DEP: Bump asciidoctorj from 2.5.5 to 2.5.7. Thanks to Andreas Deininger for the pull request.
  • [#1980] DEP: Bump actions/checkout from 3.3.0 to 3.5.0
  • [#1952] DEP: Bump actions/setup-java from 3.9.0 to 3.10.0
  • [#1985] DEP: Bump actions/setup-java from 3.10.0 to 3.11.0
  • [#1941] DEP: Bump emibcn/badge-action from 1.2.4 to 2.0.2
  • [#1942] DEP: Bump github/codeql-action from 2.1.39 to 2.2.1
  • [#1953] DEP: Bump github/codeql-action from 2.2.1 to 2.2.3
  • [#1958] DEP: Bump github/codeql-action from 2.2.3 to 2.2.4
  • [#1979] DEP: Bump github/codeql-action from 2.2.4 to 2.2.8
  • [#1995] DEP: Bump github/codeql-action from 2.2.8 to 2.2.11
  • [#1961] DEP: Bump gradle/gradle-build-action from 2.3.3 to 2.4.0
  • [#1960] DEP: Bump gradle/wrapper-validation-action from 1.0.5 to 1.0.6
  • [#1962] DEP: Bump log4j2Version from 2.19.0 to 2.20.0
  • [#1947] DEP: Bump org.jetbrains.kotlin:kotlin-gradle-plugin from 1.7.20 to 1.8.10
  • [#1989] DEP: Bump org.jetbrains.kotlin:kotlin-gradle-plugin from 1.8.10 to 1.8.20
  • [#1948] DEP: Bump org.jetbrains.kotlin:kotlin-script-runtime from 1.7.20 to 1.8.10
  • [#1988] DEP: Bump org.jetbrains.kotlin:kotlin-script-runtime from 1.8.10 to 1.8.20
  • [#1968] DEP: Bump org.jline:jline from 3.22.0 to 3.23.0
  • [#1990] DEP: Bump ossf/scorecard-action from 2.1.2 to 2.1.3
  • [#1964] DEP: Bump springBootVersion from 2.7.8 to 2.7.9
  • [#1978] DEP: Bump springBootVersion from 2.7.9 to 2.7.10
  • [#1963] DEP: Bump step-security/harden-runner from 2.1.0 to 2.2.0
  • [#1970] DEP: Bump step-security/harden-runner from 2.2.0 to 2.2.1
  • [#1992] DEP: Bump step-security/harden-runner from 2.2.1 to 2.3.0

Deprecations

No features were deprecated in this release.

Potential breaking changes

This release has no breaking changes.

Picocli 4.7.1

29 Jan 00:25
Compare
Choose a tag to compare

Picocli 4.7.1

The picocli community is pleased to announce picocli 4.7.1.

This release includes bugfixes and enhancements.

This is the eightieth public release.
Picocli follows semantic versioning.
Artifacts in this release are signed by Remko Popma (6601 E5C0 8DCC BB96).

Table of Contents

New and Noteworthy

Fixed issues

  • [#1874][#1885][#1933] Bugfix: The picocli-groovy module should not declare org.codehaus.groovy:groovy-all as dependency. Thanks to Mattias Andersson and Michael Kutz for raising this, and to Paul King for the analysis.
  • [#1886][#1896] Bugfix: AsciiDoc generator now correctly outputs options even if all options are in ArgGroups. Thanks to Ruud Senden for the discussion and the pull request.
  • [#1878][#1876] Bugfix: Annotation processor now avoids loading resource bundles at compile time. Thanks to Ruud Senden for the discussion and the pull request.
  • [#1911] Avoid using boxed boolean in CommandLine.Interpreter.applyValueToSingleValuedField. Thanks to Jiehong for the pull request.
  • [#1870] Bugfix: StringIndexOutOfBoundsException in usage help when command has many (and long) aliases. Thanks to Martin for raising this.
  • [#1904] Bugfix: Apply fallbackValue to vararg multi-value options, not just single-value options. Thanks to Andreas Sewe for raising this.
  • [#1930] Bugfix: Ensure tests pass in environments for Java 5-18.
  • [#1940] Bugfix: fix 3 failing tests in ManPageGeneratorTest. Thanks to Mike Snowden for the pull request.
  • [#1881] DOC: Many documentation improvements. Thanks to Andreas Deininger for the pull request.
  • [#1855][#1857] DOC: Add new user manual section called Rare Use Cases detailing System.exit usage. Thanks to Tadaya Tsuyukubo for the pull request.
  • [#1880] DOC: Improve documentation for negatable options that are true by default. Thanks to Sebastian Hoß for raising this.
  • [#1815] DOC: Improve user manual section for non-validating ArgGroups. Thanks for Paul Harris for raising this.
  • [#1908] DOC: Update the user manual GraalVM section to use the new official native-maven-plugin. Thanks to tison for the pull request.
  • [#1924] DOC: Update picocli-codegen/README.adoc. Thanks to Seyyed Emad Razavi for the pull request.
  • [#1910][#1917] DOC: Fix broken link to Zero Bug Commitment. Thanks to Jiehong for raising this and thanks to Andreas Deininger for the pull request.
  • [#1915] DOC: Improve default provider examples. Thanks to David for raising this.
  • [#1918][#1920] DOC: Removed unused Travis CI badge and associated broken link from README. Thanks to Andreas Deininger for raising this and the pull request.
  • [#706] DOC: Add GitHub badge with test count to README.
  • [#1939] BUILD: Fix picocli-annotation-processing-tests failures on Java 16+: rewrite tests to avoid Google compiler-test API that internally uses com.sun.tools.javac.util.Context.
  • [#1887] DEP: Bump biz.aQute.bnd.gradle from 6.3.1 to 6.4.0
  • [#1865] DEP: Bump ivy from 2.5.0 to 2.5.1
  • [#1931] DEP: Bump springBootVersion from 2.7.5 to 3.0.2
  • [#1929] DEP: Bump github/codeql-action from 2.1.29 to 2.1.39
  • [#1926] DEP: Bump step-security/harden-runner from 1.5.0 to 2.1.0
  • [#1914] DEP: Bump actions/checkout from 3.1.0 to 3.3.0
  • [#1897] DEP: Bump actions/setup-java from 3.6.0 to 3.9.0
  • [#1902] DEP: Bump ossf/scorecard-action from 2.0.6 to 2.1.2
  • [#1938] DEP: Bump actions/upload-artifact from 3.1.1 to 3.1.2
  • [#1937] DEP: Bump asciidoctorj-pdf from 2.3.3 to 2.3.4
  • [#1936] DEP: Bump jline from 3.21.0 to 3.22.0
  • [#1935] DEP: Bump compile-testing from 0.19 to 0.21.0

Deprecations

No features were deprecated in this release.

Potential breaking changes

This release has no breaking changes.

Picocli 4.7.0

31 Oct 20:13
Compare
Choose a tag to compare

Picocli 4.7.0

The picocli community is pleased to announce picocli 4.7.0.

This release includes bugfixes and enhancements.

A potentially breaking change is that the parser now treats char[] as a single-value type.

From this release, applications can programmatically set the trace level, and use tracing in custom components.

Applications can improve startup time by setting system property picocli.disable.closures to true to disable support for closures in annotations.

Many more fixes and enhancements, see the sections below for more details.

This is the seventy-ninth public release.
Picocli follows semantic versioning.
Artifacts in this release are signed by Remko Popma (6601 E5C0 8DCC BB96).

Table of Contents

New and Noteworthy

Tracing API

From picocli 4.7.0, applications can programmatically set the trace level, and use tracing in custom components.

In addition to setting system property picocli.trace, applications can now change the trace level via the Tracer::setLevel method. For example:

CommandLine.tracer().setLevel(CommandLine.TraceLevel.INFO);

The new public method CommandLine.tracer() returns the singleton Tracer object that is used internally by picocli, and can also be used by custom component implementations to do tracing. For example:

class MyIntConverter implements ITypeConverter<Integer> {
    public Integer convert(String value) {
        try {
            return Integer.parseInt(value);
        } catch (NumberFormatException ex) {
            CommandLine.tracer().info(
                    "Could not convert %s to Integer, returning default value -1", value);
            return -1;
        }
    }
}

Enable Consuming Option Names or Subcommands

By default, options that take a parameter do not consume values that match a subcommand name or an option name.

This release introduces two parser configuration options to change this behaviour:

  • CommandLine::setAllowOptionsAsOptionParameters allows options to consume option names
  • CommandLine::setAllowSubcommandsAsOptionParameters allows options to consume subcommand names

When set to true, all options in the command (options that take a parameter) can consume values that match option names or subcommand names.

This means that any option will consume the maximum number of arguments possible for its arity.

USE WITH CAUTION!

If an option is defined as arity = "*", this option will consume all remaining command line arguments following this option (until the End-of-options delimiter) as parameters of this option.

Unsorted Synopsis

By default, the synopsis displays options in alphabetical order.
Picocli 4.7.0 introduces a sortSynopsis = false attribute to let the synopsis display options in the order they are declared in your class, or sorted by their order attribute.

@Command(sortSynopsis = false)

Parser change for char[] options

Prior to 4.7, the picocli parser treated options and positional parameters with type char[] as array (multi-value) options, except for interactive options. However, it is more intuitive to treat all char[] options as single-value options, similar to String options.

For end users, this means that existing applications that use non-interactive char[] options will no longer allow multiple characters to be specified separately on the command line. That is, input like -c A -c B -c C will be rejected and the user needs to specify -c ABC instead.

Applications that want to preserve the previous behaviour will need to change their code to use java.lang.Character[] instead of char[].

Fixed issues

  • [#1599] API: The picocli-codegen artifact is now an explicitly declared named JPMS module with a module-info.class.
  • [#1611] API: The picocli-groovy artifact is now an explicitly declared named JPMS module with a module-info.class.
  • [#1610] API: The picocli-shell-jline2 is now an explicitly declared named JPMS module with a module-info.class.
  • [#1609] API: The picocli-shell-jline3 is now an explicitly declared named JPMS module with a module-info.class.
  • [#1608] API: The picocli-spring-boot-starter is now an explicitly declared named JPMS module with a module-info.class. NOTE: its module name changed to info.picocli.spring.boot from info.picocli.spring.
  • [#1614] API: Change picocli-spring-boot-starter JPMS module name to info.picocli.spring.boot from info.picocli.spring.
  • [#1600] API: Add requires static java.sql to picocli module-info.
  • [#1471] API: Provide a programmatic way to configure Picocli's TraceLevel. Thanks to ekinano for raising this.
  • [#1125] API: Add parser configuration to allow options to consume values that match subcommand names or option names.
  • [#1396][#1401] API: Support generic types in containers (e.g. List, Map). Thanks to Michał Górniewski for the pull request.
  • [#1380][#1505] API, bugfix: requiredOptionMarker should not be displayed on ArgGroup options. Thanks to Ahmed El Khalifa for the pull request.
  • [#1563] API: Add constructor to PicocliSpringFactory to allow custom fallback IFactory. Thanks to Andrew Holland for raising this.
  • [#1767][#1802] API: avoid NPE on OptionSpec.getValue() and add IScoped internal API. Thanks to Ruud Senden for the discussion and the pull request.
  • [#1574] API: Add annotation API to control whether synopsis should be sorted alphabetically or by explicit order.
  • [#1708][#1712][#1723] API: The setUsageHelpLongOptionsMaxWidth method no longer throws an exception when an invalid value is specified; instead, the value is ignored and an INFO-level trace message is logged. Thanks to Fabio for the pull request.
  • [#648][#1846] Enhancement: Treat char[] as single-value types (Potentially breaking change). Thanks to Lukáš Petrovický for the pull request with the test to verify the solution.
  • [#1571] Enhancement: Variables in values from the default value provider should be interpolated. Thanks to Bas Passon for raising this.
  • [#1773] Enhancement: Applications can improve startup time by setting system property picocli.disable.closures to true to disable support for closures in annotations. Thanks to patric-r for raising this.
  • [#1408] Enhancement: Synopsis should respect order if specified. Thanks to Simon for raising this.
  • [#964][#1080] Enhancement: ArgGroup synopsis should respect order (if specified). Thanks to Enderaoe for the pull request with unit tests.
  • [#1706][#1710] Enhancement: Subcommands should get missing messages from parent command resource bundle. Thanks to Ruud Senden and Mike Snowden for the pull request.
  • [#899][#1578][#1579] Enhancement: improve built-in Help command description. Thanks to Michael L Heuer for the pull request. Thanks to Garret Wilson for raising this.
  • [#1713][#1714] Enhancement: Support optional booleans in annotation processor. Thanks to Jan Waś for the pull request.
  • [#1387][#1711] Enhancement: Annotation processor should validate final primitive and String fields with Option and Parameters annotations. Thanks to xehpuk for raising this, and thanks to Adam McElwee for the pull request.
  • [#1572] Enhancement: Remove redundant braces in ArgGroup synopsis.
  • [#1602] Enhancement: Fix incorrect debug output for add/removeAlias.
  • [#1603] Enhancement: Improve debug tracing information for help requests and command execution.
  • [#1629] Enhancement: Omit empty braces in standard prompt for interactive options without description. Thanks to Andreas Deininger for raising this.
  • [#1778] Enhancement: Add support for new Spring Boot auto configuration introduced in Spring Boot 2.7. Thanks to Andreas Asplund for the pull request.
  • [#1836][#1841] Enhancement: Command aliases on Mixin were not being applied. Thanks to Mike Snowden for the pull request and to Ruud Senden for raising this.
  • [#1754][#1759] Enhancement: Autocompletion now correctly handles completion candidates with spaces. Thanks to Juan Martín Sotuyo Dodero for the pull request.
  • [#1834][#1838] Bugfix: Incorrect synopsis for char[] options. Thanks to Ruud Senden and Mike Snowden for the pull request.
  • [#1680] Bugfix: ArgGroups with multiplicity="0" are now disallowed at construction time and no longer throw a StackOverflowError while parsing. Thanks to ARNOLD Somogyi for raising this.
  • [#1615][#1616] Bugfix: getCJKAdjustedLength() no longer miscalculates for supplementary code points. Thanks to gwalbran for the pull request.
  • [#1575] Bugfix: Synopsis should not cluster boolean options if `po...
Read more

Picocli 4.6.3

09 Feb 10:12
Compare
Choose a tag to compare

Picocli 4.6.3

The picocli community is pleased to announce picocli 4.6.3.

This release includes bugfixes and enhancements, as well as documentation and security improvements.

Several improvements to the annotation processor and the generated autocompletion scripts.

Much gratitude to the picocli community for the many pull requests and other contributions!

This is the seventy-eighth public release.
Picocli follows semantic versioning.
Artifacts in this release are signed by Remko Popma (6601 E5C0 8DCC BB96).

Table of Contents

New and Noteworthy

Default branch renamed to main

The default branch has been renamed! master is now named main.

If you have a local clone, you can update it by running the following commands:

git branch -m master main
git fetch origin
git branch -u origin/main main
git remote set-head origin -a

Autocompletion script improvements

  • Autocompletion now shows subcommand aliases in the completion candidates
  • Autocompletion now displays completion candidates on exact match
  • Autocompletion now supports file names containing spaces
  • Remove file name extension and local dir prefix from the command name in generated autocomplete scripts
  • Fix Bash error compopt: command not found on older versions of Bash
  • Autocompletion on ZSH should only call compinit once

Fixed issues

  • [#1440] Bugfix: annotation processor incorrectly failed with DuplicateOptionAnnotationsException when multiple commands had a subcommand in common and an inherited (scope = ScopeType.INHERIT) option. Thanks to nemetsSY for raising this.
  • [#1472] Bugfix: annotation processor option -Averbose=true no longer incorrectly triggers warning: The following options were not recognized by any processor: '[verbose]'. Thanks to Lorenz Leutgeb for raising this.
  • [#1384][#1493] Bugfix: parser now correctly handles ArgGroups with optional positional parameters. Thanks to Matthew Lewis for raising this and to Kurt Kaiser for the pull request.
  • [#1474] Bugfix: Avoid UnsupportedCharsetException: cp65001 on Microsoft Windows console when code page is set to UTF-8. Thanks to epuni for raising this.
  • [#1528][#1529] Bugfix: Allow aliases of a CommandSpec that is already a subcommand to be properly & consistently modified. Thanks to Ross Goldberg for the pull request.
  • [#1466][#1467] Bugfix/Enhancement: Autocomplete now shows subcommand aliases in the completion candidates. Thanks to Ruud Senden for the pull request.
  • [#1468] Bugfix/Enhancement: Autocompletion now displays completion candidates on exact match. Thanks to Ruud Senden for raising this.
  • [#1537][#1541] Bugfix: AbbreviationMatcher now treats aliases of the same object as one match. Thanks to Staffan Arvidsson McShane for raising this and NewbieOrange for the pull request.
  • [#1531] Bugfix: Options defined as annotated methods should reset between parseArgs invocations when CommandLine instance is reused. Thanks to kaushalkumar for raising this.
  • [#1458][#1473] Enhancement: Autocompletion now supports file names containing spaces. Thanks to zpater345 for raising this and thanks to NewbieOrange for the pull request.
  • [#1477] Enhancement: Remove file name extension and local dir prefix from the command name in generated autocomplete scripts. Thanks to Andrea Peruffo for the pull request.
  • [#1464] Enhancement: Fix Bash error compopt: command not found on older versions Bash. Thanks to Andres Almiray for raising this.
  • [#1476] Enhancement: improve error message in AbstractCommandSpecProcessor#extractTypedMember. Thanks to Ross Goldberg for raising this.
  • [#1475] Enhancement: Fix typo in annotation target-type error message. Thanks to Ross Goldberg for the pull request.
  • [#1366][#1370] Enhancement: show in usage help that the built-in help command only works on the first argument. Thanks to Patrice Duroux for the pull request.
  • [#1492] Enhancement: Use EditorConfig to define file formats and coding style; Thanks to Goooler for the pull request.
  • [#1530] Enhancement: Simplified CommandSpec#validateSubcommandName implementation. Thanks to Ross Goldberg for the pull request.
  • [#1484] Enhancement: Fixed org.junit.Assert.assertThat deprecation warning; Thanks to Ross Goldberg for the pull request.
  • [#1485] Enhancement: Fix build warnings; build doc enhancements; Thanks to Ross Goldberg for the pull request.
  • [#1483] Enhancement: Improved AbstractCommandSpecProcessor#isSubcommand; Thanks to Ross Goldberg for the pull request.
  • [#1499] Enhancement: Improved DefaultFactory#create(Class<T>). Thanks to Ross Goldberg for the pull request.
  • [#1518] Enhancement: Simplified detection of getter & setter in TypedMember constructor. Thanks to Ross Goldberg for the pull request.
  • [#1568] Enhancement: CommandLine cleanup. Thanks to Ross Goldberg for the pull request.
  • [#1526][#1548] Enhancement: Autocompletion on ZSH should only call compinit once. Thanks to Ben Herweyer for the pull request.
  • [#1539] DOC: Various documentation improvements. Thanks to Hamid Nazari for the pull request.
  • [#1481] DOC: Removed repeated "whether" typo in JavaDoc; Thanks to Ross Goldberg for the pull request.
  • [#1125][#1538] DOC: Update "Option Names or Subcommands as Option Values" section in user manual; Thanks to Scott Turner for raising this.
  • [#1409][#1463] DOC: add documentation section on using default values in argument groups. Thanks to Ben Kedo for the pull request.
  • [#1383][#1502] DOC: add tests demonstrating usage of multiple arguments. Thanks to Ben Kedo and lind6 for the pull request.
  • [#1462] DOC, BUILD, DEP: Extend documentation on argument files, fix broken/outdated links, update dependencies. Thanks to Andreas Deininger for the pull request.
  • [#1457] DOC: add caution about arguments in @files with quoted option parameters. Thanks to Andreas Deininger for the pull request.
  • [#1544][#1545] DOC: Add NOTICE file with GPL v2 + CPE license. Thanks to Keith M Swartz for the pull request.
  • [#1553] SECURITY: Fix code scanning alert - Token-Permissions
  • [#1554] SECURITY: Fix code scanning alert - Pinned-Dependencies
  • [#1555] SECURITY: Fix code scanning alert - Create SECURITY.md
  • [#1556][#1557] SECURITY: Fix code scanning alert - SAST
  • [#1558] SECURITY: Fix code scanning alert - Pinned-Dependencies in codeql-analysis.yml
  • [#1559] SECURITY: Fix code scanning alert - Token-Permissions in codeql-analysis.yml
  • [#1560] SECURITY: Fix code scanning alert - Binary-Artifacts - Validate Gradle Wrapper
  • [#1561] SECURITY: Fix code scanning alert - Doc/example code uses a broken or risky cryptographic algorithm
  • [#1562] BUILD: Rename 'master' branch to 'main'
  • [#1491] BUILD: Add build job in CI; Thanks to Goooler for the pull request.
  • [#1482] BUILD: Optimize gradle; Thanks to Goooler for the pull request.
  • [#1461] BUILD: Allow publishing without signing for non-release versions. Thanks to Andreas Deininger for raising this.
  • [#1459] BUILD: The nexus-staging Gradle plugin must be applied to the root project, not to subprojects. Thanks to Andreas Deininger for raising this.
  • [#1503] BUILD: Fix failing System.exit tests on Java 18.
  • [#1504] BUILD: Run tests on Java 6-7 in CI environment, semi-automate testing on Java 5.
  • [#1516] DEP: Remove redundant dependency on jline-console in picocli-shell-jline3. Thanks to kaushalkumar for raising this.
  • [#1495] DEP: Bump validation-api from 2.0.0.Final to 2.0.1.Final
  • [#1496] DEP: Bump biz.aQute.bnd.gradle from 5.1.2 to 6.1.0
  • [#1494] DEP: Bump kotlin-gradle-plugin from 1.5.31 to 1.6.0
  • [#1497] DEP: Bump badass-jar from 1.1.3 to 1.2.0
  • [#1498] DEP: Bump hibernate-validator from 6.1.2.Final to 7.0.1.Final
  • [#1490] DEP: Bump hibernate-validator-annotation-processor from 6.1.2.Final to 7.0.1.Final
  • [#1489] DEP: Bump log4j-core from 2.13.0 to 2.14.1
  • [#1488] DEP: Bump log4j-api from 2.13.0 to 2.14.1
  • [#1487] DEP: Bump kotlin-script-runtime from 1.5.31 to 1.6.0
  • [#1486] DEP: Bump gradle-nexus-staging-plugin from 0.21.0 to 0.30.0
  • [#1500][#1517] DEP: Bump gradle from 7.3 to 7.3.3. Thanks to Ross Goldberg for the pull request.
  • [#1569] DEP: Bump gradle from 7.3.3 to 7.4. Thanks to Ross Goldberg for the pull request.
  • [#1515] DEP: Bump kotlin-gradl...
Read more

Picocli 4.6.2

05 Nov 12:19
Compare
Choose a tag to compare

Picocli 4.6.2

The picocli community is pleased to announce picocli 4.6.2.

This release includes bugfixes and enhancements. Many improvements in the documentation.

Thanks to the many people in the picocli community for raising issues and contributing pull requests to fix issues!

From this release, picocli uses system properties sun.stdout.encoding and sun.stderr.encoding when creating the PrintWriters returned by CommandLine::getOut and CommandLine::getErr. When these system properties do not exist, picocli falls back to the default charset (determined by file.encoding). This addresses an issue on Windows, where the default charset is not the same as the encoding for its console (often the older cp437 codepage on English-language versions of Windows).

Note that these system properties seem to have been introduced in Java 8 (although I cannot find it in the JDK 8 release notes) and may not exist on earlier JVMs or on JVMs other than the Oracle and OpenJDK implementations.

This is the seventy-seventh public release.
Picocli follows semantic versioning.
Artifacts in this release are signed by Remko Popma (6601 E5C0 8DCC BB96).

Table of Contents

New and Noteworthy

Fixed issues

  • [#1422] API: Un-deprecate the @Option help attribute; it is useful for custom help options. Thanks to kaushalkumar for raising this.
  • [#1337][#1338] Enhancement: prevent spurious WARNING: tag not found in include file messages when generating man pages. Thanks to Philip Crotwell for the pull request.
  • [#1340] Enhancement: add xref to generated man page document to link to subcommands from the parent command page. Thanks to Philip Crotwell for the pull request.
  • [#1351][#1362] Enhancement: avoid calling option completionCandidates when displaying usage help if ${COMPLETION-CANDIDATES} is not specified in description. Thanks to Wenhao ZHANG, sustc11810424 and Yining Tang for the pull request.
  • [#1303] Bugfix: Prevent IllegalArgumentException: argument type mismatch error in method subcommands with inherited mixed-in standard help options. Thanks to Andreas Deininger for raising this.
  • [#1300] Bugfix: Avoid spurious warning "Could not set initial value for field boolean" when reusing CommandLine with ArgGroup. Thanks to Yashodhan Ghadge for raising this.
  • [#1316] Bugfix: Avoid DuplicateOptionAnnotationsException thrown on mixinStandardHelpOptions for subcommands when parent has scope = INHERIT by picocli-codegen annotation processor. Thanks to Philippe Charles for raising this.
  • [#1319] Bugfix: Avoid DuplicateOptionAnnotationsException when parent has inherited mixed-in help options and the built-in HelpCommand subcommand. Thanks to Andreas Deininger for raising this.
  • [#1331] Bugfix: Avoid IllegalArgumentException when parent has no standard help options and scope = INHERIT, while subcommand does have mixed-in standard help options. Thanks to Andreas Deininger for raising this.
  • [#1381][#1382] Bugfix: Default value of option in repeated subcommand was not applied correctly. Thanks to sfeuerhahn for the pull request.
  • [#1434][#1435] CommandSpec.remove(arg) should also remove the arg from the args collection in the CommandSpec. Thanks to kaushalkumar for the pull request.
  • [#1404] Bugfix/Enhancement: Print paramLabel only when it could exist. Thanks to João Guerra for the pull reqeust.
  • [#1320][#1321] Bugfix/Enhancement: Use system properties sun.stdout.encoding and sun.stderr.encoding when creating the PrintWriters returned by CommandLine::getOut and CommandLine::getErr. Thanks to Philippe Charles for the investigation and the pull request.
  • [#1431] Bugfix/enhancement: .gitattributes should include HTML files to convert CRLF to LF. Thanks to wenhoujx for pointing this out.
  • [#1388][#1430] Bugfix: Fix subcommand aliases autocomplete regression. Thanks to NewbieOrange for the pull request.
  • [#1415] Bugfix/DOC: fix NullPointerException in README Example. Thanks to shannonbay for raising this.
  • [#1421] Bugfix/DOC: execute method in RunAll, RunFirst and RunLast should not be deprecated. Thanks to Gamal DeWeever for raising this.
  • [#1326][#1339] DOC: Added documentation and examples for controlling the locale. Thanks to Andreas Deininger for the pull request.
  • [#1296] DOC: add Kotlin code samples to user manual; other user manual improvements. Thanks to Andreas Deininger for the pull request.
  • [#1299] DOC: Link to IParameterPreprocessor from IParameterConsumer javadoc. Thanks to Andreas Deininger for the pull request.
  • [#1304] DOC: Manual, chapter '17.9 Inherited Command Attributes': added Kotlin version of code sample. Thanks to Andreas Deininger for the pull request.
  • [#1305] DOC: Document use of IParameterConsumer as n-ary type converter. Thanks to Martin for raising this.
  • [#1307] DOC: Added CAUTION admonitions, Kotlin code sample. Thanks to Andreas Deininger for the pull request.
  • [#1308] DOC: Add example for Option converter, improve text for default values. Thanks to Abhijit Sarkar for raising this.
  • [#1314] DOC: Fix use of deprecated Maven properties in README. Thanks to Philippe Charles for the pull request.
  • [#1323] DOC: Update Testing section of the user manual for Stefan Birkner's library System-Lambda.
  • [#1325] DOC: Add section on Short and Long Option Columns to user manual. Thanks to Andrei Ciobanu for raising this.
  • [#1336] DOC: Kotlin sample code, documentation improvements. Thanks to Andreas Deininger for the pull request.
  • [#1342] DOC: Improve user manual chapter 28.3 'Testing the Exit Code'. Thanks to Andreas Deininger for the pull request.
  • [#1344] DOC: Documentation, chapter 'Testing environment variables:': add Kotlin test sample. Thanks to Andreas Deininger for the pull request.
  • [#1443] DOC: Fix incorrect method name setLongOptionsMaxWidth to setUsageHelpLongOptionsMaxWidth in user manual section 'Long Option Column Width'. Thanks to kunlk for raising this.
  • [#1360][#1359] DOC: add JReleaser as packaging option. Thanks to Andres Almiray for the pull request.
  • [#1363][#1364] DOC: Add caution on Variable interpolation in Kotlin. Thanks to MagnusMG for the pull request.
  • [#1397][#1399] DOC: Update Jline2 README.md to add some recommended workaround about ANSI incompatible terminals. Thanks to Simon for the pull request.
  • [#1398][#1400] DOC: Arity of boolean options is now documented correctly. Thanks to João Guerra for the pull request.
  • [#1428][#1433] DOC: Add section about subcommands with the same name as option default value. Thanks to cbcmg for the pull request.
  • [#1390][#1432] DOC: Update examples to not throw Exception from main method. Thanks to wenhoujx for the pull request.
  • [#1423] DOC: Fixed broken link in README.md to annotation processor documentation. Thanks to Sevy007 for raising this.
  • [#1449] DOC: Fix typo in picocli-shell-jline2/README.md. Thanks to Ahmed Ashour for the pull request.
  • [#1426] Fix README adoption logos. Thanks to NewbieOrange for the pull request.
  • [#1313] DEP: Bump jline3Version in order to avoid stackoverflow error. Thanks to Rupert Madden-Abbott for the pull request.
  • [#1455] DEP: Bump spring-boot version to 2.5.6.
  • [#1369][#1371] Upgrade jline3 to version 3.19.0 to avoid "ReadConsoleInputW failed: Incorrect function" error. Thanks to auricgoldfinger for the pull request.
  • [#1336] BUILD: Bump Spring Boot, Gradle and Kotlin to latest version. Thanks to Andreas Deininger for the pull request.
  • [#1327] BUILD: fix incorrect version in MANIFEST.MF. Thanks to Fiouz for the pull request.
  • [#1328] BUILD: Upgrade Gradle to 6.8.2 and enable official Gradle Wrapper Validation GitHub Action. Thanks to Fiouz for the pull request.
  • [#1329] BUILD: OSGi manifest entry in picocli-4.6.0.jar should not require groovy. Thanks to Fiouz for raising this.
  • [#1330] BUILD: use type-safe DSL instead of direct XML manipulation to generate pom.xml. Thanks to Fiouz for the pull request.
  • [#1332] BUILD: Bumping asciidoctor +...
Read more

Picocli 4.6.1

03 Jan 03:42
Compare
Choose a tag to compare

Picocli 4.6.1

The picocli community is pleased to announce picocli 4.6.1.

This release fixes a problem (introduced in the 4.6.0 release) with dependency scope in the following sub-modules:

  • picocli-codegen
  • picocli-groovy
  • picocli-shell-jline2
  • picocli-shell-jline3
  • picocli-spring-boot-starter

The problem was that these modules contained dependencies that were declared to have implementation scope instead of api 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

Deprecations

No features were deprecated in this release.

Potential breaking changes

This release has no breaking changes.

Picocli 4.6.0

01 Jan 10:37
Compare
Choose a tag to compare

Picocli 4.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 the contributors some credit!

  • Andreas Deininger has been contributing to the documentation and other areas for a long time, but recently went into overdrive :-) and contributed many, many new pull requests to improve the documentation. The user manual and Quick Guide now have a "foldable" table of contents, and examples in tabs, with many additional examples in Kotlin, Scala and Groovy. A lot of work went into this! Many thanks, Andreas!
  • Marko Mackic contributed a pull request to add IModelTransformer API for user-defined model transformations after initialization and before parsing.
  • Sualeh Fatehi contributed a pull request to the picocli-shell-jline3 module that adds a built-in clear command and improves the help command.
  • H.Sakata contributed a pull request that adds support for echo and prompt for interactive options and positional parameters.
  • Daniel Gray contributed a bug fix to prevent incorrectly defaulting inherited positional params after a subcommand.
  • nveeser-google contributed a fix for compiler warnings about Annotation::getClass and assignment in if condition.
  • Petr Hála contributed a pull request to add a section on Mocking to user manual.
  • Max Rydahl Andersen contributed a pull request to include jbang in the Build Tools section of the user manual.
  • David Phillips contributed a section to the user manual on Really Executable JARs.
  • Laurent Almeras contributed a pull request to fix the user manual: @ParentObject should be @ParentCommand.
  • Mattias Andersson raised the idea of supporting subcommand methods in Groovy scripts.
  • Adrian A. raised the idea of using closures in the picocli annotations in Groovy programs instead of specifying a class.
  • Nick Cross raised the idea of inheriting @Command attributes with scope=INHERIT.
  • Marko Mackic raised the idea of adding a CommandSpec::removeSubcommand method.
  • Max Rydahl Andersen raised the idea of supporting Optional<T> type for options and positional parameters.
  • Max Rydahl Andersen and David Walluck raised the idea of supporting key-only Map options (to support -Dkey as well as -Dkey=value).
  • David Walluck raised the idea of a "preprocessor" parser plugin.
  • Jannick Hemelhof raised the idea of supporting @Spec-annotated members in ArgGroup classes.
  • Vitaly Shukela raised a bug report: the error message for unmatched positional argument reports an incorrect index when value equals a previously matched argument.
  • drkilikil raised a bug report: MissingParameterException should not be thrown when subcommand has required options and help option is specified on parent command.
  • Sebastian Thomschke raised a bug report: ReflectionConfigGenerator should not generate method section in subclass config for private superclass methods in reflect-config.json.
  • Lukas Heumos added the picocli-based cli-java template to CookieTemple.
  • Sualeh Fatehi raised the idea of adding add CommandLine::getFactory accessor method.
  • David Walluck contributed a test improvement that allows the tests to run reliably in more environments.
  • Sabrina (link witheld) pointed out various typos in the documentation.

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 an Optional 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 of null.

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 in ArgGroup 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 the prompt 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, and Help::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

New and Noteworthy

New @PicocliScript2 annotation

The older @picocli.groovy.PicocliScript annotation is deprecated from picocli 4.6.
New scripts should use the @picocli.groovy.PicocliScript2 annotation (and associated picocli.groovy.PicocliBaseScript2 base class) instead.
The table below lists the differences between the PicocliBaseScript2 and PicocliBaseScript script base classes.

PicocliBaseScript2 PicocliBaseScript
Subcommands can be defined as @Command-annotated methods in the script. No support for @Command-annotated methods.
Support for help subcommands (both the built-in one and custom ones). No support for help subcommands.
Exit code support: scripts can override afterExecution(CommandLine, int, Exception) to call System.exit. No support for exit code.
Invokes CommandLine::execute. Scripts can override beforeParseArgs(CommandLine) to install a custom IExecutionStrategy. Execution after parsing is defined in PicocliBaseScript::run and is not easy to customize. Any subcommand and the main script are both executed.
Scripts can override beforeParseArgs(CommandLine) to install a custom IParameterExceptionHandler. Invalid input handling can be customized by overriding PicocliBaseScript::handleParameterException.
Scripts can override beforeParseArgs(CommandLine) to install a custom IExecutionExceptionHandler. Runtime exception handling can be customized by overriding PicocliBaseScript::handleExecutionException.
Implements Callable<Object>, script body is transformed to the call method. Script body is transformed to the 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:

@Command(name = "ClosureDemo",
        versionProvider = {
            { -> ["line1" , "line2"] as String[] } as IVersionProvider // <1>
        },
        defaultValueProvider = {
            { argSpec -> "some default" } as IDefaultValueProvider // <2>
        })
class ClosureDemo {
    @Option(names = '-x', completionCandidates = {["A", "B", "C"]}) // <3>
    String x

    @Option(names = '-y',
            parameterConsumer = {
                { args, argSpec, commandSpec ->  // <4>
                    argSpec.setValue(args.toString() + commandSpec.name())
                    args.clear()
                } as IParameterCon...
Read more