You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2025/04/05 07:03:14 UTC

(camel) branch main updated: CAMEL-21921: camel-jbang - Make it possible to match names in single mode using ! at end of name

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

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


The following commit(s) were added to refs/heads/main by this push:
     new 44ab8cfa51a CAMEL-21921: camel-jbang - Make it possible to match names in single mode using ! at end of name
44ab8cfa51a is described below

commit 44ab8cfa51a17f16926f655dc09f044a40655606
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Sat Apr 5 09:02:55 2025 +0200

    CAMEL-21921: camel-jbang - Make it possible to match names in single mode using ! at end of name
---
 docs/user-manual/modules/ROOT/pages/camel-jbang.adoc               | 6 ++++--
 .../camel/dsl/jbang/core/commands/process/ProcessBaseCommand.java  | 7 +++++--
 2 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/docs/user-manual/modules/ROOT/pages/camel-jbang.adoc b/docs/user-manual/modules/ROOT/pages/camel-jbang.adoc
index 5893ab07bd8..be05d715f5b 100644
--- a/docs/user-manual/modules/ROOT/pages/camel-jbang.adoc
+++ b/docs/user-manual/modules/ROOT/pages/camel-jbang.adoc
@@ -1501,9 +1501,11 @@ camel stop 62506
 Stopping running Camel integration (pid: 62506)
 ----
 
-TIP: You do not have to type the full name, as the stop command will match using integrations
+NOTE: You do not have to type the full name, as the stop command will match using integrations
 that start with the input, for example, you can do `camel stop d` to stop all integrations
-starting with d.
+starting with d. If you have multiple integrations running with similar name such as `dude`, `dude2`, then
+if you type `camel stop dude` then Camel will stop both integrations. However, if you want to only
+stop a single integration then either stop via PID or use `camel stop dude!` with the `!` at the end.
 
 To stop all integrations, then execute without any pid:
 
diff --git a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/process/ProcessBaseCommand.java b/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/process/ProcessBaseCommand.java
index 408e6d103b1..d6b347e5a00 100644
--- a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/process/ProcessBaseCommand.java
+++ b/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/process/ProcessBaseCommand.java
@@ -44,8 +44,11 @@ abstract class ProcessBaseCommand extends CamelCommand {
         if (name.matches("\\d+")) {
             return List.of(Long.parseLong(name));
         } else {
-            // lets be open and match all that starts with this pattern
-            if (!name.endsWith("*")) {
+            if (name.endsWith("!")) {
+                // exclusive this name only
+                name = name.substring(0, name.length() - 1);
+            } else if (!name.endsWith("*")) {
+                // lets be open and match all that starts with this pattern
                 name = name + "*";
             }
         }