This is an automated email from the ASF dual-hosted git repository.

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


The following commit(s) were added to refs/heads/master by this push:
     new 11b76aeac9 fix#2923 - Hop Run - Specify a custom separator char for 
parameters
     new ffee5606d6 Merge pull request #2924 from sramazzina/2923
11b76aeac9 is described below

commit 11b76aeac9e40ebcccd9e551083081c5b3067765
Author: sergio.ramazzina <[email protected]>
AuthorDate: Fri May 12 17:45:59 2023 +0200

    fix#2923 - Hop Run - Specify a custom separator char for parameters
---
 .../modules/ROOT/pages/hop-run/index.adoc          | 15 ++++++++++----
 .../src/main/java/org/apache/hop/run/HopRun.java   | 23 +++++++++++++++-------
 2 files changed, 27 insertions(+), 11 deletions(-)

diff --git a/docs/hop-user-manual/modules/ROOT/pages/hop-run/index.adoc 
b/docs/hop-user-manual/modules/ROOT/pages/hop-run/index.adoc
index 68cc493827..5f5a9b66df 100644
--- a/docs/hop-user-manual/modules/ROOT/pages/hop-run/index.adoc
+++ b/docs/hop-user-manual/modules/ROOT/pages/hop-run/index.adoc
@@ -45,7 +45,7 @@ You'll see the option listed in a similar output to the one 
below:
 ----
 Usage: <main class> [-ho] [-e=<environmentOption>] [-f=<filename>]
                     [-j=<projectOption>] [-l=<level>]
-                    [-r=<runConfigurationName>] [-p=<parameters>[,
+                    [-r=<runConfigurationName>] [-ps=<parametersSeparator] 
[-p=<parameters>[,
                     <parameters>...]]... [-s=<systemProperties>[,
                     <systemProperties>...]]...
   -e, --environment=<environmentOption>
@@ -55,12 +55,15 @@ Usage: <main class> [-ho] [-e=<environmentOption>] 
[-f=<filename>]
   -j, --project=<projectOption>
                           The name of the project to use
   -l, --level=<level>     The debug level, one of NOTHING, ERROR, MINIMAL, 
BASIC, DETAILED, DEBUG, ROWLEVEL
-      --logfile=<logFile>   Write Hop console log to a file
+  -l, --level=<level>     The debug level, one of NOTHING, ERROR, MINIMAL, 
BASIC, DETAILED, DEBUG, ROWLEVEL
+  -lf, --logfile=<logfile-name> The complete filename where hop-run will write 
the Hop console log
   -m, --metadata-export=<metadataExportFile>
                           A file containing exported metadata in JSON format
   -o, --printoptions      Print the used options
   -p, --parameters=<parameters>[,<parameters>...]
-                          A comma separated list of PARAMETER=VALUE pairs
+                          A list of PARAMETER=VALUE pairs
+  -ps, --parameters-separator=<parametersSeparator>
+                          A character to be used as separator for our list of 
PARAMETER=VALUE pairs (default is ",").
   -r, --runconfig=<runConfigurationName>
                           The name of the Run Configuration to use
   -s, --system-properties=<systemProperties>[,<systemProperties>...]
@@ -97,7 +100,7 @@ Check the 
xref:projects/projects-environments.adoc[documentation on environments
 
 |```-lf```
 |```--logfile```
-|Write Hop console log to a file specified by the user
+|The complete filename where hop-run will write the Hop console log
 
 |```-m```
 |```--metadata-export```
@@ -111,6 +114,10 @@ Check the 
xref:projects/projects-environments.adoc[documentation on environments
 |```--parameters```
 |A comma separated list of PARAMETER=VALUE pairs
 
+|```-ps```
+|```--parameters-separator```
+|A character to be used as separator for our list of PARAMETER=VALUE pairs 
(default is ",").
+
 |```-r```
 |```--runconfig```
 |The name of the Run Configuration to use.
diff --git a/engine/src/main/java/org/apache/hop/run/HopRun.java 
b/engine/src/main/java/org/apache/hop/run/HopRun.java
index bcf43d1f8c..716357925a 100644
--- a/engine/src/main/java/org/apache/hop/run/HopRun.java
+++ b/engine/src/main/java/org/apache/hop/run/HopRun.java
@@ -95,14 +95,18 @@ public class HopRun implements Runnable, 
IHasHopMetadataProvider {
 
   @Option(
       names = {"-lf", "--logfile"},
-      description = "Write Hop console log to a file")
+      description = "The complete filename where hop-run will write the Hop 
console log")
   private String logFile;
 
   @Option(
       names = {"-p", "--parameters"},
-      description = "A comma separated list of PARAMETER=VALUE pairs",
-      split = ",")
-  private String[] parameters = null;
+      description = "A list of PARAMETER=VALUE pairs")
+  private String parameters = null;
+
+  @Option(
+          names = {"-ps", "--parameters-separator"},
+          description = "A character to be used as separator for our list of 
PARAMETER=VALUE pairs (default is ,)" )
+  private String parametersSeparator = null;
 
   @Option(
       names = {"-s", "--system-properties"},
@@ -224,9 +228,11 @@ public class HopRun implements Runnable, 
IHasHopMetadataProvider {
         return;
       }
     }
+
     String[] helpArgs = new String[args.length + 1];
     System.arraycopy(args, 0, helpArgs, 0, args.length);
     helpArgs[args.length] = "-h";
+
     cmd.parseArgs(helpArgs);
   }
 
@@ -473,8 +479,11 @@ public class HopRun implements Runnable, 
IHasHopMetadataProvider {
       INamedParameterDefinitions namedParams) {
     try {
       String[] availableParameters = namedParams.listParameters();
+
       if (parameters != null) {
-        for (String parameter : parameters) {
+        parametersSeparator = parametersSeparator == null ? "," : 
parametersSeparator;
+
+        for (String parameter : parameters.split(parametersSeparator)) {
           String[] split = parameter.split("=", 2);
           String key = split.length > 0 ? split[0] : null;
           String value = split.length > 1 ? split[1] : null;
@@ -665,14 +674,14 @@ public class HopRun implements Runnable, 
IHasHopMetadataProvider {
    *
    * @return value of parameters
    */
-  public String[] getParameters() {
+  public String getParameters() {
     return parameters;
   }
 
   /**
    * @param parameters The parameters to set
    */
-  public void setParameters(String[] parameters) {
+  public void setParameters(String parameters) {
     this.parameters = parameters;
   }
 

Reply via email to