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 d7807796f23 CAMEL-18029: camel-jbang - Uber Jar - Specify custom 
properties file to override what was packaged
d7807796f23 is described below

commit d7807796f2381a4fe5cdad7d780248ee48028e69
Author: Claus Ibsen <claus.ib...@gmail.com>
AuthorDate: Mon May 2 13:35:31 2022 +0200

    CAMEL-18029: camel-jbang - Uber Jar - Specify custom properties file to 
override what was packaged
---
 .../java/org/apache/camel/main/KameletMain.java    | 28 ++++++++++++++++++++--
 1 file changed, 26 insertions(+), 2 deletions(-)

diff --git 
a/dsl/camel-kamelet-main/src/main/java/org/apache/camel/main/KameletMain.java 
b/dsl/camel-kamelet-main/src/main/java/org/apache/camel/main/KameletMain.java
index 7bc92211011..3752aa40728 100644
--- 
a/dsl/camel-kamelet-main/src/main/java/org/apache/camel/main/KameletMain.java
+++ 
b/dsl/camel-kamelet-main/src/main/java/org/apache/camel/main/KameletMain.java
@@ -17,6 +17,7 @@
 package org.apache.camel.main;
 
 import java.lang.management.ManagementFactory;
+import java.util.LinkedList;
 import java.util.Map;
 import java.util.Objects;
 
@@ -54,8 +55,7 @@ public class KameletMain extends MainCommandLineSupport {
 
     public static void main(String... args) throws Exception {
         KameletMain main = new KameletMain();
-        main.run(); // run without args as they are for legacy camel-main
-        int code = main.getExitCode();;
+        int code = main.run(args);
         if (code != 0) {
             System.exit(code);
         }
@@ -129,6 +129,30 @@ public class KameletMain extends MainCommandLineSupport {
     // Implementation methods
     // 
-------------------------------------------------------------------------
 
+    @Override
+    public void showOptionsHeader() {
+        System.out.println("Apache Camel (KameletMain) takes the following 
options");
+        System.out.println();
+    }
+
+    @Override
+    protected void addInitialOptions() {
+        addOption(new Option("h", "help", "Displays the help screen") {
+            protected void doProcess(String arg, LinkedList<String> 
remainingArgs) {
+                showOptions();
+                completed();
+            }
+        });
+        addOption(new ParameterOption("download", "download", "Whether to 
allow automatic downloaded JAR dependencies, over the internet.", "download") {
+            @Override
+            protected void doProcess(String arg, String parameter, 
LinkedList<String> remainingArgs) {
+                if (arg.equals("-download")) {
+                    setDownload("true".equalsIgnoreCase(parameter));
+                }
+            }
+        });
+    }
+
     @Override
     protected void doInit() throws Exception {
         super.doInit();

Reply via email to