atiaomar1978-hub commented on code in PR #25514:
URL: https://github.com/apache/camel/pull/25514#discussion_r3792989251


##########
dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/TuiCommand.java:
##########
@@ -71,6 +86,17 @@ public TuiCommand(CamelJBangMain main, ClassLoader 
classLoader) {
 
     @Override
     public Integer doCall() throws Exception {
+        CamelMonitor cmd = new CamelMonitor(getMain(), classLoader);
+        return new 
CommandLine(cmd).execute(buildArgs().toArray(String[]::new));
+    }
+
+    /**
+     * Builds the {@link CamelMonitor} command line this command delegates to.
+     * <p>
+     * Every option declared here must be forwarded, otherwise the option is 
silently accepted and then ignored. Only
+     * non-default values are passed on, so the delegate keeps applying its 
own defaults.
+     */
+    List<String> buildArgs() {

Review Comment:
   **Resolved** — `buildArgs()` now forwards all three recording tuning flags 
to `CamelMonitor`, and `TuiCommandRecordOptionsTest` pins the wiring so the 
documented `camel tui --record-size=160x44` path keeps working. Nice refactor 
extracting `buildArgs()` for testability.



##########
dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/CamelMonitor.java:
##########
@@ -184,6 +213,68 @@ public CamelMonitor(CamelJBangMain main, ClassLoader 
classLoader) {
         this.classLoader = classLoader;
     }
 
+    /**
+     * Parses a {@code --record-size} value such as {@code 160x44} into {@code 
[cols, rows]}.
+     */
+    int[] parseRecordSize(String size) {
+        String[] parts = size == null ? new String[0] : 
size.toLowerCase(Locale.ROOT).split("x", -1);
+        if (parts.length == 2) {
+            try {
+                int cols = Integer.parseInt(parts[0].trim());
+                int rows = Integer.parseInt(parts[1].trim());
+                if (cols > 0 && rows > 0) {
+                    return new int[] { cols, rows };
+                }
+            } catch (NumberFormatException e) {
+                // fall through to the parameter error below
+            }
+        }
+        throw new CommandLine.ParameterException(
+                new CommandLine(this),
+                "Invalid value for option '--record-size': expected 
'<cols>x<rows>' with positive numbers, was '"
+                                       + size + "'");
+    }
+
+    /**
+     * Hands the {@code --record*} options to TamboUI through the {@link 
#RECORD_PROPERTIES} system properties, which is
+     * the only way TamboUI accepts a recording configuration.
+     */
+    void configureRecording() {
+        if (record == null) {
+            return;
+        }
+        if (web) {

Review Comment:
   **Resolved** — rejecting `--web` + `--record` up front is the right call 
given JVM-wide `tamboui.record*` properties. Upgrade-guide entry documents the 
behaviour change for upgraders.



##########
dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/CamelMonitor.java:
##########
@@ -649,6 +731,10 @@ public void resetIntegrationTabState() {
             }
             deleteMcpJson(mcpJsonFile);
             this.runner = null;
+            if (record != null) {

Review Comment:
   **Resolved** — `clearRecordingProperties()` in `finally` paired with the 
`RECORD_PROPERTIES` constant keeps set/clear in sync. The javadoc explaining 
why clearing is safe after `RecordingConfig.load()` is helpful.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to