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 c1543c2163e6 chore: camel-jbang - camel catalog kamelet --filter
matches a part of the name (#30222)
c1543c2163e6 is described below
commit c1543c2163e67b8df78e57f11f81294f8de53615
Author: Claus Ibsen <[email protected]>
AuthorDate: Mon Nov 16 21:02:54 2026 +0100
chore: camel-jbang - camel catalog kamelet --filter matches a part of the
name (#30222)
CatalogKamelet keeps a Kamelet when its name or its description contains the
filter text, ignoring case, like camel catalog component --filter and the
MCP
tool camel_catalog_kamelets. Before, --filter=timer listed nothing, as the
name
was matched only as a whole.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
---
.../camel/dsl/jbang/core/commands/catalog/CatalogKamelet.java | 4 ++--
.../dsl/jbang/core/commands/catalog/CatalogKameletListTest.java | 8 ++++++++
2 files changed, 10 insertions(+), 2 deletions(-)
diff --git
a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/catalog/CatalogKamelet.java
b/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/catalog/CatalogKamelet.java
index 09350861c4d7..e027f0fd42d9 100644
---
a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/catalog/CatalogKamelet.java
+++
b/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/catalog/CatalogKamelet.java
@@ -108,8 +108,8 @@ public class CatalogKamelet extends CamelCommand {
}
if (filterName != null) {
String text = filterName.toLowerCase(Locale.ROOT);
- // a Kamelet may have no description
- rows.removeIf(r -> !text.equalsIgnoreCase(r.name)
+ // a part of the name, as camel catalog component does; a Kamelet
may have no description
+ rows.removeIf(r -> !r.name.toLowerCase(Locale.ROOT).contains(text)
&& (r.description == null ||
!r.description.toLowerCase(Locale.ROOT).contains(text)));
}
diff --git
a/dsl/camel-jbang/camel-jbang-core/src/test/java/org/apache/camel/dsl/jbang/core/commands/catalog/CatalogKameletListTest.java
b/dsl/camel-jbang/camel-jbang-core/src/test/java/org/apache/camel/dsl/jbang/core/commands/catalog/CatalogKameletListTest.java
index 993c796a3158..e04409d866b3 100644
---
a/dsl/camel-jbang/camel-jbang-core/src/test/java/org/apache/camel/dsl/jbang/core/commands/catalog/CatalogKameletListTest.java
+++
b/dsl/camel-jbang/camel-jbang-core/src/test/java/org/apache/camel/dsl/jbang/core/commands/catalog/CatalogKameletListTest.java
@@ -86,6 +86,14 @@ class CatalogKameletListTest extends
CamelCommandBaseTestSupport {
assertThat(printer.getOutput()).contains("log-action").doesNotContain("kafka-source");
}
+ @Test
+ void filterByAPartOfTheName() throws Exception {
+ // the description of timer-source does not have the text, as camel
catalog component a part of the name is enough
+ assertThat(command("--filter=Timer").doCall()).isZero();
+
+
assertThat(printer.getOutput()).contains("timer-source").doesNotContain("kafka-source",
"log-action");
+ }
+
@Test
void noResultsForTheFilter() throws Exception {
assertThat(command("--filter=mqtt").doCall()).isZero();