This is an automated email from the ASF dual-hosted git repository. davsclaus pushed a commit to branch CAMEL-26931-smaller in repository https://gitbox.apache.org/repos/asf/camel.git
commit b441eaa4e11454f03ead51753a7a3a5c9a8a1718 Author: Claus Ibsen <[email protected]> AuthorDate: Sun Nov 15 16:09:11 2026 +0100 CAMEL-26931: camel-jbang - smaller fixes: the class of transform route --output, no empty Since, <file> in the help, and plugin get and infra ps say when there is nothing - camel transform route --format=java --output=Out.java names the class Out, after its file (it was named after the route file, which does not compile). - camel doc of an EIP no longer prints an empty Since: line (the catalog has no first version for EIPs). - The file arguments show as <file> and <files> in the help (paramLabel "<file>" showed as <<file>>). - camel plugin get without plugins says so (it printed nothing), and camel infra ps with nothing running says so (it printed the header of the table only). - camel eval --help says "use eval --help to see sub commands" (it said transform). Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Claus Ibsen <[email protected]> --- .../camel/dsl/jbang/core/commands/EvalCommand.java | 2 +- .../dsl/jbang/core/commands/ExportBaseCommand.java | 2 +- .../apache/camel/dsl/jbang/core/commands/Init.java | 2 +- .../apache/camel/dsl/jbang/core/commands/Nano.java | 2 +- .../apache/camel/dsl/jbang/core/commands/Run.java | 2 +- .../camel/dsl/jbang/core/commands/Script.java | 2 +- .../dsl/jbang/core/commands/TransformRoute.java | 24 ++++++- .../commands/action/CamelRouteDiagramAction.java | 2 +- .../commands/action/CamelRouteTopologyAction.java | 2 +- .../camel/dsl/jbang/core/commands/bind/Bind.java | 2 +- .../jbang/core/commands/catalog/CatalogDoc.java | 17 +++-- .../core/commands/infra/InfraBaseCommand.java | 3 + .../dsl/jbang/core/commands/plugin/PluginAdd.java | 2 +- .../jbang/core/commands/plugin/PluginDelete.java | 2 +- .../dsl/jbang/core/commands/plugin/PluginGet.java | 9 ++- .../jbang/core/commands/TransformRouteTest.java | 11 ++++ .../core/commands/catalog/CatalogDocTest.java | 2 + .../dsl/jbang/core/commands/infra/InfraPsTest.java | 3 + .../jbang/core/commands/plugin/PluginGetTest.java | 4 +- .../src/test/resources/golden/cli-help.txt | 77 +++++++++++----------- .../dsl/jbang/core/commands/edit/EditCommand.java | 2 +- .../commands/kubernetes/KubernetesPodLogs.java | 2 +- .../core/commands/kubernetes/KubernetesRun.java | 2 +- .../validate/PropertiesValidateCommand.java | 2 +- .../commands/validate/SourceValidateCommand.java | 2 +- .../commands/validate/YamlNormalizeCommand.java | 2 +- .../commands/validate/YamlValidateCommand.java | 2 +- 27 files changed, 118 insertions(+), 68 deletions(-) diff --git a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/EvalCommand.java b/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/EvalCommand.java index ac99cc629dec..3d106a27a9cd 100644 --- a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/EvalCommand.java +++ b/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/EvalCommand.java @@ -19,7 +19,7 @@ package org.apache.camel.dsl.jbang.core.commands; import org.aesh.command.CommandDefinition; @CommandDefinition(name = "eval", - description = "Evaluate Camel expressions and scripts (use transform --help to see sub commands)", + description = "Evaluate Camel expressions and scripts (use eval --help to see sub commands)", generateHelp = true) public class EvalCommand extends CamelCommand { diff --git a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/ExportBaseCommand.java b/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/ExportBaseCommand.java index 2a6532dae637..bc938bcb6941 100644 --- a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/ExportBaseCommand.java +++ b/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/ExportBaseCommand.java @@ -58,7 +58,7 @@ public abstract class ExportBaseCommand extends CamelCommand { private Printer quietPrinter; @Arguments(description = "The Camel file(s) to export. If no files is specified then what was last run will be exported.", - paramLabel = "<files>") + paramLabel = "files") protected List<String> files = new ArrayList<>(); @OptionList(name = "dep", aliases = { "dependency" }, valueSeparator = ',', description = "Add additional dependencies") diff --git a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/Init.java b/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/Init.java index 99670d6cca89..98db17d8956e 100644 --- a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/Init.java +++ b/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/Init.java @@ -65,7 +65,7 @@ import static org.apache.camel.dsl.jbang.run.common.GitHubHelper.fetchGithubUrls public class Init extends CamelCommand { private Path filePath; // Defined only for file path completion; the field never used - @Argument(description = "Name of integration file (or a github link)", paramLabel = "<file>") + @Argument(description = "Name of integration file (or a github link)", paramLabel = "file") private String file; @Option(name = "list", hasValue = false, description = "List available templates") diff --git a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/Nano.java b/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/Nano.java index 2211fffebb29..cd625cf46e0b 100644 --- a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/Nano.java +++ b/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/Nano.java @@ -34,7 +34,7 @@ import org.jline.terminal.TerminalBuilder; public class Nano extends CamelCommand { private Path filePath; // Defined only for file path completion; the field never used - @Argument(required = true, description = "Name of file", paramLabel = "<file>") + @Argument(required = true, description = "Name of file", paramLabel = "file") private String file; public Nano(CamelJBangMain main) { diff --git a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/Run.java b/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/Run.java index e5642261c684..190b7ffe7950 100644 --- a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/Run.java +++ b/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/Run.java @@ -128,7 +128,7 @@ public class Run extends CamelCommand implements CommandLifecycle { @Arguments(description = "The Camel file(s) to run. If no files specified then application.properties is used as source for which files to run." + " A Citrus test is run with camel test run.", - paramLabel = "<files>") + paramLabel = "files") public List<String> files = new ArrayList<>(); @Option(name = "runtime", diff --git a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/Script.java b/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/Script.java index 8c3dfc83cba2..f977f4d046a9 100644 --- a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/Script.java +++ b/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/Script.java @@ -33,7 +33,7 @@ import org.apache.camel.dsl.jbang.core.common.LoggingLevelCompletionCandidates; public class Script extends CamelCommand { Path filePath; // Defined only for file path completion; the field never used - @Argument(required = true, description = "Name of file", paramLabel = "<file>") + @Argument(required = true, description = "Name of file", paramLabel = "file") String file; @Option(name = "max-messages", description = "Max number of messages to process before stopping", defaultValue = "0") diff --git a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/TransformRoute.java b/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/TransformRoute.java index de3be039f90c..4c88079a2431 100644 --- a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/TransformRoute.java +++ b/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/TransformRoute.java @@ -27,6 +27,9 @@ import java.nio.file.Path; import java.util.ArrayList; import java.util.Iterator; import java.util.List; +import java.util.regex.Pattern; + +import javax.lang.model.SourceVersion; import org.aesh.command.CommandDefinition; import org.aesh.command.option.Arguments; @@ -62,7 +65,7 @@ public class TransformRoute extends CamelCommand { } @Arguments(description = "The Camel file(s) to run. If no files specified then application.properties is used as source for which files to run.", - paramLabel = "<files>") + paramLabel = "files") List<String> files = new ArrayList<>(); @Option(name = "output", @@ -181,6 +184,23 @@ public class TransformRoute extends CamelCommand { return printDump(target); } + /** + * The Java route with the class named after the file it is written to: a class must have the name of its file, and + * --output=Out.java got the class named after the route file (CAMEL-26931). + */ + static String withClassName(String java, String fileName, Path out) { + String wanted = out.getFileName().toString(); + if (!wanted.endsWith(".java") || fileName == null || !fileName.endsWith(".java")) { + return java; + } + wanted = wanted.substring(0, wanted.length() - ".java".length()); + String current = fileName.substring(0, fileName.length() - ".java".length()); + if (wanted.equals(current) || !SourceVersion.isName(wanted)) { + return java; + } + return java.replaceFirst("\\bclass " + Pattern.quote(current) + "\\b", "class " + wanted); + } + /** * To Java, each file is converted without running it (CAMEL-25254): read into the model by the parser of its DSL * and written as a route builder class, printed, or written into the output directory (or file, for one file). @@ -203,7 +223,7 @@ public class TransformRoute extends CamelCommand { Files.createDirectories(out); Files.writeString(out.resolve(r.fileName()), java); } else { - Files.writeString(out, java); + Files.writeString(out, withClassName(java, r.fileName(), out)); } } if (out == null) { diff --git a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/action/CamelRouteDiagramAction.java b/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/action/CamelRouteDiagramAction.java index 91825971fea6..ec8deb45a707 100644 --- a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/action/CamelRouteDiagramAction.java +++ b/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/action/CamelRouteDiagramAction.java @@ -80,7 +80,7 @@ public class CamelRouteDiagramAction extends ActionWatchCommand { @Arguments(description = "Source file name(s) (shell-expanded wildcards), or name/pid of a running " + "Camel integration", - paramLabel = "<files>") + paramLabel = "files") List<String> files = new ArrayList<>(); @Option(name = "filter", description = "Filter route by filename or route id") diff --git a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/action/CamelRouteTopologyAction.java b/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/action/CamelRouteTopologyAction.java index d6dccd871d07..e3eb52ea74a3 100644 --- a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/action/CamelRouteTopologyAction.java +++ b/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/action/CamelRouteTopologyAction.java @@ -64,7 +64,7 @@ public class CamelRouteTopologyAction extends ActionBaseCommand { @Arguments(description = "Source file name(s) (shell-expanded wildcards), or name/pid of a running " + "Camel integration", - paramLabel = "<files>") + paramLabel = "files") List<String> files = new ArrayList<>(); @Option(name = "json", hasValue = false, description = "Output in JSON Format") diff --git a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/bind/Bind.java b/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/bind/Bind.java index 91d5a731417b..88eefb670df0 100644 --- a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/bind/Bind.java +++ b/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/bind/Bind.java @@ -58,7 +58,7 @@ public class Bind extends CamelCommand { } Path filePath; // Defined only for file path completion; the field never used - @Argument(required = true, description = "Name of binding file to be saved", paramLabel = "<file>") + @Argument(required = true, description = "Name of binding file to be saved", paramLabel = "file") String file; @Option(name = "source", description = "Source (from) such as a Kamelet or Camel endpoint uri", required = true) diff --git a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/catalog/CatalogDoc.java b/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/catalog/CatalogDoc.java index 885b673ba91d..1648e28a1630 100644 --- a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/catalog/CatalogDoc.java +++ b/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/catalog/CatalogDoc.java @@ -542,7 +542,7 @@ public class CatalogDoc extends CamelCommand { } else { printer().printf("Component Name: %s%n", cm.getName()); } - printer().printf("Since: %s%n", fixQuarkusSince(cm.getFirstVersionShort())); + printSince(fixQuarkusSince(cm.getFirstVersionShort())); printer().println(""); if (cm.isProducerOnly()) { printer().println("Only producer is supported"); @@ -621,7 +621,7 @@ public class CatalogDoc extends CamelCommand { } else { printer().printf("Dataformat Name: %s%n", dm.getName()); } - printer().printf("Since: %s%n", fixQuarkusSince(dm.getFirstVersionShort())); + printSince(fixQuarkusSince(dm.getFirstVersionShort())); printer().println(""); printer().printf("%s%n", dm.getDescription()); printer().println(""); @@ -671,7 +671,7 @@ public class CatalogDoc extends CamelCommand { } else { printer().printf("Language Name: %s%n", lm.getName()); } - printer().printf("Since: %s%n", fixQuarkusSince(lm.getFirstVersionShort())); + printSince(fixQuarkusSince(lm.getFirstVersionShort())); printer().println(""); printer().printf("%s%n", lm.getDescription()); printer().println(""); @@ -721,7 +721,7 @@ public class CatalogDoc extends CamelCommand { } else { printer().printf("Miscellaneous Name: %s%n", om.getName()); } - printer().printf("Since: %s%n", fixQuarkusSince(om.getFirstVersionShort())); + printSince(fixQuarkusSince(om.getFirstVersionShort())); printer().println(""); printer().printf("%s%n", om.getDescription()); printer().println(""); @@ -758,7 +758,7 @@ public class CatalogDoc extends CamelCommand { } else { printer().printf("EIP Name: %s%n", em.getName()); } - printer().printf("Since: %s%n", fixQuarkusSince(em.getFirstVersionShort())); + printSince(fixQuarkusSince(em.getFirstVersionShort())); printer().println(""); printer().printf("%s%n", em.getDescription()); printer().println(""); @@ -949,4 +949,11 @@ public class CatalogDoc extends CamelCommand { return since; } + // the version a kind first came in, when the catalog has one: an EIP of the catalog has none, which printed an empty + // Since line (CAMEL-26931) + private void printSince(String since) { + if (since != null && !since.isBlank()) { + printer().printf("Since: %s%n", since); + } + } } diff --git a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/infra/InfraBaseCommand.java b/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/infra/InfraBaseCommand.java index a5d4277baa46..d1f1a085f55e 100644 --- a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/infra/InfraBaseCommand.java +++ b/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/infra/InfraBaseCommand.java @@ -338,6 +338,9 @@ public abstract class InfraBaseCommand extends CamelCommand { parseServiceData(row.serviceData()), row.uiSupported())) .map(InfraBaseDTO::toMap) .collect(Collectors.toList()))); + } else if (rows.isEmpty() && showPidColumn()) { + // camel infra ps printed only the header of the table (CAMEL-26931) + printer().printDiagnostic("No running infrastructure services"); } else { int tw = terminalWidth(); // Size DESCRIPTION to fill the terminal: measure the other columns so it gets the exact remainder. diff --git a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/plugin/PluginAdd.java b/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/plugin/PluginAdd.java index 9e7a78f8902d..058840c5cdd6 100644 --- a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/plugin/PluginAdd.java +++ b/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/plugin/PluginAdd.java @@ -53,7 +53,7 @@ import org.apache.camel.util.json.JsonObject; " camel plugin add --command=my-cmd --gav=com.foo:bar:1.0" }) public class PluginAdd extends PluginBaseCommand { - @Argument(required = true, description = "The Camel plugin to add", paramLabel = "<name>") + @Argument(required = true, description = "The Camel plugin to add", paramLabel = "name") String name; @Option(name = "command", description = "The command that the plugin uses") diff --git a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/plugin/PluginDelete.java b/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/plugin/PluginDelete.java index 278efe66023f..f68d10cb4905 100644 --- a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/plugin/PluginDelete.java +++ b/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/plugin/PluginDelete.java @@ -28,7 +28,7 @@ import org.apache.camel.util.json.JsonObject; " camel plugin delete my-cmd" }) public class PluginDelete extends PluginBaseCommand { - @Argument(required = true, description = "The Camel plugin to remove", paramLabel = "<plugin>") + @Argument(required = true, description = "The Camel plugin to remove", paramLabel = "plugin") String name; public PluginDelete(CamelJBangMain main) { diff --git a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/plugin/PluginGet.java b/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/plugin/PluginGet.java index ffca5f2ff19a..daf2c38f9a66 100644 --- a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/plugin/PluginGet.java +++ b/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/plugin/PluginGet.java @@ -70,10 +70,13 @@ public class PluginGet extends PluginBaseCommand { return 0; } - if (!rows.isEmpty()) { - printer().println("Installed plugins:"); - printer().println(); + if (rows.isEmpty()) { + // it printed nothing (CAMEL-26931) + printer().printDiagnostic("No plugins installed (camel plugin list lists the plugins that can be added)"); + return 0; } + printer().println("Installed plugins:"); + printer().println(); printRows(rows); return 0; diff --git a/dsl/camel-jbang/camel-jbang-core/src/test/java/org/apache/camel/dsl/jbang/core/commands/TransformRouteTest.java b/dsl/camel-jbang/camel-jbang-core/src/test/java/org/apache/camel/dsl/jbang/core/commands/TransformRouteTest.java index 5d76b0704a88..a073893ad0dc 100644 --- a/dsl/camel-jbang/camel-jbang-core/src/test/java/org/apache/camel/dsl/jbang/core/commands/TransformRouteTest.java +++ b/dsl/camel-jbang/camel-jbang-core/src/test/java/org/apache/camel/dsl/jbang/core/commands/TransformRouteTest.java @@ -87,6 +87,17 @@ class TransformRouteTest extends CamelCommandBaseTestSupport { assertThat(printer.getOutput()).contains("extends RouteBuilder", "from(\"timer:tick\")", "Hello Camel"); } + @Test + void yamlToAJavaFileNamesTheClassAfterTheFile() throws Exception { + // CAMEL-26931: --output=Out.java got a class named after the route file, which does not compile + Path yaml = Files.writeString(dir.resolve("hello.camel.yaml"), YAML); + Path out = dir.resolve("Out.java"); + + assertThat(command(List.of(yaml.toString()), "--format=java", "--output=" + out).doCall()).isZero(); + + assertThat(Files.readString(out)).contains("public class Out extends RouteBuilder"); + } + @Test void yamlToJavaFilesInADirectory() throws Exception { Path one = Files.writeString(dir.resolve("hello.camel.yaml"), YAML); diff --git a/dsl/camel-jbang/camel-jbang-core/src/test/java/org/apache/camel/dsl/jbang/core/commands/catalog/CatalogDocTest.java b/dsl/camel-jbang/camel-jbang-core/src/test/java/org/apache/camel/dsl/jbang/core/commands/catalog/CatalogDocTest.java index 7afd18c6f2da..35d85b953d8e 100644 --- a/dsl/camel-jbang/camel-jbang-core/src/test/java/org/apache/camel/dsl/jbang/core/commands/catalog/CatalogDocTest.java +++ b/dsl/camel-jbang/camel-jbang-core/src/test/java/org/apache/camel/dsl/jbang/core/commands/catalog/CatalogDocTest.java @@ -216,6 +216,8 @@ class CatalogDocTest extends CamelCommandBaseTestSupport { Assertions.assertTrue(output.contains("EIP output"), output); Assertions.assertTrue(output.contains("Steps"), output); Assertions.assertTrue(output.contains("Each part of what the expression gives"), output); + // CAMEL-26931: an EIP has no first version in the catalog, which printed an empty Since line + Assertions.assertFalse(output.lines().anyMatch(l -> l.strip().equals("Since:")), output); } @Test diff --git a/dsl/camel-jbang/camel-jbang-core/src/test/java/org/apache/camel/dsl/jbang/core/commands/infra/InfraPsTest.java b/dsl/camel-jbang/camel-jbang-core/src/test/java/org/apache/camel/dsl/jbang/core/commands/infra/InfraPsTest.java index 0893a7f05c15..55b7d2cb7a83 100644 --- a/dsl/camel-jbang/camel-jbang-core/src/test/java/org/apache/camel/dsl/jbang/core/commands/infra/InfraPsTest.java +++ b/dsl/camel-jbang/camel-jbang-core/src/test/java/org/apache/camel/dsl/jbang/core/commands/infra/InfraPsTest.java @@ -81,6 +81,9 @@ class InfraPsTest extends InfraCommandTestSupport { String out = printer.getOutput(); assertFalse(out.contains("kafka"), "no service rows should be printed when nothing is running, was: " + out); assertFalse(out.contains("minio"), "no service rows should be printed when nothing is running, was: " + out); + // CAMEL-26931: it printed the header of the table only + assertFalse(out.contains("IMPLEMENTATION"), "no table header when nothing is running, was: " + out); + assertTrue(printer.getStderr().contains("No running infrastructure services"), printer.getStderr()); } @Test diff --git a/dsl/camel-jbang/camel-jbang-core/src/test/java/org/apache/camel/dsl/jbang/core/commands/plugin/PluginGetTest.java b/dsl/camel-jbang/camel-jbang-core/src/test/java/org/apache/camel/dsl/jbang/core/commands/plugin/PluginGetTest.java index f4c119a2d0b8..d144a1d36769 100644 --- a/dsl/camel-jbang/camel-jbang-core/src/test/java/org/apache/camel/dsl/jbang/core/commands/plugin/PluginGetTest.java +++ b/dsl/camel-jbang/camel-jbang-core/src/test/java/org/apache/camel/dsl/jbang/core/commands/plugin/PluginGetTest.java @@ -49,7 +49,9 @@ class PluginGetTest extends CamelCommandBaseTestSupport { PluginGet command = new PluginGet(new CamelJBangMain().withPrinter(printer)); command.doCall(); - Assertions.assertEquals("", printer.getOutput()); + // CAMEL-26931: it printed nothing at all + Assertions.assertEquals("", printer.getStdout()); + Assertions.assertTrue(printer.getStderr().contains("No plugins installed"), printer.getStderr()); } @Test diff --git a/dsl/camel-jbang/camel-jbang-core/src/test/resources/golden/cli-help.txt b/dsl/camel-jbang/camel-jbang-core/src/test/resources/golden/cli-help.txt index 1788e9b2f9ae..7cf8614a9fa2 100644 --- a/dsl/camel-jbang/camel-jbang-core/src/test/resources/golden/cli-help.txt +++ b/dsl/camel-jbang/camel-jbang-core/src/test/resources/golden/cli-help.txt @@ -42,8 +42,8 @@ Development: init Creates a new Camel integration export Export to other runtimes (Camel Main, Spring Boot, or Quarkus) debug Debug local Camel integration - eval Evaluate Camel expressions and scripts (use transform --help to - see sub commands) + eval Evaluate Camel expressions and scripts (use eval --help to see + sub commands) explain Explain what a Camel route does using AI/LLM transform Transform message or Camel routes (use transform --help to see sub commands) @@ -145,7 +145,7 @@ Examples: DEPRECATED: Bind source and sink Kamelets as a new Camel integration Usage: camel bind [-h] --source=<source> [--step=<step>] --sink=<sink> [--error-handler=<error-handler>] [--property=<property>] - [--output=<output>] <<file>> + [--output=<output>] <file> Options: -h, --help Display this help and exit @@ -166,7 +166,7 @@ Options: --output=<output> Output format generated by this command (supports: file, yaml, json). Default: file - <<file>> Name of binding file to be saved + <file> Name of binding file to be saved == camel catalog --help List artifacts from Camel Catalog (use catalog --help to see sub commands) @@ -1434,7 +1434,7 @@ Usage: camel cmd route-diagram [-h] [--filter=<filter>] [--width=<width>] [--highlight-style=<highlight-style>] [--ignore-loading-error] [--compile] [--errors] [--timeout=<timeout>] [--watch] - [--duration=<duration>] [<<files>>] + [--duration=<duration>] [<files>] Options: -h, --help Display this help and exit @@ -1500,7 +1500,7 @@ Options: How long to keep watching or following, in millis or as a duration such as 30s (default: until Enter is pressed) - <<files>> Source file name(s) (shell-expanded wildcards), or + <files> Source file name(s) (shell-expanded wildcards), or name/pid of a running Camel integration Examples: @@ -1584,7 +1584,7 @@ Usage: camel cmd route-topology [-h] [--json] [--theme=<theme>] [--font-size=<font-size>] [--description] [--metric] [--external] [--errors] [--kamelets] [--ignore-loading-error] [--compile] - [--timeout=<timeout>] [<<files>>] + [--timeout=<timeout>] [<files>] Options: -h, --help Display this help and exit @@ -1624,7 +1624,7 @@ Options: --timeout=<timeout> How long to wait for the integration to answer, in millis or as a duration such as 30s Default: 10000 - <<files>> Source file name(s) (shell-expanded wildcards), or + <files> Source file name(s) (shell-expanded wildcards), or name/pid of a running Camel integration Examples: @@ -2087,7 +2087,7 @@ Usage: camel debug [-h] [--remote-attach] [--breakpoint=<breakpoint>] [--local-kamelet-dir=<local-kamelet-dir>] [--modeline] [--open-api=<open-api>] [--code=<code>] [--verbose] [--ignore-loading-error] [--lazy-bean] [--prompt] - [--skip-plugins] [--example] [<<files>>] + [--skip-plugins] [--example] [<files>] Options: -h, --help Display this help and exit @@ -2398,7 +2398,7 @@ Options: --example Run an example by name (timer-log or route/aggregator), list the groups when no name is given, or list one group by its name (route). - <<files>> The Camel file(s) to run. If no files specified then + <files> The Camel file(s) to run. If no files specified then application.properties is used as source for which files to run. A Citrus test is run with camel test run. @@ -2461,7 +2461,7 @@ Usage: camel dependency copy [-hy] [--output-directory=<output-directory>] [--dry-run] [--ignore-loading-error] [--lazy-bean] [--skip-plugins] [--groovy-pre-compiled] [--hawtio] [--hawtio-version=<hawtio-version>] - [<<files>>] + [<files>] Options: -h, --help Display this help and exit @@ -2627,7 +2627,7 @@ Options: --hawtio-version=<hawtio-version> Version of the Hawtio web console Default: ${hawtio-version} - <<files>> The Camel file(s) to export. If no files is + <files> The Camel file(s) to export. If no files is specified then what was last run will be exported. Examples: @@ -2669,7 +2669,7 @@ Usage: camel dependency list [-hy] [--output=<output>] [--dep=<dep>] [--dry-run] [--ignore-loading-error] [--lazy-bean] [--skip-plugins] [--groovy-pre-compiled] [--hawtio] [--hawtio-version=<hawtio-version>] - [<<files>>] + [<files>] Options: -h, --help Display this help and exit @@ -2832,7 +2832,7 @@ Options: --hawtio-version=<hawtio-version> Version of the Hawtio web console Default: ${hawtio-version} - <<files>> The Camel file(s) to export. If no files is + <files> The Camel file(s) to export. If no files is specified then what was last run will be exported. Examples: @@ -2897,7 +2897,7 @@ Usage: camel dependency update [-hy] [--clean] [--scan-routes] [--verbose] [--dry-run] [--ignore-loading-error] [--lazy-bean] [--skip-plugins] [--groovy-pre-compiled] [--hawtio] - [--hawtio-version=<hawtio-version>] [<<files>>] + [--hawtio-version=<hawtio-version>] [<files>] Options: -h, --help Display this help and exit @@ -3066,7 +3066,7 @@ Options: --hawtio-version=<hawtio-version> Version of the Hawtio web console Default: ${hawtio-version} - <<files>> The Camel file(s) to export. If no files is + <files> The Camel file(s) to export. If no files is specified then what was last run will be exported. Examples: @@ -3109,7 +3109,7 @@ Usage: camel dev [-h] [--runtime=<runtime>] [--source-dir=<source-dir>] [--sanitizer] [--local-kamelet-dir=<local-kamelet-dir>] [--modeline] [--open-api=<open-api>] [--code=<code>] [--verbose] [--ignore-loading-error] [--lazy-bean] [--prompt] - [--skip-plugins] [--example] [<<files>>] + [--skip-plugins] [--example] [<files>] Options: -h, --help Display this help and exit @@ -3382,7 +3382,7 @@ Options: --example Run an example by name (timer-log or route/aggregator), list the groups when no name is given, or list one group by its name (route). - <<files>> The Camel file(s) to run. If no files specified then + <files> The Camel file(s) to run. If no files specified then application.properties is used as source for which files to run. A Citrus test is run with camel test run. @@ -3496,8 +3496,7 @@ Examples: camel doctor --json == camel eval --help -Evaluate Camel expressions and scripts (use transform --help to see sub -commands) +Evaluate Camel expressions and scripts (use eval --help to see sub commands) Usage: camel eval [-h] [COMMAND] Options: @@ -3639,7 +3638,7 @@ Usage: camel export [-hy] [--dep=<dep>] [--runtime=<runtime>] [--name=<name>] [--logging] [--quiet] [--verbose] [--dry-run] [--ignore-loading-error] [--lazy-bean] [--skip-plugins] [--groovy-pre-compiled] [--hawtio] - [--hawtio-version=<hawtio-version>] [<<files>>] + [--hawtio-version=<hawtio-version>] [<files>] Options: -h, --help Display this help and exit @@ -3800,7 +3799,7 @@ Options: --hawtio-version=<hawtio-version> Version of the Hawtio web console Default: ${hawtio-version} - <<files>> The Camel file(s) to export. If no files is + <files> The Camel file(s) to export. If no files is specified then what was last run will be exported. Examples: @@ -5102,7 +5101,7 @@ Creates a new Camel integration Usage: camel init [-h] [--list] [--dir=<dir>] [--clean-dir] [--force] [--from-kamelet=<from-kamelet>] [--kamelets-version=<kamelets-version>] [--pipe] - [--repo=<repo>] [<<file>>] + [--repo=<repo>] [<file>] Options: -h, --help Display this help and exit @@ -5126,7 +5125,7 @@ Options: --repo, --repos=<repo> Additional maven repositories (Use commas to separate multiple repositories) - <<file>> Name of integration file (or a github link) + <file> Name of integration file (or a github link) Examples: camel init hello.java @@ -5206,11 +5205,11 @@ Examples: == camel nano --help Nano editor to edit file -Usage: camel nano [-h] <<file>> +Usage: camel nano [-h] <file> Options: -h, --help Display this help and exit - <<file>> Name of file + <file> Name of file Press Ctrl-X to exit. @@ -5287,7 +5286,7 @@ Usage: camel plugin add [-h] [--command=<command>] [--description=<description>] [--repo=<repo>] [--artifactId=<artifactId>] [--groupId=<groupId>] [--version=<version>] [--first-version=<first-version>] [--gav=<gav>] - [--plugin-config=<plugin-config>] <<name>> + [--plugin-config=<plugin-config>] <name> Options: -h, --help Display this help and exit @@ -5311,14 +5310,14 @@ Options: directory. Only applies to the plugin subcommands; for plugin commands themselves (e.g. 'camel kubernetes'), set CAMEL_CLI_PLUGIN_CONFIG instead. - <<name>> The Camel plugin to add + <name> The Camel plugin to add Examples: camel plugin add --command=my-cmd --gav=com.foo:bar:1.0 == camel plugin delete --help Removes a plugin -Usage: camel plugin delete [-h] [--plugin-config=<plugin-config>] <<plugin>> +Usage: camel plugin delete [-h] [--plugin-config=<plugin-config>] <plugin> Options: -h, --help Display this help and exit @@ -5327,7 +5326,7 @@ Options: directory. Only applies to the plugin subcommands; for plugin commands themselves (e.g. 'camel kubernetes'), set CAMEL_CLI_PLUGIN_CONFIG instead. - <<plugin>> The Camel plugin to remove + <plugin> The Camel plugin to remove Examples: camel plugin delete my-cmd @@ -5448,7 +5447,7 @@ Usage: camel run [-h] [--runtime=<runtime>] [--source-dir=<source-dir>] [--sanitizer] [--local-kamelet-dir=<local-kamelet-dir>] [--modeline] [--open-api=<open-api>] [--code=<code>] [--verbose] [--ignore-loading-error] [--lazy-bean] [--prompt] - [--skip-plugins] [--example] [<<files>>] + [--skip-plugins] [--example] [<files>] Options: -h, --help Display this help and exit @@ -5721,7 +5720,7 @@ Options: --example Run an example by name (timer-log or route/aggregator), list the groups when no name is given, or list one group by its name (route). - <<files>> The Camel file(s) to run. If no files specified then + <files> The Camel file(s) to run. If no files specified then application.properties is used as source for which files to run. A Citrus test is run with camel test run. @@ -5771,7 +5770,7 @@ Usage: camel sbom [-hy] [--output-directory=<output-directory>] [--logging] [--quiet] [--verbose] [--dry-run] [--ignore-loading-error] [--lazy-bean] [--skip-plugins] [--groovy-pre-compiled] [--hawtio] - [--hawtio-version=<hawtio-version>] [<<files>>] + [--hawtio-version=<hawtio-version>] [<files>] Options: -h, --help Display this help and exit @@ -5952,7 +5951,7 @@ Options: --hawtio-version=<hawtio-version> Version of the Hawtio web console Default: ${hawtio-version} - <<files>> The Camel file(s) to export. If no files is + <files> The Camel file(s) to export. If no files is specified then what was last run will be exported. Examples: @@ -5966,7 +5965,7 @@ Usage: camel script [-h] [--max-messages=<max-messages>] [--max-seconds=<max-seconds>] [--max-idle-seconds=<max-idle-seconds>] [--logging] [--logging-level=<logging-level>] - [--properties=<properties>] [--prop=<prop>] <<file>> + [--properties=<properties>] [--prop=<prop>] <file> Options: -h, --help Display this help and exit @@ -5991,7 +5990,7 @@ Options: /path/to/file.properties --prop, --property=<prop> Additional properties (override existing) - <<file>> Name of file + <file> Name of file Examples: camel script hello.java @@ -6624,7 +6623,7 @@ Transform Camel routes to XML, YAML or Java format Usage: camel transform route [-h] [--output=<output>] [--format=<format>] [--resolve-placeholders] [--uri-as-parameters] [--ignore-loading-error] [--compile] [--download] - [--repo=<repo>] [--fresh] [<<files>>] + [--repo=<repo>] [--fresh] [<files>] Options: -h, --help Display this help and exit @@ -6658,7 +6657,7 @@ Options: (Use commas to separate multiple repositories) --fresh Make sure we use fresh (i.e. non-cached) resources Default: false - <<files>> The Camel file(s) to run. If no files specified then + <files> The Camel file(s) to run. If no files specified then application.properties is used as source for which files to run. @@ -6947,7 +6946,7 @@ stderr: [--sanitizer] [--local-kamelet-dir=<local-kamelet-dir>] [--modeline] [--open-api=<open-api>] [--code=<code>] [--verbose] [--ignore-loading-error] [--lazy-bean] [--prompt] - [--skip-plugins] [--example] [<<files>>] + [--skip-plugins] [--example] [<files>] Try 'camel run --help' for more information. == camel get route --sort diff --git a/dsl/camel-jbang/camel-jbang-plugin-edit/src/main/java/org/apache/camel/dsl/jbang/core/commands/edit/EditCommand.java b/dsl/camel-jbang/camel-jbang-plugin-edit/src/main/java/org/apache/camel/dsl/jbang/core/commands/edit/EditCommand.java index 09aae5b1056c..c8f367f96808 100644 --- a/dsl/camel-jbang/camel-jbang-plugin-edit/src/main/java/org/apache/camel/dsl/jbang/core/commands/edit/EditCommand.java +++ b/dsl/camel-jbang/camel-jbang-plugin-edit/src/main/java/org/apache/camel/dsl/jbang/core/commands/edit/EditCommand.java @@ -36,7 +36,7 @@ import org.jline.terminal.TerminalBuilder; public class EditCommand extends CamelCommand { private Path filePath; // Defined only for file path completion; the field never used - @Argument(required = true, description = "Name of file", paramLabel = "<file>") + @Argument(required = true, description = "Name of file", paramLabel = "file") private String file; public EditCommand(CamelJBangMain main) { diff --git a/dsl/camel-jbang/camel-jbang-plugin-kubernetes/src/main/java/org/apache/camel/dsl/jbang/core/commands/kubernetes/KubernetesPodLogs.java b/dsl/camel-jbang/camel-jbang-plugin-kubernetes/src/main/java/org/apache/camel/dsl/jbang/core/commands/kubernetes/KubernetesPodLogs.java index aa257e695c13..5ce61dde78ea 100644 --- a/dsl/camel-jbang/camel-jbang-plugin-kubernetes/src/main/java/org/apache/camel/dsl/jbang/core/commands/kubernetes/KubernetesPodLogs.java +++ b/dsl/camel-jbang/camel-jbang-plugin-kubernetes/src/main/java/org/apache/camel/dsl/jbang/core/commands/kubernetes/KubernetesPodLogs.java @@ -38,7 +38,7 @@ import static org.apache.camel.dsl.jbang.core.commands.kubernetes.KubernetesHelp public class KubernetesPodLogs extends KubernetesBaseCommand { @Argument(description = "The Camel file to get logs from. Integration name is derived from the file name.", - paramLabel = "<file>") + paramLabel = "file") protected String filePath; @Option(name = "label", description = "Label name and value used as a pod selector.") diff --git a/dsl/camel-jbang/camel-jbang-plugin-kubernetes/src/main/java/org/apache/camel/dsl/jbang/core/commands/kubernetes/KubernetesRun.java b/dsl/camel-jbang/camel-jbang-plugin-kubernetes/src/main/java/org/apache/camel/dsl/jbang/core/commands/kubernetes/KubernetesRun.java index aff44f525faf..5b5b7f580250 100644 --- a/dsl/camel-jbang/camel-jbang-plugin-kubernetes/src/main/java/org/apache/camel/dsl/jbang/core/commands/kubernetes/KubernetesRun.java +++ b/dsl/camel-jbang/camel-jbang-plugin-kubernetes/src/main/java/org/apache/camel/dsl/jbang/core/commands/kubernetes/KubernetesRun.java @@ -76,7 +76,7 @@ import static org.apache.camel.dsl.jbang.core.commands.kubernetes.KubernetesHelp public class KubernetesRun extends KubernetesBaseCommand { @Arguments(description = "The Camel file(s) to run. If no files specified then application.properties is used as source for which files to run.", - paramLabel = "<files>") + paramLabel = "files") public List<String> files = new ArrayList<>(); @Option(name = "service-account", description = "The service account used to run the application.") diff --git a/dsl/camel-jbang/camel-jbang-plugin-validate/src/main/java/org/apache/camel/dsl/jbang/core/commands/validate/PropertiesValidateCommand.java b/dsl/camel-jbang/camel-jbang-plugin-validate/src/main/java/org/apache/camel/dsl/jbang/core/commands/validate/PropertiesValidateCommand.java index 0f77e6d74b2a..61228bbc4fd5 100644 --- a/dsl/camel-jbang/camel-jbang-plugin-validate/src/main/java/org/apache/camel/dsl/jbang/core/commands/validate/PropertiesValidateCommand.java +++ b/dsl/camel-jbang/camel-jbang-plugin-validate/src/main/java/org/apache/camel/dsl/jbang/core/commands/validate/PropertiesValidateCommand.java @@ -44,7 +44,7 @@ import org.apache.camel.util.FileUtil; sortOptions = true) public class PropertiesValidateCommand extends CamelCommand { - @Arguments(required = true, description = "The properties files to validate.", paramLabel = "<files>") + @Arguments(required = true, description = "The properties files to validate.", paramLabel = "files") List<String> files = new ArrayList<>(); @Option(name = "json", hasValue = false, diff --git a/dsl/camel-jbang/camel-jbang-plugin-validate/src/main/java/org/apache/camel/dsl/jbang/core/commands/validate/SourceValidateCommand.java b/dsl/camel-jbang/camel-jbang-plugin-validate/src/main/java/org/apache/camel/dsl/jbang/core/commands/validate/SourceValidateCommand.java index 469628479ef5..26006cea1e4b 100644 --- a/dsl/camel-jbang/camel-jbang-plugin-validate/src/main/java/org/apache/camel/dsl/jbang/core/commands/validate/SourceValidateCommand.java +++ b/dsl/camel-jbang/camel-jbang-plugin-validate/src/main/java/org/apache/camel/dsl/jbang/core/commands/validate/SourceValidateCommand.java @@ -44,7 +44,7 @@ import org.apache.camel.dsl.yaml.validator.YamlValidator; generateHelp = true, sortOptions = true) public class SourceValidateCommand extends CamelCommand { - @Arguments(required = true, description = "The source files to validate.", paramLabel = "<files>") + @Arguments(required = true, description = "The source files to validate.", paramLabel = "files") List<String> files = new ArrayList<>(); @Mixin diff --git a/dsl/camel-jbang/camel-jbang-plugin-validate/src/main/java/org/apache/camel/dsl/jbang/core/commands/validate/YamlNormalizeCommand.java b/dsl/camel-jbang/camel-jbang-plugin-validate/src/main/java/org/apache/camel/dsl/jbang/core/commands/validate/YamlNormalizeCommand.java index db2bea6bc184..1f3fba9861af 100644 --- a/dsl/camel-jbang/camel-jbang-plugin-validate/src/main/java/org/apache/camel/dsl/jbang/core/commands/validate/YamlNormalizeCommand.java +++ b/dsl/camel-jbang/camel-jbang-plugin-validate/src/main/java/org/apache/camel/dsl/jbang/core/commands/validate/YamlNormalizeCommand.java @@ -76,7 +76,7 @@ public class YamlNormalizeCommand extends CamelCommand { + " The output must not overwrite one of the input files.") private String output; - @Arguments(required = true, description = "The Camel YAML source files to normalize.", paramLabel = "<files>") + @Arguments(required = true, description = "The Camel YAML source files to normalize.", paramLabel = "files") List<String> files = new ArrayList<>(); public YamlNormalizeCommand(CamelJBangMain main) { diff --git a/dsl/camel-jbang/camel-jbang-plugin-validate/src/main/java/org/apache/camel/dsl/jbang/core/commands/validate/YamlValidateCommand.java b/dsl/camel-jbang/camel-jbang-plugin-validate/src/main/java/org/apache/camel/dsl/jbang/core/commands/validate/YamlValidateCommand.java index 630ee18706d8..3059b7330bfa 100644 --- a/dsl/camel-jbang/camel-jbang-plugin-validate/src/main/java/org/apache/camel/dsl/jbang/core/commands/validate/YamlValidateCommand.java +++ b/dsl/camel-jbang/camel-jbang-plugin-validate/src/main/java/org/apache/camel/dsl/jbang/core/commands/validate/YamlValidateCommand.java @@ -66,7 +66,7 @@ public class YamlValidateCommand extends CamelCommand { + " camel_validate_source answers") boolean jsonOutput; - @Arguments(required = true, description = "The Camel YAML source files to parse.", paramLabel = "<files>") + @Arguments(required = true, description = "The Camel YAML source files to parse.", paramLabel = "files") List<String> files = new ArrayList<>(); public YamlValidateCommand(CamelJBangMain main) {
