Skip to content

Commits on Source 2

......@@ -5,6 +5,13 @@ env:
language: java
jdk:
- oraclejdk8
- oraclejdk11
- oraclejdk-ea
- openjdk8
- openjdk9
- openjdk10
- openjdk11
- openjdk-ea
# - openjdk7 # Disabled to avoid error java.security.NoSuchProviderException: no such provider: SunEC...
# - oraclejdk7
# $ jdk_switcher use oraclejdk7
......@@ -15,6 +22,10 @@ jdk:
#
# - openjdk6 # gradle 3.1 requires java 7
matrix:
allow_failures:
- jdk: oraclejdk-ea
before_script:
- chmod +x gradlew
# for CodeClimate
......@@ -23,7 +34,6 @@ before_script:
- ./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
......@@ -45,7 +45,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.9.1 [Release Notes](https://github.com/remkop/picocli/releases/tag/v3.9.1)
* [Releases](https://github.com/remkop/picocli/releases) - Latest: 3.9.2 [Release Notes](https://github.com/remkop/picocli/releases/tag/v3.9.2)
* Older: Picocli 3.0.0 [Release Notes](https://github.com/remkop/picocli/releases/tag/v3.0.0)
* Older: Picocli 2.0 [Release Notes](https://github.com/remkop/picocli/releases/tag/v2.0.0)
......@@ -73,6 +73,9 @@ Picocli-based applications can easily [integrate](https://picocli.info/#_depende
* [Picocli 2.0: Steroids上的Groovy脚本](https://picocli.info/zh/picocli-2.0-groovy-scripts-on-steroids.html)
* [Picocli 2.0: 以少求多](https://picocli.info/zh/picocli-2.0-do-more-with-less.html)
### Mailing List
Join the [picocli Google group](https://groups.google.com/d/forum/picocli) if you are interested in discussing anything picocli-related and receiving announcements on new releases.
### Related
* Check out Thibaud Lepretre's [picocli Spring boot starter](https://github.com/kakawait/picocli-spring-boot-starter)!
......@@ -92,6 +95,7 @@ Picocli-based applications can easily [integrate](https://picocli.info/#_depende
* Picocli is used in the Intuit [Karate](https://github.com/intuit/karate) standalone JAR / executable.
* Picocli is part of [Ballerina](https://ballerina.io/). Ballerina uses picocli for all its command line utilities.
* Picocli is used in the [CheckStyle](https://checkstyle.org/cmdline.html) standalone JAR / executable from Checkstyle 8.15.
* Picocli is included in the [OpenJDK Quality Outreach](https://wiki.openjdk.java.net/display/quality/Quality+Outreach) list of Free Open Source Software (FOSS) projects that actively test against OpenJDK builds.
<img src="https://picocli.info/images/downloads-201812.png">
......@@ -177,35 +181,35 @@ See the [source code](https://github.com/remkop/picocli/blob/master/src/main/jav
### Gradle
```
compile 'info.picocli:picocli:3.9.1'
compile 'info.picocli:picocli:3.9.2'
```
### Maven
```
<dependency>
<groupId>info.picocli</groupId>
<artifactId>picocli</artifactId>
<version>3.9.1</version>
<version>3.9.2</version>
</dependency>
```
### Scala SBT
```
libraryDependencies += "info.picocli" % "picocli" % "3.9.1"
libraryDependencies += "info.picocli" % "picocli" % "3.9.2"
```
### Ivy
```
<dependency org="info.picocli" name="picocli" rev="3.9.1" />
<dependency org="info.picocli" name="picocli" rev="3.9.2" />
```
### Grape
```groovy
@Grapes(
@Grab(group='info.picocli', module='picocli', version='3.9.1')
@Grab(group='info.picocli', module='picocli', version='3.9.2')
)
```
### Leiningen
```
[info.picocli/picocli "3.9.1"]
[info.picocli/picocli "3.9.2"]
```
### Buildr
```
'info.picocli:picocli:jar:3.9.1'
'info.picocli:picocli:jar:3.9.2'
```
# picocli Release Notes
# <a name="3.9.2"></a> Picocli 3.9.2
The picocli community is pleased to announce picocli 3.9.2.
This release contains bugfixes and enhancements.
Picocli now has a mailing list `picocli at googlegroups dot com`. Alternatively visit the [picocli Google group](https://groups.google.com/d/forum/picocli) web interface.
The user manual has improved documentation for internationalization and localization, and the section on Dependency Injection now has a Spring Boot example and link to the Micronaut user manual.
Bugfixes: `AutoComplete` now uses the specified `IFactory` correctly for `CommandLine`; defaulting `usageHelp` or `versionHelp` options no longer prevents validation of required options; and usage help for booleans options with `arity = "1"` now correctly show the option parameter in the synopsis.
Many thanks to the many members of the picocli community who contributed pull requests, bug reports and participated in discussions!
This is the forty-seventh public release.
Picocli follows [semantic versioning](http://semver.org/).
## <a name="3.9.2"></a> Table of Contents
* [New and noteworthy](#3.9.2-new)
* [Fixed issues](#3.9.2-fixes)
* [Deprecations](#3.9.2-deprecated)
* [Potential breaking changes](#3.9.2-breaking-changes)
## <a name="3.9.2-new"></a> New and Noteworthy
Picocli now has a mailing list `picocli at googlegroups dot com`. Alternatively visit the [picocli Google group](https://groups.google.com/d/forum/picocli) web interface.
The user manual has improved documentation for internationalization and localization. Dependency Injection is now a top-level section and now has a Spring Boot example and link to the Micronaut user manual.
## <a name="3.9.2-fixes"></a> Fixed issues
- [#602] Make `CommandLine` in `AutoComplete` use correct `IFactory` implementation. Thanks to [Mikołaj Krzyżanowski](https://github.com/MikolajK) for the pull request.
- [#608] Bugfix: defaulting `usageHelp` or `versionHelp` options incorrectly prevented validation of required options and positional parameters. Thanks to [Pietro Braione](https://github.com/pietrobraione) for the bug report.
- [#612] Bugfix: Usage help for booleans options with `arity = "1"` now correctly show the option parameter in synopsis. Thanks to [prewersk](https://github.com/prewersk) for the bug report.
- [#606] Doc: Added subcommand example. Thanks to [Andreas Deininger](https://github.com/deining) for the pull request.
- [#605] Doc: Improved documentation for internationalization and localization. Thanks to [Andreas Deininger](https://github.com/deining) for raising this.
- [#604] Doc: Improve user manual section on Dependency Injection: add Spring Boot example. Thanks to [Alistair Rutherford](https://github.com/alistairrutherford) for the example code.
- [#610] Build: add JDKs to Travis CI build.
- [#609] Created mailing list `picocli at googlegroups dot com`: [picocli Google group](https://groups.google.com/d/forum/picocli).
## <a name="3.9.2-deprecated"></a> Deprecations
No features were deprecated in this release.
## <a name="3.9.2-breaking-changes"></a> Potential breaking changes
This release has no breaking changes.
# <a name="3.9.1"></a> Picocli 3.9.1
The picocli community is pleased to announce picocli 3.9.1.
......
......@@ -8,13 +8,12 @@ buildscript {
}
dependencies {
classpath 'org.asciidoctor:asciidoctor-gradle-plugin:1.5.3'
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.+'
classpath "org.asciidoctor:asciidoctor-gradle-plugin:$asciidoctorGradlePluginVersion"
classpath "com.jfrog.bintray.gradle:gradle-bintray-plugin:$gradleBintrayPluginVersion"
}
}
apply plugin: 'org.asciidoctor.convert'
apply plugin: 'jacoco'
apply plugin: 'distribution'
apply plugin: 'maven-publish'
apply plugin: 'com.jfrog.bintray'
......@@ -23,8 +22,10 @@ allprojects {
apply plugin: 'groovy'
apply plugin: 'java'
apply plugin: 'java-library' // to avoid https://github.com/gradle/gradle/issues/1118
sourceCompatibility = 1.5
targetCompatibility = 1.5
sourceCompatibility = !org.gradle.api.JavaVersion.current().isJava9Compatible() ?
1.5 : org.gradle.api.JavaVersion.current().isJava11Compatible() ? 1.7 : 1.6
targetCompatibility = !org.gradle.api.JavaVersion.current().isJava9Compatible() ?
1.5 : org.gradle.api.JavaVersion.current().isJava11Compatible() ? 1.7 : 1.6
repositories {
jcenter()
......@@ -114,10 +115,8 @@ allprojects {
ext {
bintrayUsername = System.getenv('BINTRAY_USER')
bintrayApiKey = System.getenv('BINTRAY_KEY')
bintrayDryRun = false
mavenOssUser = System.getenv('MAVEN_OSS_USER')
mavenOssPassword = System.getenv('MAVEN_OSS_PASSWORD')
mavenOssSync = false
// pom configuration for MavenPublication
pomConfig = {
......@@ -164,24 +163,13 @@ asciidoctor {
outputDir = file('build/docs')
logDocuments = true
}
jacocoTestReport {
reports {
xml.enabled true
html.enabled false
// jacoco 0.8.2 does not work with Java 13; gradle 4.x has no JavaVersion enum value for Java 12
if (org.gradle.api.JavaVersion.current().isJava11Compatible()) {
project.logger.lifecycle("skipping jacoco test for Java version ${org.gradle.api.JavaVersion.current()}")
} else {
project.logger.lifecycle("applying jacoco build file for Java version ${org.gradle.api.JavaVersion.current()}")
apply from: "gradle/jacoco.gradle"
}
}
jacocoTestCoverageVerification {
violationRules {
rule {
limit {
minimum = 0.98
}
}
}
}
// run coverage verification during the build (and fail when appropriate)
check.dependsOn jacocoTestCoverageVerification
task bumpReadmeVersion {
doLast {
// README.md
......@@ -239,6 +227,14 @@ task copyDocs(type: Copy) {
into 'docs'
}
allprojects {
ext {
bintrayDryRun = false //[Default: false] Whether to run this as dry-run, without deploying
bintrayPublish = true //[Default: false] Whether version should be auto published after an upload
bintrayOverride = false //[Default: false] Whether to override version artifacts already published
mavenOssSync = true //[Default: true] Determines whether to sync the version to Maven Central.
}
}
ext {
bintrayPackage = 'picocli'
bintrayWebsiteUrl = 'http://picocli.info'
......@@ -249,8 +245,8 @@ bintray {
key = bintrayApiKey
publications = ['MyPublication']
dryRun = bintrayDryRun //[Default: false] Whether to run this as dry-run, without deploying
publish = false //[Default: false] Whether version should be auto published after an upload
override = false //[Default: false] Whether to override version artifacts already published
publish = bintrayPublish //[Default: false] Whether version should be auto published after an upload
override = bintrayOverride //[Default: false] Whether to override version artifacts already published
//Package configuration. The plugin will use the repo and name properties to check if the package already exists. In that case, there's no need to configure the other package properties (like userOrg, desc, etc).
pkg {
repo = 'picocli'
......@@ -314,8 +310,7 @@ Release procedure:
7a update README.md (latest version, release notes)
8. commit -m "Release picocli version ..."
9. tag v$version
10.a gradlew bintrayUpload - to publish to bintray.com
10.b gradlew bintrayPublish - to sign, publish and Maven central sync task)
10. gradlew bintrayUpload - to publish to bintray.com
11. edit version numbers: increase minor version and add -SNAPSHOT classifier
12. gradlew bumpVersion
......
picocli (3.9.2-1) unstable; urgency=medium
* New upstream release
* debian/changelog: file-contains-trailing-whitespace
* debian/control: bump standards-version
* debian/patches: adjust to new release
-- Miroslav Kravec <kravec.miroslav@gmail.com> Sat, 26 Jan 2019 19:46:09 +0100
picocli (3.9.1-1) unstable; urgency=medium
* New upstream release
......
......@@ -10,7 +10,7 @@ Build-Depends:
groovy (>= 2.4.10),
libjline2-java,
maven-repo-helper
Standards-Version: 4.2.1
Standards-Version: 4.3.0
Vcs-Git: https://salsa.debian.org/java-team/picocli.git
Vcs-Browser: https://salsa.debian.org/java-team/picocli
Homepage: https://picocli.info
......
From: Miroslav Kravec <kravec.miroslav@gmail.com>
Date: Sun, 13 Jan 2019 10:19:34 +0100
Date: Sat, 26 Jan 2019 19:31:42 +0100
Subject: Adjust build to work without asciidoctor and bintray,
and with default java
---
build.gradle | 61 ++-------------------------------------
picocli-codegen/build.gradle | 36 +----------------------
picocli-shell-jline2/build.gradle | 36 +----------------------
build.gradle | 61 ---------------------------------------
picocli-codegen/build.gradle | 35 +---------------------
picocli-shell-jline2/build.gradle | 35 +---------------------
picocli-shell-jline3/build.gradle | 34 ----------------------
4 files changed, 4 insertions(+), 163 deletions(-)
4 files changed, 2 insertions(+), 163 deletions(-)
diff --git a/build.gradle b/build.gradle
index 73543c8..0b34d03 100644
index ae743a8..711c1da 100644
--- a/build.gradle
+++ b/build.gradle
@@ -2,29 +2,16 @@ group 'info.picocli'
@@ -2,21 +2,8 @@ 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 "$projectVersion"
......@@ -24,39 +24,19 @@ index 73543c8..0b34d03 100644
- }
-
- dependencies {
- classpath 'org.asciidoctor:asciidoctor-gradle-plugin:1.5.3'
- classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.+'
- classpath "org.asciidoctor:asciidoctor-gradle-plugin:$asciidoctorGradlePluginVersion"
- classpath "com.jfrog.bintray.gradle:gradle-bintray-plugin:$gradleBintrayPluginVersion"
- }
-}
-
-apply plugin: 'org.asciidoctor.convert'
apply plugin: 'jacoco'
apply plugin: 'distribution'
apply plugin: 'maven-publish'
-apply plugin: 'com.jfrog.bintray'
allprojects {
apply plugin: 'groovy'
apply plugin: 'java'
apply plugin: 'java-library' // to avoid https://github.com/gradle/gradle/issues/1118
- sourceCompatibility = 1.5
- targetCompatibility = 1.5
+ sourceCompatibility = 1.6
+ targetCompatibility = 1.6
repositories {
jcenter()
@@ -112,9 +99,6 @@ allprojects {
}
ext {
- bintrayUsername = System.getenv('BINTRAY_USER')
- bintrayApiKey = System.getenv('BINTRAY_KEY')
- bintrayDryRun = false
mavenOssUser = System.getenv('MAVEN_OSS_USER')
mavenOssPassword = System.getenv('MAVEN_OSS_PASSWORD')
mavenOssSync = false
@@ -158,12 +142,6 @@ jar {
@@ -157,19 +144,6 @@ jar {
}
javadoc.options.overview = "src/main/java/overview.html"
......@@ -66,10 +46,17 @@ index 73543c8..0b34d03 100644
- outputDir = file('build/docs')
- logDocuments = true
-}
jacocoTestReport {
reports {
xml.enabled true
@@ -244,41 +222,6 @@ ext {
-// jacoco 0.8.2 does not work with Java 13; gradle 4.x has no JavaVersion enum value for Java 12
-if (org.gradle.api.JavaVersion.current().isJava11Compatible()) {
- project.logger.lifecycle("skipping jacoco test for Java version ${org.gradle.api.JavaVersion.current()}")
-} else {
- project.logger.lifecycle("applying jacoco build file for Java version ${org.gradle.api.JavaVersion.current()}")
- apply from: "gradle/jacoco.gradle"
-}
task bumpReadmeVersion {
doLast {
// README.md
@@ -240,41 +214,6 @@ ext {
bintrayWebsiteUrl = 'http://picocli.info'
bintrayLabels = ['cli', 'cli framework', 'java', 'command line', 'ergonomic', 'library', 'parser', 'ansi', 'colors', 'annotations', 'reflection', 'usage', 'help', 'customizable', 'stand-alone application', 'main method', 'picocli']
}
......@@ -78,8 +65,8 @@ index 73543c8..0b34d03 100644
- key = bintrayApiKey
- publications = ['MyPublication']
- dryRun = bintrayDryRun //[Default: false] Whether to run this as dry-run, without deploying
- publish = false //[Default: false] Whether version should be auto published after an upload
- override = false //[Default: false] Whether to override version artifacts already published
- publish = bintrayPublish //[Default: false] Whether version should be auto published after an upload
- override = bintrayOverride //[Default: false] Whether to override version artifacts already published
- //Package configuration. The plugin will use the repo and name properties to check if the package already exists. In that case, there's no need to configure the other package properties (like userOrg, desc, etc).
- pkg {
- repo = 'picocli'
......@@ -112,10 +99,10 @@ index 73543c8..0b34d03 100644
publications {
MyPublication(MavenPublication) {
diff --git a/picocli-codegen/build.gradle b/picocli-codegen/build.gradle
index 889264e..8cd29fb 100644
index 061f4f9..abcc61a 100644
--- a/picocli-codegen/build.gradle
+++ b/picocli-codegen/build.gradle
@@ -2,13 +2,12 @@ plugins {
@@ -2,12 +2,12 @@ plugins {
id 'java'
id 'distribution'
id 'maven-publish'
......@@ -125,12 +112,11 @@ index 889264e..8cd29fb 100644
group 'info.picocli'
description 'Picocli Code Generation - Tools to generate documentation, configuration, source code and other files from a picocli model.'
version "$projectVersion"
-sourceCompatibility = 1.5
+sourceCompatibility = 1.6
dependencies {
compile rootProject
@@ -31,39 +30,6 @@ ext {
@@ -30,39 +30,6 @@ ext {
bintrayWebsiteUrl = 'https://github.com/remkop/picocli/tree/master/picocli-codegen'
bintrayLabels = ['cli', 'cli framework', 'command line', 'codegen', 'picocli']
}
......@@ -139,8 +125,8 @@ index 889264e..8cd29fb 100644
- key = bintrayApiKey
- publications = ['MyPublication']
- dryRun = bintrayDryRun //[Default: false] Whether to run this as dry-run, without deploying
- publish = false //[Default: false] Whether version should be auto published after an upload
- override = false //[Default: false] Whether to override version artifacts already published
- publish = bintrayPublish //[Default: false] Whether version should be auto published after an upload
- override = bintrayOverride //[Default: false] Whether to override version artifacts already published
- //Package configuration. The plugin will use the repo and name properties to check if the package already exists. In that case, there's no need to configure the other package properties (like userOrg, desc, etc).
- pkg {
- repo = 'picocli'
......@@ -171,10 +157,10 @@ index 889264e..8cd29fb 100644
publications {
MyPublication(MavenPublication) {
diff --git a/picocli-shell-jline2/build.gradle b/picocli-shell-jline2/build.gradle
index bc8023d..68dac91 100644
index 63245e4..68dac91 100644
--- a/picocli-shell-jline2/build.gradle
+++ b/picocli-shell-jline2/build.gradle
@@ -2,13 +2,12 @@ plugins {
@@ -2,12 +2,12 @@ plugins {
id 'java'
id 'distribution'
id 'maven-publish'
......@@ -184,12 +170,11 @@ index bc8023d..68dac91 100644
group 'info.picocli'
description 'Picocli Shell JLine2 - easily build interactive shell applications with JLine 2 and picocli.'
version "$projectVersion"
-sourceCompatibility = 1.5
+sourceCompatibility = 1.6
dependencies {
compile rootProject
@@ -33,39 +32,6 @@ ext {
@@ -32,39 +32,6 @@ ext {
bintrayWebsiteUrl = 'https://github.com/remkop/picocli/tree/master/picocli-shell-jline2'
bintrayLabels = ['cli', 'interactive', 'commandline', 'shell', 'picocli', 'jline']
}
......@@ -198,8 +183,8 @@ index bc8023d..68dac91 100644
- key = bintrayApiKey
- publications = ['MyPublication']
- dryRun = bintrayDryRun //[Default: false] Whether to run this as dry-run, without deploying
- publish = false //[Default: false] Whether version should be auto published after an upload
- override = false //[Default: false] Whether to override version artifacts already published
- publish = bintrayPublish //[Default: false] Whether version should be auto published after an upload
- override = bintrayOverride //[Default: false] Whether to override version artifacts already published
- //Package configuration. The plugin will use the repo and name properties to check if the package already exists. In that case, there's no need to configure the other package properties (like userOrg, desc, etc).
- pkg {
- repo = 'picocli'
......@@ -230,7 +215,7 @@ index bc8023d..68dac91 100644
publications {
MyPublication(MavenPublication) {
diff --git a/picocli-shell-jline3/build.gradle b/picocli-shell-jline3/build.gradle
index 2eb0d77..35c009f 100644
index 79b0c56..d46585d 100644
--- a/picocli-shell-jline3/build.gradle
+++ b/picocli-shell-jline3/build.gradle
@@ -2,7 +2,6 @@ plugins {
......@@ -241,7 +226,7 @@ index 2eb0d77..35c009f 100644
}
group 'info.picocli'
@@ -33,39 +32,6 @@ ext {
@@ -32,39 +31,6 @@ ext {
bintrayWebsiteUrl = 'https://github.com/remkop/picocli/tree/master/picocli-shell-jline3'
bintrayLabels = ['cli', 'interactive', 'commandline', 'shell', 'picocli', 'jline']
}
......@@ -250,8 +235,8 @@ index 2eb0d77..35c009f 100644
- key = bintrayApiKey
- publications = ['MyPublication']
- dryRun = bintrayDryRun //[Default: false] Whether to run this as dry-run, without deploying
- publish = false //[Default: false] Whether version should be auto published after an upload
- override = false //[Default: false] Whether to override version artifacts already published
- publish = bintrayPublish //[Default: false] Whether version should be auto published after an upload
- override = bintrayOverride //[Default: false] Whether to override version artifacts already published
- //Package configuration. The plugin will use the repo and name properties to check if the package already exists. In that case, there's no need to configure the other package properties (like userOrg, desc, etc).
- pkg {
- repo = 'picocli'
......
asciidoctorGradlePluginVersion = 1.5.3
gradleBintrayPluginVersion = 1.+
groovyVersion = 2.4.10
hamcrestCoreVersion = 1.3
ivyVersion = 2.4.0
jacocoVersion = 0.8.2
jansiVersion = 1.15
jlineVersion = 2.14.6
jline3Version = 3.9.0
......@@ -8,12 +11,12 @@ junitDepVersion = 4.11
junitVersion = 4.12
# projectPreviousReleaseVersion is non-SNAPSHOT, only published releases
projectPreviousReleaseVersion = 3\\.9\\.0
projectPreviousReleaseVersion = 3\\.9\\.1
# projectPreviousVersionRegex may be a SNAPSHOT
projectPreviousVersionRegex = 3\\.9\\.1-SNAPSHOT
projectVersion = 3.9.1
projectPreviousVersionRegex = 3\\.9\\.2-SNAPSHOT
projectVersion = 3.9.2
releaseDate = 2019-01-10
releaseDatePreviousRegex = 2019\\-01\\-04
releaseDate = 2019-01-20
releaseDatePreviousRegex = 2019\\-01\\-10
systemRulesVersion = 1.17.1
\ No newline at end of file
apply plugin: 'java'
apply plugin: 'jacoco'
jacoco {
toolVersion = "$jacocoVersion"
}
jacocoTestReport {
reports {
xml.enabled true
html.enabled false
}
}
jacocoTestCoverageVerification {
violationRules {
rule {
limit {
minimum = 0.98
}
}
}
}
// run coverage verification during the build (and fail when appropriate)
check.finalizedBy jacocoTestCoverageVerification
check.finalizedBy jacocoTestReport
......@@ -63,7 +63,7 @@ Note that the `picocli-codegen` module is only added as a dependency for the `ex
<dependency>
<groupId>info.picocli</groupId>
<artifactId>picocli-codegen</artifactId>
<version>3.9.1</version>
<version>3.9.2</version>
<type>jar</type>
</dependency>
</dependencies>
......@@ -82,8 +82,8 @@ configurations {
generateConfig
}
dependencies {
compile 'info.picocli:picocli:3.9.1'
generateConfig 'info.picocli:picocli-codegen:3.9.1'
compile 'info.picocli:picocli:3.9.2'
generateConfig 'info.picocli:picocli-codegen:3.9.2'
}
```
......
......@@ -8,7 +8,6 @@ plugins {
group 'info.picocli'
description 'Picocli Code Generation - Tools to generate documentation, configuration, source code and other files from a picocli model.'
version "$projectVersion"
sourceCompatibility = 1.5
dependencies {
compile rootProject
......@@ -36,8 +35,8 @@ bintray {
key = bintrayApiKey
publications = ['MyPublication']
dryRun = bintrayDryRun //[Default: false] Whether to run this as dry-run, without deploying
publish = false //[Default: false] Whether version should be auto published after an upload
override = false //[Default: false] Whether to override version artifacts already published
publish = bintrayPublish //[Default: false] Whether version should be auto published after an upload
override = bintrayOverride //[Default: false] Whether to override version artifacts already published
//Package configuration. The plugin will use the repo and name properties to check if the package already exists. In that case, there's no need to configure the other package properties (like userOrg, desc, etc).
pkg {
repo = 'picocli'
......
/*
Copyright 2017 Remko Popma
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package picocli.examples.subcommands;
import java.util.Locale;
import picocli.CommandLine;
import picocli.CommandLine.Command;
import picocli.CommandLine.Parameters;
public class SubcommandDemo {
@Command(name = "ISOCodeResolve", subcommands = { Subcommand1.class, Subcommand2.class,
CommandLine.HelpCommand.class }, description = "Resolve ISO country codes (ISO-3166-1) or language codes (ISO 639-1 or -2)")
static class ParentCommand implements Runnable {
@Override
public void run() { }
}
@Command(name = "country", description = "Resolve ISO country code (ISO-3166-1, Alpha-2 code)")
static class Subcommand1 implements Runnable {
@Parameters(arity = "1..*", paramLabel = "<country1> <country2>", description = "country code(s) to be resolved")
private String[] countryCodes;
@Override
public void run() {
for (String code : countryCodes) {
System.out.println(String.format("%s: %s", code.toUpperCase(), new Locale("", code).getDisplayCountry()));
}
}
}
@Command(name = "language", description = "Resolve ISO language code (ISO 639-1 or -2, two/three letters)")
static class Subcommand2 implements Runnable {
@Parameters(arity = "1..*", paramLabel = "<code> <code2>", description = "language code(s) to be resolved")
private String[] languageCodes;
@Override
public void run() {
for (String code : languageCodes) {
System.out.println(String.format("%s: %s", code.toLowerCase(), new Locale(code).getDisplayLanguage()));
}
}
}
public static void main(String[] args) {
CommandLine cmd = new CommandLine(new ParentCommand());
cmd.parseWithHandler(new CommandLine.RunAll(), args);
if (args.length == 0) { cmd.usage(System.out); }
}
}
\ No newline at end of file
......@@ -8,7 +8,6 @@ plugins {
group 'info.picocli'
description 'Picocli Shell JLine2 - easily build interactive shell applications with JLine 2 and picocli.'
version "$projectVersion"
sourceCompatibility = 1.5
dependencies {
compile rootProject
......@@ -38,8 +37,8 @@ bintray {
key = bintrayApiKey
publications = ['MyPublication']
dryRun = bintrayDryRun //[Default: false] Whether to run this as dry-run, without deploying
publish = false //[Default: false] Whether version should be auto published after an upload
override = false //[Default: false] Whether to override version artifacts already published
publish = bintrayPublish //[Default: false] Whether version should be auto published after an upload
override = bintrayOverride //[Default: false] Whether to override version artifacts already published
//Package configuration. The plugin will use the repo and name properties to check if the package already exists. In that case, there's no need to configure the other package properties (like userOrg, desc, etc).
pkg {
repo = 'picocli'
......
......@@ -8,7 +8,6 @@ plugins {
group 'info.picocli'
description 'Picocli Shell JLine3 - easily build interactive shell applications with JLine 3 and picocli.'
version "$projectVersion"
sourceCompatibility = 1.5
dependencies {
compile rootProject
......@@ -38,8 +37,8 @@ bintray {
key = bintrayApiKey
publications = ['MyPublication']
dryRun = bintrayDryRun //[Default: false] Whether to run this as dry-run, without deploying
publish = false //[Default: false] Whether version should be auto published after an upload
override = false //[Default: false] Whether to override version artifacts already published
publish = bintrayPublish //[Default: false] Whether version should be auto published after an upload
override = bintrayOverride //[Default: false] Whether to override version artifacts already published
//Package configuration. The plugin will use the repo and name properties to check if the package already exists. In that case, there's no need to configure the other package properties (like userOrg, desc, etc).
pkg {
repo = 'picocli'
......
......@@ -137,7 +137,7 @@ public class AutoComplete {
}
Class<?> cls = Class.forName(commandLineFQCN);
Object instance = factory.create(cls);
CommandLine commandLine = new CommandLine(instance);
CommandLine commandLine = new CommandLine(instance, factory);
if (commandName == null) {
commandName = commandLine.getCommandName(); //new CommandLine.Help(commandLine.commandDescriptor).commandName;
......
......@@ -141,7 +141,7 @@ import static picocli.CommandLine.Help.Column.Overflow.WRAP;
public class CommandLine {
/** This is picocli version {@value}. */
public static final String VERSION = "3.9.1";
public static final String VERSION = "3.9.2";
 
private final Tracer tracer = new Tracer();
private final CommandSpec commandSpec;
......@@ -7953,7 +7953,7 @@ public class CommandLine {
isHelpRequested |= command.helpCommand();
}
private void updateHelpRequested(ArgSpec argSpec) {
if (argSpec.isOption()) {
if (!parseResult.isInitializingDefaultValues && argSpec.isOption()) {
OptionSpec option = (OptionSpec) argSpec;
isHelpRequested |= is(argSpec, "help", option.help());
parseResult.versionHelpRequested |= is(argSpec, "versionHelp", option.versionHelp());
......@@ -8703,7 +8703,8 @@ public class CommandLine {
StringBuilder clusteredOptional = new StringBuilder("-");
for (OptionSpec option : options) {
if (option.hidden()) { continue; }
if (option.type() == boolean.class || option.type() == Boolean.class) {
boolean isFlagOption = option.type() == boolean.class || option.type() == Boolean.class;
if (isFlagOption && option.arity().max <= 0) { // #612 consider arity: boolean options may require a parameter
String shortestName = option.shortestName();
if (shortestName.length() == 2 && shortestName.startsWith("-")) {
booleanOptions.add(option);
......
......@@ -557,7 +557,7 @@ public class AutoCompleteTest {
"# =======================\n" +
"#\n" +
"# Bash completion support for the `picocli.AutoComplete` command,\n" +
"# generated by [picocli](http://picocli.info/) version 3.9.1.\n" +
"# generated by [picocli](http://picocli.info/) version 3.9.2.\n" +
"#\n" +
"# Installation\n" +
"# ------------\n" +
......@@ -723,7 +723,7 @@ public class AutoCompleteTest {
"# =======================\n" +
"#\n" +
"# Bash completion support for the `nondefault` command,\n" +
"# generated by [picocli](http://picocli.info/) version 3.9.1.\n" +
"# generated by [picocli](http://picocli.info/) version 3.9.2.\n" +
"#\n" +
"# Installation\n" +
"# ------------\n" +
......
......@@ -3697,4 +3697,19 @@ public class CommandLineHelpTest {
String expected = "abc";
assertEquals(expected, actual);
}
@Test
public void testBooleanOptionWithArity1() {
@Command(mixinStandardHelpOptions = true)
class ExampleCommand {
@Option(names = { "-b" }, arity = "1")
boolean booleanWithArity1;
}
String expected = String.format("" +
"Usage: <main class> [-hV] [-b=<booleanWithArity1>]%n" +
" -b=<booleanWithArity1>%n" +
" -h, --help Show this help message and exit.%n" +
" -V, --version Print version information and exit.%n");
assertEquals(expected, new CommandLine(new ExampleCommand()).getUsageMessage(Help.Ansi.OFF));
}
}
......@@ -146,7 +146,7 @@ public class CommandLineTest {
}
@Test
public void testVersion() {
assertEquals("3.9.1", CommandLine.VERSION);
assertEquals("3.9.2", CommandLine.VERSION);
}
@Test
public void testArrayPositionalParametersAreReplacedNotAppendedTo() {
......@@ -4148,4 +4148,21 @@ public class CommandLineTest {
assertEquals(Arrays.asList(3), app.y);
assertNull(app.unmatched);
}
@Test(expected = MissingParameterException.class)
public void testBooleanOptionDefaulting() {
class App {
@Option(names = "-h", usageHelp = true, defaultValue = "false")
boolean helpAsked;
@Option(names = "-V", versionHelp = true, defaultValue = "false")
boolean versionAsked;
@Parameters
String compulsoryParameter;
}
System.setProperty("picocli.trace", "DEBUG");
CommandLine commandLine = new CommandLine(new App());
commandLine.parseArgs(new String[0]);
}
}
......@@ -524,7 +524,7 @@ public class CommandLineTypeConversionTest {
}
@Test
public void testInetAddressConvertersInvalidError() {
parseInvalidValue("-InetAddress", "%$::a?*!a", "java.net.UnknownHostException: %$::a?*!a");
parseInvalidValue("-InetAddress", "%$::a?*!a", "java.net.UnknownHostException: ");
}
@Test
public void testUUIDConvertersInvalidError() {
......