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

davsclaus pushed a commit to branch camel-4.22.x
in repository https://gitbox.apache.org/repos/asf/camel.git


The following commit(s) were added to refs/heads/camel-4.22.x by this push:
     new 3daa566cad1c [4.22.x] CAMEL-25437: camel-jbang - --prop of camel cmd 
send and receive takes its value after a space too (#27545)
3daa566cad1c is described below

commit 3daa566cad1c50e5f9a945c0a13beb54f77adc52
Author: Claus Ibsen <[email protected]>
AuthorDate: Thu Oct 8 09:57:31 2026 +0200

    [4.22.x] CAMEL-25437: camel-jbang - --prop of camel cmd send and receive 
takes its value after a space too (#27545)
    
    CAMEL-25437: camel-jbang - --prop of camel cmd send and receive takes its 
value after a space too
    
    Review follow-up: camel cmd send and camel cmd receive had the same
    arity 0 on --prop, so a value after a space went to the name of the
    integration.
    
    
    Claude-Session: https://claude.ai/code/session_01STT6whBgK1AqsSsUKrnE8m
    (cherry picked from commit 68399a6c8bf2bd5e21a6d22be82ecdc1ff1fa667)
    
    Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
---
 .../core/commands/action/CamelReceiveAction.java   |  3 +-
 .../core/commands/action/CamelSendAction.java      |  3 +-
 .../commands/action/CamelActionPropOptionTest.java | 47 ++++++++++++++++++++++
 3 files changed, 49 insertions(+), 4 deletions(-)

diff --git 
a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/action/CamelReceiveAction.java
 
b/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/action/CamelReceiveAction.java
index 57d5c16708cc..525b1d6376b7 100644
--- 
a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/action/CamelReceiveAction.java
+++ 
b/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/action/CamelReceiveAction.java
@@ -122,8 +122,7 @@ public class CamelReceiveAction extends ActionBaseCommand {
     String propertiesFiles;
 
     @CommandLine.Option(names = { "--prop", "--property" },
-                        description = "Additional properties; override 
existing (only applicable when NOT using an existing running Camel)",
-                        arity = "0")
+                        description = "Additional properties; override 
existing (only applicable when NOT using an existing running Camel)")
     String[] property;
 
     @CommandLine.Option(names = { "--action" }, completionCandidates = 
ActionCompletionCandidates.class,
diff --git 
a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/action/CamelSendAction.java
 
b/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/action/CamelSendAction.java
index 930df8c0fa28..304799dade23 100644
--- 
a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/action/CamelSendAction.java
+++ 
b/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/action/CamelSendAction.java
@@ -70,8 +70,7 @@ public class CamelSendAction extends ActionBaseCommand {
     String propertiesFiles;
 
     @CommandLine.Option(names = { "--prop", "--property" },
-                        description = "Additional properties; override 
existing (only applicable when NOT using an existing running Camel)",
-                        arity = "0")
+                        description = "Additional properties; override 
existing (only applicable when NOT using an existing running Camel)")
     String[] property;
 
     @CommandLine.Option(names = { "--endpoint", "--uri" },
diff --git 
a/dsl/camel-jbang/camel-jbang-core/src/test/java/org/apache/camel/dsl/jbang/core/commands/action/CamelActionPropOptionTest.java
 
b/dsl/camel-jbang/camel-jbang-core/src/test/java/org/apache/camel/dsl/jbang/core/commands/action/CamelActionPropOptionTest.java
new file mode 100644
index 000000000000..bf2e387edb0b
--- /dev/null
+++ 
b/dsl/camel-jbang/camel-jbang-core/src/test/java/org/apache/camel/dsl/jbang/core/commands/action/CamelActionPropOptionTest.java
@@ -0,0 +1,47 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.dsl.jbang.core.commands.action;
+
+import org.apache.camel.dsl.jbang.core.commands.CamelJBangMain;
+import org.junit.jupiter.api.Test;
+import picocli.CommandLine;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+/**
+ * CAMEL-25437: --prop of camel cmd send and receive takes its value after a 
space too, instead of losing it to the name
+ * of the integration.
+ */
+class CamelActionPropOptionTest {
+
+    @Test
+    void sendTakesAPropertyAfterASpace() {
+        CamelSendAction send = new CamelSendAction(new CamelJBangMain());
+        new CommandLine(send).parseArgs("--prop", "greeting=Hi", 
"--prop=other=1");
+
+        assertThat(send.property).containsExactly("greeting=Hi", "other=1");
+        assertThat(send.name).isNull();
+    }
+
+    @Test
+    void receiveTakesAPropertyAfterASpace() {
+        CamelReceiveAction receive = new CamelReceiveAction(new 
CamelJBangMain());
+        new CommandLine(receive).parseArgs("--prop", "greeting=Hi");
+
+        assertThat(receive.property).containsExactly("greeting=Hi");
+    }
+}

Reply via email to