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

gnodet pushed a commit to branch CAMEL-23226-all-jbang-ux
in repository https://gitbox.apache.org/repos/asf/camel.git

commit a3c00cbedac025d6e1ee341e7074012494183ba3
Author: Guillaume Nodet <[email protected]>
AuthorDate: Sat Mar 21 13:41:29 2026 +0100

    CAMEL-23226: Organize Run command options into logical groups with @ArgGroup
    
    Co-Authored-By: Claude Opus 4.6 <[email protected]>
---
 .../camel/dsl/jbang/core/commands/Debug.java       |  35 +--
 .../dsl/jbang/core/commands/ExportBaseCommand.java |   8 +-
 .../apache/camel/dsl/jbang/core/commands/Run.java  | 247 ++++++++++++---------
 .../camel/dsl/jbang/core/commands/Script.java      |  12 +-
 .../dsl/jbang/core/commands/TransformRoute.java    |   2 +-
 5 files changed, 172 insertions(+), 132 deletions(-)

diff --git 
a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/Debug.java
 
b/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/Debug.java
index 22e40f95070d..6882f0f540bd 100644
--- 
a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/Debug.java
+++ 
b/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/Debug.java
@@ -175,7 +175,7 @@ public class Debug extends Run {
 
         tableHelper = new MessageTableHelper();
         tableHelper.setPretty(pretty);
-        tableHelper.setLoggingColor(loggingColor);
+        tableHelper.setLoggingColor(loggingOptions.loggingColor);
         tableHelper.setShowExchangeProperties(showExchangeProperties);
         tableHelper.setShowExchangeVariables(showExchangeVariables);
 
@@ -421,7 +421,8 @@ public class Debug extends Run {
                                 ? "-Dcamel.debug.breakpoints=_all_routes_" : 
"-Dcamel.debug.breakpoints=" + breakpoint),
                         "-Dcamel.debug.loggingLevel=DEBUG",
                         "-Dcamel.debug.singleStepIncludeStartEnd=true",
-                        loggingColor ? "-Dspring.output.ansi.enabled=ALWAYS" : 
"-Dspring.output.ansi.enabled=NEVER",
+                        loggingOptions.loggingColor
+                                ? "-Dspring.output.ansi.enabled=ALWAYS" : 
"-Dspring.output.ansi.enabled=NEVER",
                         "-jar", "target/camel-jbang-debug.jar");
 
                 p = pb.start();
@@ -847,7 +848,7 @@ public class Debug extends Run {
                 } else {
                     msg = "    Breakpoint suspended. Press ENTER to continue 
(q = quit).";
                 }
-                if (loggingColor) {
+                if (loggingOptions.loggingColor) {
                     
AnsiConsole.out().println(Ansi.ansi().a(Ansi.Attribute.INTENSITY_BOLD).a(msg).reset());
                 } else {
                     printer().println(msg);
@@ -888,7 +889,7 @@ public class Debug extends Run {
                     msg = msg.substring(0, 80);
                 }
                 int length = msg.length();
-                if (loggingColor && code.match) {
+                if (loggingOptions.loggingColor && code.match) {
                     Ansi.Color col = Ansi.Color.BLUE;
                     Ansi.Attribute it = Ansi.Attribute.INTENSITY_BOLD;
                     if (row.failed && row.last) {
@@ -949,7 +950,7 @@ public class Debug extends Run {
                     }
 
                     ids = String.format("%-30.30s", ids);
-                    if (loggingColor) {
+                    if (loggingOptions.loggingColor) {
                         ids = Ansi.ansi().fgCyan().a(ids).reset().toString();
                     }
                     long e = i == 2 ? 0 : h.elapsed; // the pseudo from should 
have 0 as elapsed
@@ -978,7 +979,7 @@ public class Debug extends Run {
                         msg = String.format("%2d %10.10s %s %4d:   %s", 
h.index, elapsed, fids, h.line, c);
                     }
                     int len = msg.length();
-                    if (loggingColor) {
+                    if (loggingOptions.loggingColor) {
                         fids = String.format("%-30.30s", ids);
                         fids = Ansi.ansi().fgCyan().a(fids).reset().toString();
                         if (top && !row.last) {
@@ -1016,7 +1017,7 @@ public class Debug extends Run {
                 SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd 
HH:mm:ss.SSS");
                 ts = sdf.format(new Date(row.timestamp));
             }
-            if (loggingColor) {
+            if (loggingOptions.loggingColor) {
                 
AnsiConsole.out().print(Ansi.ansi().fgBrightDefault().a(Ansi.Attribute.INTENSITY_FAINT).a(ts).reset());
             } else {
                 printer().print(ts);
@@ -1025,7 +1026,7 @@ public class Debug extends Run {
         }
         // pid
         String p = String.format("%5.5s", row.pid);
-        if (loggingColor) {
+        if (loggingOptions.loggingColor) {
             AnsiConsole.out().print(Ansi.ansi().fgMagenta().a(p).reset());
             
AnsiConsole.out().print(Ansi.ansi().fgBrightDefault().a(Ansi.Attribute.INTENSITY_FAINT).a("
 --- ").reset());
         } else {
@@ -1038,7 +1039,7 @@ public class Debug extends Run {
             tn = tn.substring(tn.length() - 25);
         }
         tn = String.format("[%25.25s]", tn);
-        if (loggingColor) {
+        if (loggingOptions.loggingColor) {
             
AnsiConsole.out().print(Ansi.ansi().fgBrightDefault().a(Ansi.Attribute.INTENSITY_FAINT).a(tn).reset());
         } else {
             printer().print(tn);
@@ -1055,7 +1056,7 @@ public class Debug extends Run {
             ids = ids.substring(ids.length() - 40);
         }
         ids = String.format("%40.40s", ids);
-        if (loggingColor) {
+        if (loggingOptions.loggingColor) {
             AnsiConsole.out().print(Ansi.ansi().fgCyan().a(ids).reset());
         } else {
             printer().print(ids);
@@ -1063,7 +1064,7 @@ public class Debug extends Run {
         printer().print(" : ");
         // uuid
         String u = String.format("%5.5s", row.uid);
-        if (loggingColor) {
+        if (loggingOptions.loggingColor) {
             AnsiConsole.out().print(Ansi.ansi().fgMagenta().a(u).reset());
         } else {
             printer().print(u);
@@ -1074,7 +1075,7 @@ public class Debug extends Run {
         // elapsed
         String e = getElapsed(row);
         if (e != null) {
-            if (loggingColor) {
+            if (loggingOptions.loggingColor) {
                 AnsiConsole.out().print(Ansi.ansi().fgBrightDefault().a(" (" + 
e + ")").reset());
             } else {
                 printer().print("(" + e + ")");
@@ -1135,35 +1136,35 @@ public class Debug extends Run {
 
         if (r.first) {
             String s = "Created";
-            if (loggingColor) {
+            if (loggingOptions.loggingColor) {
                 return 
Ansi.ansi().fg(Ansi.Color.GREEN).a(s).reset().toString();
             } else {
                 return s;
             }
         } else if (r.last) {
             String done = r.exception != null ? "Completed (exception)" : 
"Completed (success)";
-            if (loggingColor) {
+            if (loggingOptions.loggingColor) {
                 return Ansi.ansi().fg(r.failed ? Ansi.Color.RED : 
Ansi.Color.GREEN).a(done).reset().toString();
             } else {
                 return done;
             }
         }
         if (!r.done) {
-            if (loggingColor) {
+            if (loggingOptions.loggingColor) {
                 return 
Ansi.ansi().fg(Ansi.Color.BLUE).a("Breakpoint").reset().toString();
             } else {
                 return "Breakpoint";
             }
         } else if (r.failed) {
             String fail = r.exception != null ? "Exception" : "Failed";
-            if (loggingColor) {
+            if (loggingOptions.loggingColor) {
                 return 
Ansi.ansi().fg(Ansi.Color.RED).a(fail).reset().toString();
             } else {
                 return fail;
             }
         } else {
             String s = remote ? "Sent" : "Processed";
-            if (loggingColor) {
+            if (loggingOptions.loggingColor) {
                 return 
Ansi.ansi().fg(Ansi.Color.GREEN).a(s).reset().toString();
             } else {
                 return s;
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 4551cab8c722..23e8ea7be211 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
@@ -431,11 +431,11 @@ public abstract class ExportBaseCommand extends 
CamelCommand {
         run.dependencies = dependencies;
         run.files = files;
         run.name = name;
-        run.port = port;
-        run.managementPort = managementPort;
+        run.serverOptions.port = port;
+        run.serverOptions.managementPort = managementPort;
         run.excludes = excludes;
         run.openapi = openapi;
-        run.observe = observe;
+        run.serverOptions.observe = observe;
         run.download = download;
         run.packageScanJars = packageScanJars;
         run.runtime = runtime;
@@ -451,7 +451,7 @@ public abstract class ExportBaseCommand extends 
CamelCommand {
         run.property = applicationProperties;
         run.repositories = repositories;
         run.verbose = verbose;
-        run.logging = logging;
+        run.loggingOptions.logging = logging;
         return run.runExport(ignoreLoadingError);
     }
 
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 3193afadbf6b..dc339ae4e637 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
@@ -236,6 +236,18 @@ public class Run extends CamelCommand {
                         description = "Whether to automatic package scan JARs 
for custom Spring or Quarkus beans making them available for Camel JBang")
     boolean packageScanJars;
 
+    @CommandLine.ArgGroup(validate = false, heading = "%nLogging Options:%n")
+    LoggingOptions loggingOptions = new LoggingOptions();
+
+    @CommandLine.ArgGroup(validate = false, heading = "%nDebug Options:%n")
+    DebugOptions debugOptions = new DebugOptions();
+
+    @CommandLine.ArgGroup(validate = false, heading = "%nExecution Limit 
Options:%n")
+    ExecutionLimitOptions executionLimitOptions = new ExecutionLimitOptions();
+
+    @CommandLine.ArgGroup(validate = false, heading = "%nServer Options:%n")
+    ServerOptions serverOptions = new ServerOptions();
+
     @Option(names = { "--jvm-debug" }, parameterConsumer = 
DebugConsumer.class, paramLabel = "<true|false|port>",
             description = "To enable JVM remote debugging on port 4004 by 
default. The supported values are true to " +
                           "enable the remote debugging, false to disable the 
remote debugging or a number to use a custom port")
@@ -247,46 +259,13 @@ public class Run extends CamelCommand {
     @CommandLine.Option(names = { "--exclude" }, description = "Exclude files 
by name or pattern")
     List<String> excludes = new ArrayList<>();
 
-    @Option(names = { "--logging" }, defaultValue = "true", description = "Can 
be used to turn off logging")
-    boolean logging = true;
-
-    @Option(names = { "--logging-level" }, completionCandidates = 
LoggingLevelCompletionCandidates.class,
-            defaultValue = "info", description = "Logging level 
(${COMPLETION-CANDIDATES})")
-    String loggingLevel;
-
-    @Option(names = { "--logging-color" }, defaultValue = "true", description 
= "Use colored logging")
-    boolean loggingColor = true;
-
-    @Option(names = { "--logging-json" }, defaultValue = "false", description 
= "Use JSON logging (ECS Layout)")
-    boolean loggingJson;
-
-    @Option(names = { "--logging-config-path" }, description = "Path to file 
with custom logging configuration")
-    String loggingConfigPath;
-
-    @Option(names = { "--logging-category" }, description = "Used for 
individual logging levels (ex: org.apache.kafka=DEBUG)")
-    List<String> loggingCategory = new ArrayList<>();
-
-    @Option(names = { "--max-messages" }, defaultValue = "0", description = 
"Max number of messages to process before stopping")
-    int maxMessages;
-
-    @Option(names = { "--max-seconds" }, defaultValue = "0", description = 
"Max seconds to run before stopping")
-    int maxSeconds;
-
-    @Option(names = { "--max-idle-seconds" }, defaultValue = "0",
-            description = "For how long time in seconds Camel can be idle 
before stopping")
-    int maxIdleSeconds;
+    // Logging, execution limit, debug, and server options are defined in 
their respective @ArgGroup inner classes below
 
     @Option(names = { "--reload", "--dev" },
             description = "Enables dev mode (live reload when source files are 
updated and saved)")
     boolean dev;
 
-    @Option(names = { "--trace" }, defaultValue = "false",
-            description = "Enables trace logging of the routed messages")
-    boolean trace;
-
-    @Option(names = { "--backlog-trace" }, defaultValue = "false",
-            description = "Enables backlog tracing of the routed messages")
-    boolean backlogTrace;
+    // trace and backlogTrace options are in DebugOptions @ArgGroup
 
     @Option(names = { "--properties" },
             description = "comma separated list of properties file" +
@@ -300,43 +279,13 @@ public class Run extends CamelCommand {
                                                 + " Multiple names can be 
separated by comma. (all = stub all endpoints).")
     String stub;
 
-    @Option(names = { "--jfr" }, defaultValue = "false",
-            description = "Enables Java Flight Recorder saving recording to 
disk on exit")
-    boolean jfr;
-
-    @Option(names = { "--jfr-profile" },
-            description = "Java Flight Recorder profile to use (such as 
default or profile)")
-    String jfrProfile;
+    // jfr and jfrProfile options are in DebugOptions @ArgGroup
 
     @Option(names = { "--local-kamelet-dir" },
             description = "Local directory (or github link) for loading 
Kamelets (takes precedence). Multiple directories can be specified separated by 
comma.")
     String localKameletDir;
 
-    @Option(names = { "--port" },
-            description = "Embeds a local HTTP server on this port (port 8080 
by default; use 0 to dynamic assign a free random port number)")
-    int port = -1;
-
-    @Option(names = { "--management-port" },
-            description = "To use a dedicated port for HTTP management (use 0 
to dynamic assign a free random port number)")
-    int managementPort = -1;
-
-    @Option(names = { "--console" }, defaultValue = "false",
-            description = "Developer console at /q/dev on local HTTP server 
(port 8080 by default)")
-    boolean console;
-
-    @Deprecated
-    @Option(names = { "--health" }, defaultValue = "false",
-            description = "Deprecated: use --observe instead. Health check at 
/q/health on local HTTP server (port 8080 by default)")
-    boolean health;
-
-    @Deprecated
-    @Option(names = { "--metrics" }, defaultValue = "false",
-            description = "Deprecated: use --observe instead. Metrics 
(Micrometer and Prometheus) at /q/metrics on local HTTP server (port 8080 by 
default)")
-    boolean metrics;
-
-    @Option(names = { "--observe" }, defaultValue = "false",
-            description = "Enable observability services")
-    boolean observe;
+    // port, managementPort, console, health, metrics, observe options are in 
ServerOptions @ArgGroup
 
     @Option(names = { "--modeline" }, defaultValue = "true",
             description = "Whether to support JBang style //DEPS to specify 
additional dependencies")
@@ -640,10 +589,10 @@ public class Run extends CamelCommand {
         if (sourceDir != null) {
             writeSetting(main, profileProperties, SOURCE_DIR, sourceDir);
         }
-        if (trace) {
+        if (debugOptions.trace) {
             writeSetting(main, profileProperties, "camel.main.tracing", 
"true");
         }
-        if (backlogTrace) {
+        if (debugOptions.backlogTrace) {
             writeSetting(main, profileProperties, "camel.trace.enabled", 
"true");
         }
         if (modeline) {
@@ -670,9 +619,9 @@ public class Run extends CamelCommand {
         if (repositories != null) {
             writeSetting(main, profileProperties, REPOS, repositories);
         }
-        writeSetting(main, profileProperties, HEALTH, health ? "true" : 
"false");
-        writeSetting(main, profileProperties, METRICS, metrics ? "true" : 
"false");
-        writeSetting(main, profileProperties, CONSOLE, console ? "true" : 
"false");
+        writeSetting(main, profileProperties, HEALTH, serverOptions.health ? 
"true" : "false");
+        writeSetting(main, profileProperties, METRICS, serverOptions.metrics ? 
"true" : "false");
+        writeSetting(main, profileProperties, CONSOLE, serverOptions.console ? 
"true" : "false");
         writeSetting(main, profileProperties, VERBOSE, verbose ? "true" : 
"false");
         // the runtime version of Camel is what is loaded via the catalog
         writeSetting(main, profileProperties, CAMEL_VERSION, new 
DefaultCamelCatalog().getCatalogVersion());
@@ -723,23 +672,28 @@ public class Run extends CamelCommand {
         doAddInitialProperty(main);
 
         writeSetting(main, profileProperties, "camel.main.durationMaxMessages",
-                () -> maxMessages > 0 ? String.valueOf(maxMessages) : null);
+                () -> executionLimitOptions.maxMessages > 0
+                        ? String.valueOf(executionLimitOptions.maxMessages) : 
null);
         writeSetting(main, profileProperties, "camel.main.durationMaxSeconds",
-                () -> maxSeconds > 0 ? String.valueOf(maxSeconds) : null);
+                () -> executionLimitOptions.maxSeconds > 0
+                        ? String.valueOf(executionLimitOptions.maxSeconds) : 
null);
         writeSetting(main, profileProperties, 
"camel.main.durationMaxIdleSeconds",
-                () -> maxIdleSeconds > 0 ? String.valueOf(maxIdleSeconds) : 
null);
-        if (port != -1 && port != 8080) {
-            writeSetting(main, profileProperties, "camel.server.port", () -> 
String.valueOf(port));
+                () -> executionLimitOptions.maxIdleSeconds > 0
+                        ? String.valueOf(executionLimitOptions.maxIdleSeconds) 
: null);
+        if (serverOptions.port != -1 && serverOptions.port != 8080) {
+            writeSetting(main, profileProperties, "camel.server.port", () -> 
String.valueOf(serverOptions.port));
         }
-        if (port == 0 && managementPort == -1) {
+        if (serverOptions.port == 0 && serverOptions.managementPort == -1) {
             // use same port for management
-            managementPort = 0;
+            serverOptions.managementPort = 0;
         }
-        if (managementPort != -1 && managementPort != 8080) {
-            writeSetting(main, profileProperties, "camel.management.port", () 
-> String.valueOf(managementPort));
+        if (serverOptions.managementPort != -1 && serverOptions.managementPort 
!= 8080) {
+            writeSetting(main, profileProperties, "camel.management.port",
+                    () -> String.valueOf(serverOptions.managementPort));
         }
-        writeSetting(main, profileProperties, JFR, jfr || jfrProfile != null ? 
"jfr" : null);
-        writeSetting(main, profileProperties, JFR_PROFILE, jfrProfile != null 
? jfrProfile : null);
+        writeSetting(main, profileProperties, JFR, debugOptions.jfr || 
debugOptions.jfrProfile != null ? "jfr" : null);
+        writeSetting(main, profileProperties, JFR_PROFILE,
+                debugOptions.jfrProfile != null ? debugOptions.jfrProfile : 
null);
 
         writeSetting(main, profileProperties, KAMELETS_VERSION, 
kameletsVersion);
 
@@ -1007,7 +961,7 @@ public class Run extends CamelCommand {
             }
         }
 
-        if (observe) {
+        if (serverOptions.observe) {
             dependencies.add("camel:observability-services");
         }
         if (!dependencies.isEmpty()) {
@@ -1155,8 +1109,8 @@ public class Run extends CamelCommand {
         eq.files = this.files;
         eq.name = this.name;
         eq.verbose = this.verbose;
-        eq.port = this.port;
-        eq.managementPort = this.managementPort;
+        eq.port = this.serverOptions.port;
+        eq.managementPort = this.serverOptions.managementPort;
         eq.gav = this.gav;
         eq.runtime = this.runtime;
         if (eq.gav == null) {
@@ -1262,8 +1216,8 @@ public class Run extends CamelCommand {
         eq.files = this.files;
         eq.name = this.name;
         eq.verbose = this.verbose;
-        eq.port = this.port;
-        eq.managementPort = this.managementPort;
+        eq.port = this.serverOptions.port;
+        eq.managementPort = this.serverOptions.managementPort;
         eq.gav = this.gav;
         eq.repositories = this.repositories;
         eq.runtime = this.runtime;
@@ -1411,11 +1365,13 @@ public class Run extends CamelCommand {
         if (Files.exists(profilePropertiesPath)) {
             answer = loadProfilePropertiesFile(profilePropertiesPath);
             // logging level/color may be configured in the properties file
-            loggingLevel = answer.getProperty("loggingLevel", loggingLevel);
-            loggingColor
-                    = "true".equals(answer.getProperty("loggingColor", 
loggingColor ? "true" : "false"));
-            loggingJson
-                    = "true".equals(answer.getProperty("loggingJson", 
loggingJson ? "true" : "false"));
+            loggingOptions.loggingLevel = answer.getProperty("loggingLevel", 
loggingOptions.loggingLevel);
+            loggingOptions.loggingColor
+                    = "true"
+                            .equals(answer.getProperty("loggingColor", 
loggingOptions.loggingColor ? "true" : "false"));
+            loggingOptions.loggingJson
+                    = "true"
+                            .equals(answer.getProperty("loggingJson", 
loggingOptions.loggingJson ? "true" : "false"));
             repositories = answer.getProperty(REPOS, repositories);
             mavenSettings = answer.getProperty(MAVEN_SETTINGS, mavenSettings);
             mavenSettingsSecurity = 
answer.getProperty(MAVEN_SETTINGS_SECURITY, mavenSettingsSecurity);
@@ -1876,7 +1832,7 @@ public class Run extends CamelCommand {
     }
 
     private void configureLogging(Path baseDir) throws Exception {
-        if (logging) {
+        if (loggingOptions.logging) {
             // allow to configure individual logging levels in 
application.properties
             Properties prop = loadProfileProperties(baseDir);
             if (prop != null) {
@@ -1896,16 +1852,18 @@ public class Run extends CamelCommand {
                     key = StringHelper.removeLeadingAndEndingQuotes(key);
                     String line = key + "=" + value;
                     String line2 = key + " = " + value;
-                    if (!loggingCategory.contains(line) && 
!loggingCategory.contains(line2)) {
-                        loggingCategory.add(line);
+                    if (!loggingOptions.loggingCategory.contains(line)
+                            && 
!loggingOptions.loggingCategory.contains(line2)) {
+                        loggingOptions.loggingCategory.add(line);
                     }
                 }
             }
-            RuntimeUtil.configureLog(loggingLevel, loggingColor, loggingJson, 
scriptRun, false, loggingConfigPath,
-                    loggingCategory);
-            writeSettings("loggingLevel", loggingLevel);
-            writeSettings("loggingColor", loggingColor ? "true" : "false");
-            writeSettings("loggingJson", loggingJson ? "true" : "false");
+            RuntimeUtil.configureLog(loggingOptions.loggingLevel, 
loggingOptions.loggingColor,
+                    loggingOptions.loggingJson, scriptRun, false, 
loggingOptions.loggingConfigPath,
+                    loggingOptions.loggingCategory);
+            writeSettings("loggingLevel", loggingOptions.loggingLevel);
+            writeSettings("loggingColor", loggingOptions.loggingColor ? "true" 
: "false");
+            writeSettings("loggingJson", loggingOptions.loggingJson ? "true" : 
"false");
             if (!scriptRun) {
                 // remember log file
                 String name = RuntimeUtil.getPid() + ".log";
@@ -1922,8 +1880,8 @@ public class Run extends CamelCommand {
             }
         } else {
             if (exportRun) {
-                RuntimeUtil.configureLog(loggingLevel, false, false, false, 
true, null, null);
-                writeSettings("loggingLevel", loggingLevel);
+                RuntimeUtil.configureLog(loggingOptions.loggingLevel, false, 
false, false, true, null, null);
+                writeSettings("loggingLevel", loggingOptions.loggingLevel);
             } else {
                 RuntimeUtil.configureLog("off", false, false, false, false, 
null, null);
                 writeSettings("loggingLevel", "off");
@@ -2193,6 +2151,87 @@ public class Run extends CamelCommand {
         }
     }
 
+    static class LoggingOptions {
+        @Option(names = { "--logging" }, defaultValue = "true", description = 
"Can be used to turn off logging")
+        boolean logging = true;
+
+        @Option(names = { "--logging-level" }, completionCandidates = 
LoggingLevelCompletionCandidates.class,
+                defaultValue = "info", description = "Logging level 
(${COMPLETION-CANDIDATES})")
+        String loggingLevel;
+
+        @Option(names = { "--logging-color" }, defaultValue = "true", 
description = "Use colored logging")
+        boolean loggingColor = true;
+
+        @Option(names = { "--logging-json" }, defaultValue = "false", 
description = "Use JSON logging (ECS Layout)")
+        boolean loggingJson;
+
+        @Option(names = { "--logging-config-path" }, description = "Path to 
file with custom logging configuration")
+        String loggingConfigPath;
+
+        @Option(names = { "--logging-category" },
+                description = "Used for individual logging levels (ex: 
org.apache.kafka=DEBUG)")
+        List<String> loggingCategory = new ArrayList<>();
+    }
+
+    static class DebugOptions {
+        @Option(names = { "--jfr" }, defaultValue = "false",
+                description = "Enables Java Flight Recorder saving recording 
to disk on exit")
+        boolean jfr;
+
+        @Option(names = { "--jfr-profile" },
+                description = "Java Flight Recorder profile to use (such as 
default or profile)")
+        String jfrProfile;
+
+        @Option(names = { "--trace" }, defaultValue = "false",
+                description = "Enables trace logging of the routed messages")
+        boolean trace;
+
+        @Option(names = { "--backlog-trace" }, defaultValue = "false",
+                description = "Enables backlog tracing of the routed messages")
+        boolean backlogTrace;
+    }
+
+    static class ExecutionLimitOptions {
+        @Option(names = { "--max-messages" }, defaultValue = "0",
+                description = "Max number of messages to process before 
stopping")
+        int maxMessages;
+
+        @Option(names = { "--max-seconds" }, defaultValue = "0", description = 
"Max seconds to run before stopping")
+        int maxSeconds;
+
+        @Option(names = { "--max-idle-seconds" }, defaultValue = "0",
+                description = "For how long time in seconds Camel can be idle 
before stopping")
+        int maxIdleSeconds;
+    }
+
+    static class ServerOptions {
+        @Option(names = { "--port" },
+                description = "Embeds a local HTTP server on this port (port 
8080 by default; use 0 to dynamic assign a free random port number)")
+        int port = -1;
+
+        @Option(names = { "--management-port" },
+                description = "To use a dedicated port for HTTP management 
(use 0 to dynamic assign a free random port number)")
+        int managementPort = -1;
+
+        @Option(names = { "--console" }, defaultValue = "false",
+                description = "Developer console at /q/dev on local HTTP 
server (port 8080 by default)")
+        boolean console;
+
+        @Deprecated
+        @Option(names = { "--health" }, defaultValue = "false",
+                description = "Deprecated: use --observe instead. Health check 
at /q/health on local HTTP server (port 8080 by default)")
+        boolean health;
+
+        @Deprecated
+        @Option(names = { "--metrics" }, defaultValue = "false",
+                description = "Deprecated: use --observe instead. Metrics 
(Micrometer and Prometheus) at /q/metrics on local HTTP server (port 8080 by 
default)")
+        boolean metrics;
+
+        @Option(names = { "--observe" }, defaultValue = "false",
+                description = "Enable observability services")
+        boolean observe;
+    }
+
     static class FilesConsumer extends ParameterConsumer<Run> {
         @Override
         protected void doConsumeParameters(Stack<String> args, Run cmd) {
@@ -2240,7 +2279,7 @@ public class Run extends CamelCommand {
 
     @Override
     protected Printer printer() {
-        if (exportRun && (!logging && !verbose)) {
+        if (exportRun && (!loggingOptions.logging && !verbose)) {
             // Export run should be silent unless in logging or verbose mode
             if (quietPrinter == null) {
                 quietPrinter = new Printer.QuietPrinter(super.printer());
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 13244960fb55..17030493cf29 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
@@ -75,12 +75,12 @@ public class Script extends CamelCommand {
         }
 
         Run run = new Run(getMain());
-        run.logging = logging;
-        run.loggingLevel = loggingLevel;
-        run.loggingColor = false;
-        run.maxSeconds = maxSeconds;
-        run.maxMessages = maxMessages;
-        run.maxIdleSeconds = maxIdleSeconds;
+        run.loggingOptions.logging = logging;
+        run.loggingOptions.loggingLevel = loggingLevel;
+        run.loggingOptions.loggingColor = false;
+        run.executionLimitOptions.maxSeconds = maxSeconds;
+        run.executionLimitOptions.maxMessages = maxMessages;
+        run.executionLimitOptions.maxIdleSeconds = maxIdleSeconds;
         run.property = property;
         run.propertiesFiles = propertiesFiles;
         return run.runScript(file);
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 1c04f5f520ef..bf7dd0890bfd 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
@@ -107,7 +107,7 @@ public class TransformRoute extends CamelCommand {
             }
         };
         run.files = files;
-        run.maxSeconds = 1;
+        run.executionLimitOptions.maxSeconds = 1;
         Integer exit = run.runTransform(ignoreLoadingError);
         if (exit != null && exit != 0) {
             return exit;

Reply via email to