groovy-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rpo...@apache.org
Subject [groovy] branch master updated: GROOVY-9012 fix bug in grape resolve command to correctly handle positional parameters
Date Thu, 28 Feb 2019 09:37:59 GMT
This is an automated email from the ASF dual-hosted git repository.

rpopma pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/groovy.git


The following commit(s) were added to refs/heads/master by this push:
     new 5deb672  GROOVY-9012 fix bug in grape resolve command to correctly handle positional
parameters
5deb672 is described below

commit 5deb67296dff179871ba2af9f87ef39e35645461
Author: Remko Popma <remkop@yahoo.com>
AuthorDate: Thu Feb 28 18:35:48 2019 +0900

    GROOVY-9012 fix bug in grape resolve command to correctly handle positional parameters
---
 src/main/groovy/org/codehaus/groovy/tools/GrapeMain.groovy | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/src/main/groovy/org/codehaus/groovy/tools/GrapeMain.groovy b/src/main/groovy/org/codehaus/groovy/tools/GrapeMain.groovy
index 0ea6b7b..63fe188 100644
--- a/src/main/groovy/org/codehaus/groovy/tools/GrapeMain.groovy
+++ b/src/main/groovy/org/codehaus/groovy/tools/GrapeMain.groovy
@@ -223,6 +223,9 @@ class GrapeMain implements Runnable {
         @Option(names = ['-i', '--ivy'], description = 'Express dependencies in an ivy-like
format')
         private boolean ivyFormatRequested
 
+        @Parameters(hidden = true) // parameter description is embedded in the command description
+        List<String> args = new ArrayList<>() // the positional parameters
+
         @ParentCommand GrapeMain parentCommand
 
         void run() {
@@ -232,7 +235,7 @@ class GrapeMain implements Runnable {
             Grape.getInstance()
             parentCommand.setupLogging(Message.MSG_ERR)
 
-            if ((arg.size() % 3) != 0) {
+            if ((args.size() % 3) != 0) {
                 println 'There needs to be a multiple of three arguments: (group module version)+'
                 return
             }
@@ -254,7 +257,7 @@ class GrapeMain implements Runnable {
                 before = 'export CLASSPATH='
                 between = ':'
                 after = ''
-            } else if (ivy) {
+            } else if (ivyFormatRequested) {
                 before = '<dependency '
                 between = '">\n<dependency '
                 after = '">'
@@ -264,7 +267,7 @@ class GrapeMain implements Runnable {
                 after = '\n'
             }
 
-            iter = arg.iterator()
+            def iter = args.iterator()
             def params = [[:]]
             def depsInfo = [] // this list will contain the module/group/version info of
all resolved dependencies
             if (ivyFormatRequested) {
@@ -276,7 +279,7 @@ class GrapeMain implements Runnable {
             try {
                 def results = []
                 def uris = Grape.resolve(* params)
-                if(!ivyFormatRequested) {
+                if (!ivyFormatRequested) {
                     for (URI uri: uris) {
                         if (uri.scheme == 'file') {
                             results += new File(uri).path


Mime
View raw message