Recognize parameter separator for grape define command
(cherry picked from commit 962ad9e3e3f27e10a71c0bbbb94d14f994326cf8)
This commit is contained in:
parent
f8475c617d
commit
b9e221c528
@ -486,6 +486,29 @@ index fd9765c..db29526 100644
|
||||
|
||||
grapeHelp = {
|
||||
int spacesLen = commands.keySet().max {it.length()}.length() + 3
|
||||
@@ -326,10 +326,18 @@ if (cmd.hasOption('v')) {
|
||||
return
|
||||
}
|
||||
|
||||
-
|
||||
-cmd.getOptionValues('D')?.each {String prop ->
|
||||
- def (k, v) = prop.split ('=', 2) as List // array multiple assignment quirk
|
||||
- System.setProperty(k, v ?: "")
|
||||
+if (cmd.hasOption('D')) {
|
||||
+ cmd.getOptionValues('D')?.each {String prop ->
|
||||
+ while (prop.startsWith("=")) {
|
||||
+ prop = prop.substring(1, prop.length());
|
||||
+ }
|
||||
+ def (k, v) = prop.split ('=', 2) as List // array multiple assignment quirk
|
||||
+ if (k.isEmpty() || v.isEmpty()) {
|
||||
+ println "one system property's name or value is emply, skip."
|
||||
+ } else {
|
||||
+ System.setProperty(k, v ?: "")
|
||||
+ }
|
||||
+ }
|
||||
}
|
||||
|
||||
String[] arg = cmd.args
|
||||
diff --git a/src/test/groovy/util/CliBuilderTest.groovy b/src/test/groovy/util/CliBuilderTest.groovy
|
||||
index cbd7bd1..d67de50 100644
|
||||
--- a/src/test/groovy/util/CliBuilderTest.groovy
|
||||
|
||||
@ -15,9 +15,11 @@ else
|
||||
fi
|
||||
|
||||
# Configuration
|
||||
JAVA_HOME="/usr/lib/jvm/java-1.8.0-openjdk"
|
||||
GROOVY_HOME="/usr/share/groovy"
|
||||
SCRIPT_PATH=$0
|
||||
PROGNAME=$(basename $SCRIPT_PATH)
|
||||
GROOVY_CONF=/etc/groovy18-starter.conf
|
||||
#GROOVY_CONF=/etc/groovy18-starter.conf
|
||||
TOOLS_JAR=$JAVA_HOME/lib/tools.jar
|
||||
STARTER_MAIN_CLASS=org.codehaus.groovy.tools.GroovyStarter
|
||||
MAIN_CLASS=$STARTER_MAIN_CLASS
|
||||
@ -78,6 +80,20 @@ BASE_JARS="$BASE_JARS xstream"
|
||||
BASE_JARS="$BASE_JARS jansi"
|
||||
BASE_JARS="$BASE_JARS gpars/gpars"
|
||||
|
||||
BASE_JARS="$BASE_JARS ant/ant-antlr"
|
||||
BASE_JARS="$BASE_JARS ant/ant"
|
||||
BASE_JARS="$BASE_JARS ant/ant-launcher"
|
||||
BASE_JARS="$BASE_JARS extra166y.jar"
|
||||
BASE_JARS="$BASE_JARS hamcrest/core"
|
||||
BASE_JARS="$BASE_JARS jansi/jansi.jar"
|
||||
BASE_JARS="$BASE_JARS beust-jcommander.jar"
|
||||
BASE_JARS="$BASE_JARS jline/jline.jar"
|
||||
BASE_JARS="$BASE_JARS multiverse/multiverse-core"
|
||||
BASE_JARS="$BASE_JARS qdox"
|
||||
BASE_JARS="$BASE_JARS glassfish-servlet-api"
|
||||
BASE_JARS="$BASE_JARS testng"
|
||||
BASE_JARS="$BASE_JARS xpp3"
|
||||
BASE_JARS="$BASE_JARS xstream/xstream"
|
||||
# Set parameters
|
||||
set_jvm
|
||||
set_classpath $BASE_JARS
|
||||
@ -85,4 +101,6 @@ set_flags $BASE_FLAGS
|
||||
set_options $BASE_OPTIONS $GROOVY_OPTS
|
||||
|
||||
# Let's start
|
||||
run --conf "$GROOVY_CONF" --main "$CLASS" "$@"
|
||||
export GROOVY_VERSION="1.8"
|
||||
. ${GROOVY_HOME}/bin/startGroovy
|
||||
startGroovy "$CLASS" "${@}"
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
%global archiver 1_8_9
|
||||
Name: groovy18
|
||||
Version: 1.8.9
|
||||
Release: 1
|
||||
Release: 4
|
||||
Summary: Dynamic language for the Java Platform
|
||||
License: ASL 2.0 and BSD and EPL and Public Domain and CC-BY
|
||||
URL: http://groovy-lang.org
|
||||
@ -122,5 +122,14 @@ install -p -m644 %{SOURCE2} \
|
||||
%license LICENSE.txt LICENSE-2.0.txt NOTICE.txt cpl-v10.txt epl-v10.txt
|
||||
|
||||
%changelog
|
||||
* Mon Mar 11 2024 Ge Wang <wang__ge@126.com> - 1.8.9-4
|
||||
- Add command line parser separator recogonition
|
||||
|
||||
* Mon Feb 26 2024 xu_ping <707078654@qq.com> - 1.8.9-3
|
||||
- fix help information is consistent due to the singularity of the class method.
|
||||
|
||||
*Tue Feb 20 2024 Ge Wang <wang__ge@126.com> - 1.8.9-2
|
||||
- Replace run with exec
|
||||
|
||||
* Sat Aug 15 2020 zhanghua <zhanghua40@huawei.com> - 1.8.9-1
|
||||
- Package init
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user