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

commit bf033bbea00afd0c23d99ad77ffe5c9338fd567c
Author: Claus Ibsen <claus.ib...@gmail.com>
AuthorDate: Sun Sep 25 13:50:25 2022 +0200

    camel-jbang - Polished
---
 .../jbang/core/commands/process/CamelRouteStatus.java | 19 +++++++++++++++++--
 1 file changed, 17 insertions(+), 2 deletions(-)

diff --git 
a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/process/CamelRouteStatus.java
 
b/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/process/CamelRouteStatus.java
index cd625ef63a5..002476c4225 100644
--- 
a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/process/CamelRouteStatus.java
+++ 
b/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/process/CamelRouteStatus.java
@@ -46,6 +46,10 @@ public class CamelRouteStatus extends ProcessBaseCommand {
                         description = "Prefer to display source filename/code 
instead of IDs")
     boolean source;
 
+    @CommandLine.Option(names = { "--short-uri" },
+                        description = "List endpoint URI without query 
parameters (short)")
+    boolean shortUri;
+
     @CommandLine.Option(names = { "--limit" },
                         description = "Filter routes by limiting to the given 
number of rows")
     int limit;
@@ -161,11 +165,11 @@ public class CamelRouteStatus extends ProcessBaseCommand {
                 new 
Column().header("ID").dataAlign(HorizontalAlign.LEFT).maxWidth(25, 
OverflowBehaviour.ELLIPSIS_RIGHT)
                         .with(this::getId),
                 new 
Column().header("FROM").dataAlign(HorizontalAlign.LEFT).maxWidth(40, 
OverflowBehaviour.ELLIPSIS_RIGHT)
-                        .with(r -> r.from),
+                        .with(this::getFrom),
                 new 
Column().header("STATUS").headerAlign(HorizontalAlign.CENTER)
                         .with(r -> r.state),
                 new 
Column().header("AGE").headerAlign(HorizontalAlign.CENTER).with(r -> r.age),
-                new 
Column().header("COVER").dataAlign(HorizontalAlign.CENTER).with(this::getCoverage),
+                new Column().header("COVER").with(this::getCoverage),
                 new Column().header("MSG/S").with(this::getThroughput),
                 new Column().header("TOTAL").with(r -> r.total),
                 new Column().header("FAIL").with(r -> r.failed),
@@ -195,6 +199,17 @@ public class CamelRouteStatus extends ProcessBaseCommand {
         }
     }
 
+    private String getFrom(Row r) {
+        String u = r.from;
+        if (shortUri) {
+            int pos = u.indexOf('?');
+            if (pos > 0) {
+                u = u.substring(0, pos);
+            }
+        }
+        return u;
+    }
+
     protected String getSinceLast(Row r) {
         String s1 = r.sinceLastStarted != null ? r.sinceLastStarted : "-";
         String s2 = r.sinceLastCompleted != null ? r.sinceLastCompleted : "-";

Reply via email to