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 aad93441e4c camel-jbang - Add doc command
aad93441e4c is described below

commit aad93441e4cc096b61e2d5a5e1721ce926f774b5
Author: Claus Ibsen <[email protected]>
AuthorDate: Sun Sep 18 10:19:51 2022 +0200

    camel-jbang - Add doc command
---
 .../dsl/jbang/core/commands/catalog/CatalogDoc.java   | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

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 2d124c60f56..fd555a3601d 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
@@ -49,8 +49,13 @@ public class CatalogDoc extends CamelCommand {
                         description = "Filter option listed in tables by name, 
description, or group")
     String filter;
 
+    @CommandLine.Option(names = { "--header" },
+                        description = "Whether to display component message 
headers", defaultValue = "true")
+    boolean headers;
+
     // TODO: kamelet
     // TODO: endpoint uri to document the uri only
+    // TODO: header options
 
     final CamelCatalog catalog = new DefaultCamelCatalog(true);
 
@@ -158,6 +163,20 @@ public class CatalogDoc extends CamelCommand {
                         .with(r -> r.getShortDefaultValue(40)),
                 new 
Column().header("TYPE").dataAlign(HorizontalAlign.LEFT).with(BaseOptionModel::getShortJavaType))));
         System.out.println("");
+
+        if (headers && !cm.getEndpointHeaders().isEmpty()) {
+            System.out.printf("The %s component supports (total: %s) message 
headers, which are listed below.%n%n",
+                    cm.getName(), cm.getEndpointHeaders().size());
+            System.out.println(AsciiTable.getTable(AsciiTable.FANCY_ASCII, 
cm.getEndpointHeaders(), Arrays.asList(
+                    new 
Column().header("NAME").dataAlign(HorizontalAlign.LEFT).minWidth(20)
+                            .maxWidth(30, OverflowBehaviour.NEWLINE)
+                            .with(this::getName),
+                    new 
Column().header("DESCRIPTION").dataAlign(HorizontalAlign.LEFT).with(this::getDescription),
+                    new 
Column().header("DEFAULT").dataAlign(HorizontalAlign.LEFT).maxWidth(30, 
OverflowBehaviour.NEWLINE)
+                            .with(r -> r.getShortDefaultValue(40)),
+                    new 
Column().header("TYPE").dataAlign(HorizontalAlign.LEFT).with(BaseOptionModel::getShortJavaType))));
+            System.out.println("");
+        }
     }
 
     private void docDataFormat(DataFormatModel dm) {

Reply via email to