You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@groovy.apache.org by pa...@apache.org on 2020/04/30 11:06:47 UTC
[groovy] branch GROOVY_2_5_X updated (bbed331 -> 4b7cf7f)
This is an automated email from the ASF dual-hosted git repository.
paulk pushed a change to branch GROOVY_2_5_X
in repository https://gitbox.apache.org/repos/asf/groovy.git.
from bbed331 Bump version on GROOVY_2_5_X branch
new dafe021 GROOVY-9528: improve the "parser" subsection of the "Picocli" section of "Advanced CLI Usage" in domain-specific languages page
new 4b7cf7f GROOVY-9528: improve "Property: parser" subsection title
The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
src/spec/doc/core-domain-specific-languages.adoc | 22 +++++++++++++++++++++-
1 file changed, 21 insertions(+), 1 deletion(-)
[groovy] 01/02: GROOVY-9528: improve the "parser" subsection of the
"Picocli" section of "Advanced CLI Usage" in domain-specific languages page
Posted by pa...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
paulk pushed a commit to branch GROOVY_2_5_X
in repository https://gitbox.apache.org/repos/asf/groovy.git
commit dafe021a5b79cca1178ddc763a64f915514b2bea
Author: Remko Popma <re...@yahoo.com>
AuthorDate: Wed Apr 29 12:54:30 2020 +0900
GROOVY-9528: improve the "parser" subsection of the "Picocli" section of "Advanced CLI Usage" in domain-specific languages page
---
src/spec/doc/core-domain-specific-languages.adoc | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
diff --git a/src/spec/doc/core-domain-specific-languages.adoc b/src/spec/doc/core-domain-specific-languages.adoc
index b3ec6b6..d03d673 100644
--- a/src/spec/doc/core-domain-specific-languages.adoc
+++ b/src/spec/doc/core-domain-specific-languages.adoc
@@ -1603,6 +1603,26 @@ image::assets/img/usageMessageSpec.png[]
*New property: parser*
The `parser` property gives access to the picocli `ParserSpec` object that can be used to customize the parser behavior.
+
+This can be useful when the `CliBuilder` options to control the parser are not fine-grained enough.
+For example, for backward compatibility with the Commons CLI implementation of `CliBuilder`, by default `CliBuilder` stops looking for options when an unknown option is encountered, and subsequent command line arguments are treated as positional parameters.
+`CliBuilder` provides a `stopAtNonOption` property, and by setting this to `false` you can make the parser more strict, so an unknown option results in `error: Unknown option: '-x'`.
+
+But what if you want to treat unknown options as positional parameters, and still process subsequent command line arguments as options?
+
+This can be accomplished with the `parser` property.
+For example:
+
+[source,groovy]
+----
+def cli = new CliBuilder()
+cli.parser.stopAtPositional(false)
+cli.parser.unmatchedOptionsArePositionalParams(true)
+// ...
+def opts = cli.parse(args)
+// ...
+----
+
See the http://picocli.info/apidocs/picocli/CommandLine.Model.ParserSpec.html[documentation] for details.
*Map options*
[groovy] 02/02: GROOVY-9528: improve "Property: parser" subsection
title
Posted by pa...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
paulk pushed a commit to branch GROOVY_2_5_X
in repository https://gitbox.apache.org/repos/asf/groovy.git
commit 4b7cf7f1c64ab872a33b0125cb733932284511af
Author: Remko Popma <re...@yahoo.com>
AuthorDate: Wed Apr 29 14:06:43 2020 +0900
GROOVY-9528: improve "Property: parser" subsection title
---
src/spec/doc/core-domain-specific-languages.adoc | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/spec/doc/core-domain-specific-languages.adoc b/src/spec/doc/core-domain-specific-languages.adoc
index d03d673..aef7c52 100644
--- a/src/spec/doc/core-domain-specific-languages.adoc
+++ b/src/spec/doc/core-domain-specific-languages.adoc
@@ -1600,7 +1600,7 @@ Gives this output:
image::assets/img/usageMessageSpec.png[]
-*New property: parser*
+*Property: parser*
The `parser` property gives access to the picocli `ParserSpec` object that can be used to customize the parser behavior.