Skip to content
Commits on Source (6)
env:
global:
# for CodeClimate
- CC_TEST_REPORTER_ID=83a2e05f875e3a67f60a1969f20a558a3de03a7592052c8bf52807d0e317f01a
language: java
jdk:
- oraclejdk8
# - openjdk7 # Disabled to avoid error java.security.NoSuchProviderException: no such provider: SunEC...
......@@ -14,8 +17,13 @@ jdk:
before_script:
- chmod +x gradlew
# for CodeClimate
- curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
- chmod +x ./cc-test-reporter
- ./cc-test-reporter before-build
script:
- ./gradlew check --info
- ./gradlew jacocoTestReport
after_success:
- bash <(curl -s https://codecov.io/bash)
- ./cc-test-reporter after-build --exit-code $TRAVIS_TEST_RESULT
......@@ -36,7 +36,7 @@ Works with Java 5 or higher (but is designed to facilitate the use of Java 8 lam
Picocli-based command line applications can have [TAB autocompletion](https://picocli.info/autocomplete.html),
interactively showing users what options and subcommands are available.
When an option has [`completionCandidates`](https://picocli.info/#__code_completion_candidates_code_variable) or has an `enum` type, autocompletion can also suggest option values.
Picocli can generate completion scripts for bash and zsh, and offers an API to easily create a [JLine](https://github.com/jline/jline2) `Completer` for your application.
Picocli can generate completion scripts for bash and zsh, and offers an API to easily [create a JLine `Completer`](https://github.com/remkop/picocli/releases#3.2.0-jline) for your application.
Picocli-based applications can easily [integrate](https://picocli.info/#_dependency_injection) with Dependency Injection containers.
......@@ -44,7 +44,7 @@ Picocli-based applications can easily [integrate](https://picocli.info/#_depende
![Picocli Demo help message with ANSI colors](docs/images/picocli.Demo.png?raw=true)
### Releases
* [Releases](https://github.com/remkop/picocli/releases) - latest: 3.5.2
* [Releases](https://github.com/remkop/picocli/releases) - latest: 3.6.1
* [Picocli 3.0.0 Release Notes](https://github.com/remkop/picocli/releases/tag/v3.0.0) - note there are some [potential breaking changes](https://github.com/remkop/picocli/releases/tag/v3.0.0#3.0.0-breaking-changes) from prior versions
* [Picocli 2.0 Release Notes](https://github.com/remkop/picocli/releases/tag/v2.0.0) - note there are some [potential breaking changes](https://github.com/remkop/picocli/releases/tag/v2.0.0#2.0-breaking-changes) from prior versions
......@@ -76,13 +76,15 @@ Picocli-based applications can easily [integrate](https://picocli.info/#_depende
## Adoption
<img src="https://picocli.info/images/groovy-logo.png" height="50"> <img src="http://micronaut.io/images/micronaut_mini_copy_tm.svg" height="50"> <img src="http://picocli.info/images/junit5logo-172x50.png" height="50">
<img src="https://picocli.info/images/groovy-logo.png" height="50"> <img src="http://micronaut.io/images/micronaut_mini_copy_tm.svg" height="50"> <img src="https://picocli.info/images/junit5logo-172x50.png" height="50"> <img src="https://picocli.info/images/debian-logo-50.png" height="50"> <img src="https://picocli.info/images/karate-logo.svg" height="50" width="50"/>
* Picocli is now part of Groovy. From Groovy 2.5, all Groovy command line tools are picocli-based, and picocli is the underlying parser for Groovy's [CliBuilder DSL](http://groovy-lang.org/dsls.html#_clibuilder).
* Picocli is now part of Micronaut. The Micronaut CLI has been rewritten with picocli, and Micronaut has dedicated support for running microservices [standalone with picocli](https://docs.micronaut.io/snapshot/guide/index.html#commandLineApps).
* Picocli is now part of JUnit 5. JUnit 5.3 migrated its `ConsoleLauncher` from jopt-simple to picocli to support @-files (argument files); this helps users who need to specify many tests on the command line and run into system limitations.
* Debian now offers a [libpicocli-java package](https://packages.debian.org/unstable/java/libpicocli-java). Thanks to [Miroslav Kravec](https://salsa.debian.org/kravemir-guest).
* Picocli is used in the Intuit [Karate](https://github.com/intuit/karate) standalone JAR / executable.
<img src="https://picocli.info/images/downloads-201807.png">
<img src="https://picocli.info/images/downloads-201808.png">
Glad to see more people are using picocli. We must be doing something right. :-)
......@@ -166,35 +168,35 @@ See the [source code](https://github.com/remkop/picocli/blob/master/src/main/jav
### Gradle
```
compile 'info.picocli:picocli:3.5.2'
compile 'info.picocli:picocli:3.6.1'
```
### Maven
```
<dependency>
<groupId>info.picocli</groupId>
<artifactId>picocli</artifactId>
<version>3.5.2</version>
<version>3.6.1</version>
</dependency>
```
### Scala SBT
```
libraryDependencies += "info.picocli" % "picocli" % "3.5.2"
libraryDependencies += "info.picocli" % "picocli" % "3.6.1"
```
### Ivy
```
<dependency org="info.picocli" name="picocli" rev="3.5.2" />
<dependency org="info.picocli" name="picocli" rev="3.6.1" />
```
### Grape
```groovy
@Grapes(
@Grab(group='info.picocli', module='picocli', version='3.5.2')
@Grab(group='info.picocli', module='picocli', version='3.6.1')
)
```
### Leiningen
```
[info.picocli/picocli "3.5.2"]
[info.picocli/picocli "3.6.1"]
```
### Buildr
```
'info.picocli:picocli:jar:3.5.2'
'info.picocli:picocli:jar:3.6.1'
```
# picocli Release Notes
# <a name="3.6.1"></a> Picocli 3.6.1
The picocli community is pleased to announce picocli 3.6.1.
This release contains bugfixes, minor enhancements and documentation improvements.
ANSI is automatically enabled on Windows if Jansi's `AnsiConsole` has been installed.
It is now possible to selectively avoid loading type converters with reflection.
Bugfix: Enum values were not rendered in `${COMPLETION-CANDIDATES}` for collection type options.
Many thanks to the many members of the picocli community who contributed!
This is the fortieth public release.
Picocli follows [semantic versioning](http://semver.org/).
## <a name="3.6.1"></a> Table of Contents
* [New and noteworthy](#3.6.1-new)
* [Fixed issues](#3.6.1-fixes)
* [Deprecations](#3.6.1-deprecated)
* [Potential breaking changes](#3.6.1-breaking-changes)
## <a name="3.6.1-new"></a> New and Noteworthy
## <a name="3.6.1-fixes"></a> Fixed issues
- [#487] Enhancement: Auto-completion script should return from `generateOptionsSwitch` immediately if there is nothing to generate. Thanks to [David Walluck](https://github.com/dwalluck) for the pull request.
- [#483][#486] Enhancement: Improve `Help.Ansi.AUTO`: automatically enable ANSI on Windows if Jansi's `AnsiConsole` has been installed. Thanks to [Philippe Charles](https://github.com/charphi) for the pull request.
- [#491] Enhancement: Improve `Help.Ansi.AUTO` cygwin/msys detection on Windows.
- [#451] Enhancement: Selectively disable reflective type converter registration. Thanks to [Paolo Di Tommaso](https://github.com/pditommaso) for the suggestion.
- [#488] Doc: Clarify in user manual that `CommandLine.setPosixClusteredShortOptionsAllowed(false)` means that option parameters cannot be attached to the option name. Thanks to [Maryam Ziyad](https://github.com/MaryamZi) for raising this.
- [#492][#493] Doc: Add section on `@Command(aliases)` attribute to user manual. Thanks to [marinier](https://github.com/marinier) for the pull request.
- [#494] Bugfix: Enum values were not rendered in `${COMPLETION-CANDIDATES}` for collection type options.
## <a name="3.6.1-deprecated"></a> Deprecations
No features were deprecated in this release.
## <a name="3.6.1-breaking-changes"></a> Potential breaking changes
This release has no breaking changes.
# <a name="3.6.0"></a> Picocli 3.6.0
The picocli community is pleased to announce picocli 3.6.0.
This release contains new features, bugfixes and enhancements.
New interface: `IDefaultProvider` allows you to get default values from a configuration file or some other central place.
`@Command` Methods: From this release, methods can be annotated with `@Command`. The method parameters provide the command options and parameters.
Internationalization: from this release, usage help message sections and the description for options and positional parameters can be specified in a resource bundle. A resource bundle can be set via annotations and programmatically.
The error message on invalid user input has been improved.
This release also contains various improvements the the bash/zsh completion script generation to be more consistent with standard completion on these shells.
Many thanks to the many members of the picocli community who raised issues and contributed solutions!
This is the thirty-nineth public release.
Picocli follows [semantic versioning](http://semver.org/).
## <a name="3.6.0"></a> Table of Contents
* [New and noteworthy](#3.6.0-new)
* [Fixed issues](#3.6.0-fixes)
* [Deprecations](#3.6.0-deprecated)
* [Potential breaking changes](#3.6.0-breaking-changes)
## <a name="3.6.0-new"></a> New and Noteworthy
### Default Provider
This release allows you to specify a default provider in the `@Command` annotation:
```java
@Command(defaultValueProvider = MyDefaultProvider.class)
class MyCommand // ...
```
The default provider allows you to get default values from a configuration file or some other central place.
Default providers need to implement the `picocli.CommandLine.IDefaultValueProvider` interface:
```java
public interface IDefaultValueProvider {
/**
* Returns the default value for an option or positional parameter or {@code null}.
* The returned value is converted to the type of the option/positional parameter
* via the same type converter used when populating this option/positional
* parameter from a command line argument.
*
* @param argSpec the option or positional parameter, never {@code null}
* @return the default value for the option or positional parameter, or {@code null} if
* this provider has no default value for the specified option or positional parameter
* @throws Exception when there was a problem obtaining the default value
*/
String defaultValue(ArgSpec argSpec) throws Exception;
}
```
### `@Command` Methods
From picocli 3.6, methods can be annotated with `@Command`. The method parameters provide the command options and parameters. For example:
```java
class Cat {
public static void main(String[] args) {
CommandLine.invoke("cat", Cat.class, args);
}
@Command(description = "Concatenate FILE(s) to standard output.",
mixinStandardHelpOptions = true, version = "3.6.0")
void cat(@Option(names = {"-E", "--show-ends"}) boolean showEnds,
@Option(names = {"-n", "--number"}) boolean number,
@Option(names = {"-T", "--show-tabs"}) boolean showTabs,
@Option(names = {"-v", "--show-nonprinting"}) boolean showNonPrinting,
@Parameters(paramLabel = "FILE") File[] files) {
// process files
}
}
```
The usage help of the above command looks like this:
```
Usage: cat [-EhnTvV] [FILE...]
Concatenate FILE(s) to standard output.
[FILE...]
-E, --show-ends
-h, --help Show this help message and exit.
-n, --number
-T, --show-tabs
-v, --show-nonprinting
-V, --version Print version information and exit.
```
See below for an example that uses a resource bundle to define usage help descriptions outside the code.
For positional parameters, the `@Parameters` annotation may be omitted on method parameters.
TIP: If compiled with the `-parameters` flag on Java 8 or higher, the `paramLabel` of positional parameters is obtained from the method parameter name using reflection instead of the generic arg0, arg1, etc.
#### Subcommand Methods
If the enclosing class is annotated with `@Command`, method commands are added as subcommands to the class command, unless the class command has attribute `@Command(addMethodSubcommands = false)`.
For example:
```java
@Command(name = "git", mixinStandardHelpOptions = true, version = "picocli-3.6.0")
class Git {
@Option(names = "--git-dir", descriptionKey = "GITDIR")
Path path;
@Command
void commit(@Option(names = {"-m", "--message"}) String commitMessage,
@Option(names = "--squash", paramLabel = "<commit>") String squash,
@Parameters(paramLabel = "<file>") File[] files) {
// ... implement business logic
}
}
```
Use `@Command(addMethodSubcommands = false)` on the class `@Command` annotation if the `@Command`-annotated methods in this class should not be added as subcommands.
The usage help of the `git commit` command looks like this:
```
Usage: git commit [--squash=<commit>] [-m=<arg0>] [<file>...]
[<file>...]
--squash=<commit>
-m, --message=<arg0>
```
### Internationalization
From version 3.6, usage help message sections and the description for options and positional parameters can be specified in a resource bundle. A resource bundle can be set via annotations and programmatically.
Annotation example:
```java
@Command(name = "i18n-demo", resourceBundle = "my.org.I18nDemo_Messages")
class I18nDemo {}
```
Programmatic example:
```java
@Command class I18nDemo2 {}
CommandLine cmd = new CommandLine(new I18nDemo2());
cmd.setResourceBundle(ResourceBundle.getBundle("my.org.I18nDemo2_Messages"));
```
Resources for multiple commands can be specified in a single ResourceBundle. Keys and their value can be shared by multiple commands (so you don't need to repeat them for every command), but keys can be prefixed with `fully qualified command name + "."` to specify different values for different commands. The most specific key wins.
This is especially convenient for `@Command` methods where long description annotations would make the code less easy to read.
You can use a resource bundle to move the descriptions out of the code:
```
# shared between all commands
help = Show this help message and exit.
version = Print version information and exit.
# command-specific strings
git.usage.description = Version control system
git.GITDIR = Set the path to the repository
git.commit.usage.description = Record changes to the repository
git.commit.message = Use the given <msg> as the commit message.
git.commit.squash = Construct a commit message for use with rebase --autosquash.
git.commit.<file>[0..*] = The files to commit.
```
With this resource bundle, the usage help for the above `git commit` command looks like this:
```
Usage: git commit [--squash=<commit>] [-m=<arg0>] [<file>...]
Record changes to the repository
[<file>...] The files to commit.
--squash=<commit> Construct a commit message for use with rebase
--autosquash.
-m, --message=<arg0> Use the given <msg> as the commit message.
```
### Improved Error Messages
The error messages on invalid input have been improved. For example:
Previously, if an argument could not be converted to a primitive type, the error looked like this:
`Could not convert 'abc' to int for option '-num': java.lang.NumberFormatException: For input string: \"abc\"`
The new error message for primitive types looks like this:
`Invalid value for option '-num': 'abc' is not an int`
Previously, if an argument could not be converted to an enum, the error looked like this:
`Could not convert 'xyz' to TimeUnit for option '-timeUnit': java.lang.IllegalArgumentException: No enum constant java.util.concurrent.TimeUnit.xyz`
The new error message for enums looks like this:
`Invalid value for option '-timeUnit': expected one of [NANOSECONDS, MILLISECONDS, MICROSECONDS, SECONDS, MINUTES, HOURS, DAYS] but was 'xyz'`
## <a name="3.6.0-fixes"></a> Fixed issues
- [#321] API: Add support for IDefaultValueProvider. Thanks to [Nicolas MASSART](https://github.com/NicolasMassart) for the pull request.
- [#416] API: Added support for `@Command` annotation on methods (in addition to classes). Thanks to [illes](https://github.com/illes) for the pull request.
- [#433] API: Added method `printHelpIfRequested` that accepts a `ColorScheme` parameter. Thanks to [Benny Bottema](https://github.com/bbottema) for the suggestion.
- [#441] API: Added `hideParamSyntax` attribute to `@Option` and `@Parameters` to allow suppressing usage syntax decorations around the param label. Thanks to [Benny Bottema](https://github.com/bbottema) for the pull request.
- [#22], [#415], [#436] API: Added internationalization and localization support via resource bundles.
- [#473] Enhancement: Improved error messages for invalid input.
- [#461] Bugfix: Script auto-completion only suggests options and never default bash completions. Thanks to [David Walluck](https://github.com/dwalluck) for the pull request.
- [#466] Bugfix: Script auto-completion should not generate suggestions for options with arguments that have no known completions. Thanks to [David Walluck](https://github.com/dwalluck) for the pull request.
- [#470] Bugfix: Script auto-completion should generate suggestions for short options with arguments. Thanks to [David Walluck](https://github.com/dwalluck) for the pull request.
- [#444] Bugfix: Usage help shows duplicate aliases if registered with same alias multiple times.
- [#452] Doc: Add UML class diagrams to picocli Javadoc.
- [#475] Doc: Renamed module `examples` to `picocli-examples`.
- [#478] Doc: Add convenience API example to `CommandLine` class Javadoc.
## <a name="3.6.0-deprecated"></a> Deprecations
No features were deprecated in this release.
## <a name="3.6.0-breaking-changes"></a> Potential breaking changes
The error message displayed on invalid input is different from previous releases. This may break unit tests that expect an exact error message.
# <a name="3.5.2"></a> Picocli 3.5.2
The picocli community is pleased to announce picocli 3.5.2.
......
group 'info.picocli'
description 'Java command line parser with both an annotations API and a programmatic API. Usage help with ANSI styles and colors. Autocomplete. Nested subcommands. Easily included as source to avoid adding a dependency.'
version '3.5.2'
version '3.6.1'
// for bumpVersion task
def oldVersion = '3\\.5\\.2-SNAPSHOT'
def oldRevdate = '2018\\-08\\-11'
def revDate = '2018-08-14'
def oldVersion = '3\\.6\\.1-SNAPSHOT'
def oldRevdate = '2018\\-09\\-12'
def revDate = '2018-09-28'
// for bumpReadmeVersion task
def previousReleaseVersion = '3.5.1'
def previousReleaseVersion = '3.6.0'
buildscript {
repositories {
......@@ -54,7 +54,7 @@ allprojects {
options.compilerArgs << '-Xlint:unchecked' << '-Xlint:deprecation'
}
}
project('examples') {
project('picocli-examples') {
dependencies {
compile rootProject
compile 'org.apache.ivy:ivy:2.4.0', // for Intelli/J
......@@ -71,7 +71,7 @@ project('examples') {
//a task that generates the resources for the example VersionProviderDemo1:
task generateVersionTxt {
description 'Creates a version.txt file with build info that is added to the root of the examples jar'
description 'Creates a version.txt file with build info that is added to the root of the picocli-examples jar'
doLast {
new File(generatedResources).mkdirs()
def generated = new File(generatedResources, "version.txt")
......@@ -105,7 +105,13 @@ javadoc {
options.overview = "src/main/java/overview.html"
destinationDir = file("build/docs/apidocs")
}
javadoc.dependsOn('asciidoctor')
// work around https://github.com/gradle/gradle/issues/4046
javadoc.dependsOn('copyJavadocDocFiles')
task copyJavadocDocFiles(type: Copy) {
from('src/main/java')
into 'build/docs/apidocs'
include '**/doc-files/*.*'
}
jacocoTestReport {
reports {
......@@ -129,6 +135,7 @@ task javadocJar(type: Jar, dependsOn: javadoc) {
classifier = 'javadoc'
from javadoc.destinationDir
}
javadoc.dependsOn('asciidoctor')
asciidoctor {
sourceDir = file('docs')
outputDir = file('build/docs')
......
picocli (3.6.1-1) UNRELEASED; urgency=medium
* New upstream release
* debian/patches: fix patch
* debian/rules: fix gradle exclude task
-- Miroslav Kravec <kravec.miroslav@gmail.com> Sun, 07 Oct 2018 11:53:36 +0200
picocli (3.5.2-2) unstable; urgency=medium
* debian/copyright: add missing copyright contributions (Closes: #908606)
* debian/copyright: add missing copyright attribution (Closes: #908606)
-- Miroslav Kravec <kravec.miroslav@gmail.com> Sat, 15 Sep 2018 16:16:33 +0200
......
......@@ -3,16 +3,16 @@ Date: Sat, 8 Sep 2018 13:37:14 +0200
Subject: Adjust build to work without asciidoctor, and with default java
---
build.gradle | 21 ++-------------------
1 file changed, 2 insertions(+), 19 deletions(-)
build.gradle | 29 ++---------------------------
1 file changed, 2 insertions(+), 27 deletions(-)
diff --git a/build.gradle b/build.gradle
index 262ef69..76d7061 100644
index 66bce6c..0822354 100644
--- a/build.gradle
+++ b/build.gradle
@@ -10,21 +10,11 @@ def revDate = '2018-08-14'
@@ -10,21 +10,11 @@ def revDate = '2018-09-28'
// for bumpReadmeVersion task
def previousReleaseVersion = '3.5.1'
def previousReleaseVersion = '3.6.0'
-buildscript {
- repositories {
......@@ -42,18 +42,26 @@ index 262ef69..76d7061 100644
apply plugin: 'jacoco'
apply plugin: 'distribution'
apply plugin: 'maven-publish'
@@ -105,7 +94,6 @@ javadoc {
@@ -105,14 +94,6 @@ javadoc {
options.overview = "src/main/java/overview.html"
destinationDir = file("build/docs/apidocs")
}
-javadoc.dependsOn('asciidoctor')
-// work around https://github.com/gradle/gradle/issues/4046
-javadoc.dependsOn('copyJavadocDocFiles')
-task copyJavadocDocFiles(type: Copy) {
- from('src/main/java')
- into 'build/docs/apidocs'
- include '**/doc-files/*.*'
-}
-
jacocoTestReport {
reports {
@@ -129,11 +117,6 @@ task javadocJar(type: Jar, dependsOn: javadoc) {
xml.enabled true
@@ -135,12 +116,6 @@ task javadocJar(type: Jar, dependsOn: javadoc) {
classifier = 'javadoc'
from javadoc.destinationDir
}
-javadoc.dependsOn('asciidoctor')
-asciidoctor {
- sourceDir = file('docs')
- outputDir = file('build/docs')
......
......@@ -4,4 +4,4 @@
dh $@ --buildsystem=gradle --with maven-repo-helper
override_dh_auto_build:
dh_auto_build -- jar -x :examples:compileGroovy
dh_auto_build -- jar -x :picocli-examples:compileGroovy