You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by pa...@apache.org on 2015/05/19 07:10:57 UTC
[2/5] incubator-groovy git commit: Converted CliBuilder to the new
commons-cli 1.3 api: replaced OptionBuilder, deprecated in 1.3,
with Option.builder
Converted CliBuilder to the new commons-cli 1.3 api: replaced OptionBuilder, deprecated in 1.3, with Option.builder
Project: http://git-wip-us.apache.org/repos/asf/incubator-groovy/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-groovy/commit/fac9d943
Tree: http://git-wip-us.apache.org/repos/asf/incubator-groovy/tree/fac9d943
Diff: http://git-wip-us.apache.org/repos/asf/incubator-groovy/diff/fac9d943
Branch: refs/heads/master
Commit: fac9d943e59980950d8d6b5ee7fdb8c22746da2d
Parents: df676e6
Author: Jacopo Cappellato <ja...@gmail.com>
Authored: Fri May 8 06:59:26 2015 +0200
Committer: Paul King <pa...@asert.com.au>
Committed: Tue May 19 14:44:28 2015 +1000
----------------------------------------------------------------------
src/main/groovy/util/CliBuilder.groovy | 6 +++---
src/test/groovy/util/CliBuilderTest.groovy | 5 ++---
2 files changed, 5 insertions(+), 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-groovy/blob/fac9d943/src/main/groovy/util/CliBuilder.groovy
----------------------------------------------------------------------
diff --git a/src/main/groovy/util/CliBuilder.groovy b/src/main/groovy/util/CliBuilder.groovy
index ef4d4a9..dd71606 100644
--- a/src/main/groovy/util/CliBuilder.groovy
+++ b/src/main/groovy/util/CliBuilder.groovy
@@ -124,8 +124,8 @@ import org.codehaus.groovy.runtime.InvokerHelper
* import org.apache.commons.cli.*
* ... as before ...
* cli << new Option('q', false, 'If used as the first parameter disables .curlrc')
- * cli << OptionBuilder.withLongOpt('url').hasArg().withArgName('URL').
- * withDescription('Set URL to work with').create()
+ * cli << Option.builder().longOpt('url').hasArg().argName('URL').
+ * desc('Set URL to work with').build()
* ...
* </pre>
*
@@ -286,7 +286,7 @@ class CliBuilder {
Option option(shortname, Map details, info) {
Option option
if (shortname == '_') {
- option = OptionBuilder.withDescription(info).withLongOpt(details.longOpt).create()
+ option = Option.builder().desc(info).longOpt(details.longOpt).build()
details.remove('longOpt')
} else {
option = new Option(shortname, info)
http://git-wip-us.apache.org/repos/asf/incubator-groovy/blob/fac9d943/src/test/groovy/util/CliBuilderTest.groovy
----------------------------------------------------------------------
diff --git a/src/test/groovy/util/CliBuilderTest.groovy b/src/test/groovy/util/CliBuilderTest.groovy
index 80ae944..d1760e1 100644
--- a/src/test/groovy/util/CliBuilderTest.groovy
+++ b/src/test/groovy/util/CliBuilderTest.groovy
@@ -21,7 +21,6 @@ package groovy.util
import org.codehaus.groovy.cli.GroovyPosixParser
import org.apache.commons.cli.GnuParser
import org.apache.commons.cli.Option
-import org.apache.commons.cli.OptionBuilder
import org.apache.commons.cli.PosixParser
import org.apache.commons.cli.BasicParser
@@ -188,7 +187,7 @@ usage: groovy
}
private void checkLongOptsOnly_nonOptionShouldStopArgProcessing(CliBuilder cli) {
- def anOption = OptionBuilder.withLongOpt('anOption').hasArg().withDescription('An option.').create()
+ def anOption = Option.builder().longOpt('anOption').hasArg().desc('An option.').build()
cli.options.addOption(anOption)
def options = cli.parse(['-v', '--anOption', 'something'])
// no options should be found
@@ -216,7 +215,7 @@ usage: groovy
private void checkLongAndShortOpts_allOptionsValid(parser) {
def cli = new CliBuilder(parser: parser)
- def anOption = OptionBuilder.withLongOpt('anOption').hasArg().withDescription('An option.').create()
+ def anOption = Option.builder().longOpt('anOption').hasArg().desc('An option.').build()
cli.options.addOption(anOption)
cli.v(longOpt: 'verbose', 'verbose mode')
def options = cli.parse(['-v', '--anOption', 'something'])