This is an automated email from the ASF dual-hosted git repository.
orpiske 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 5c778aa camel-jbang: fixed displaying the help argument on request
(#5851)
5c778aa is described below
commit 5c778aa2c4e51dde42a9a16ae980b96107d7177c
Author: Otavio Rodolfo Piske <[email protected]>
AuthorDate: Tue Jul 20 12:04:40 2021 +0200
camel-jbang: fixed displaying the help argument on request (#5851)
---
.../camel-jbang-main/dist/CamelJBang.java | 22 +++++++++++++++++++++-
.../src/main/jbang/main/CamelJBang.java | 22 +++++++++++++++++++++-
2 files changed, 42 insertions(+), 2 deletions(-)
diff --git a/dsl/camel-jbang/camel-jbang-main/dist/CamelJBang.java
b/dsl/camel-jbang/camel-jbang-main/dist/CamelJBang.java
index e213467..6fb1d5a 100755
--- a/dsl/camel-jbang/camel-jbang-main/dist/CamelJBang.java
+++ b/dsl/camel-jbang/camel-jbang-main/dist/CamelJBang.java
@@ -75,6 +75,9 @@ class Run implements Callable<Integer> {
@Parameters(description = "The path to the kamelet binding", arity = "1")
private String binding;
+ @Option(names = { "-h", "--help" }, usageHelp = true, description =
"Display the help and sub-commands")
+ private boolean helpRequested = false;
+
@Option(names = { "--debug-level" }, defaultValue = "info", description =
"Default debug level")
private String debugLevel;
@@ -149,6 +152,9 @@ class Run implements Callable<Integer> {
@Command(name = "search", description = "Search for kameletes, components and
patterns (use --help)")
class Search extends AbstractSearch implements Callable<Integer> {
+ @Option(names = { "-h", "--help" }, usageHelp = true, description =
"Display the help and sub-commands")
+ private boolean helpRequested = false;
+
public Search() {
super(null, null);
}
@@ -158,7 +164,7 @@ class Search extends AbstractSearch implements
Callable<Integer> {
@Override
public Integer call() throws Exception {
- CommandLine.usage(this, System.out);
+ new CommandLine(this).execute("--help");
return 0;
}
@@ -166,6 +172,7 @@ class Search extends AbstractSearch implements
Callable<Integer> {
@Command(name = "kamelets", description = "Search for a Kamelet in the Kamelet
catalog")
class SearchKamelets extends AbstractSearch implements Callable<Integer> {
+
/*
* Matches the following line. Separate them into groups and pick the last
* which contains the description:
@@ -174,6 +181,9 @@ class SearchKamelets extends AbstractSearch implements
Callable<Integer> {
*/
private static final Pattern PATTERN =
Pattern.compile("(.*):(.*):(.*)\\[(.*)\\[\\] (.*)\\]");
+ @Option(names = { "-h", "--help" }, usageHelp = true, description =
"Display the help and sub-commands")
+ private boolean helpRequested = false;
+
@Option(names = { "--search-term" }, defaultValue = "", description =
"Default debug level")
private String searchTerm;
@@ -209,6 +219,7 @@ class SearchKamelets extends AbstractSearch implements
Callable<Integer> {
@Command(name = "components", description = "Search for Camel Core components")
class SearchComponents extends AbstractSearch implements Callable<Integer> {
+
/*
* Matches the following line. Separate them into groups and pick the last
* which contains the description:
@@ -217,6 +228,9 @@ class SearchComponents extends AbstractSearch implements
Callable<Integer> {
*/
private static final Pattern PATTERN =
Pattern.compile("(.*):(.*)\\[(.*)\\]");
+ @Option(names = { "-h", "--help" }, usageHelp = true, description =
"Display the help and sub-commands")
+ private boolean helpRequested = false;
+
@Option(names = { "--search-term" }, defaultValue = "", description =
"Default debug level")
private String searchTerm;
@@ -259,6 +273,9 @@ class SearchLanguages extends AbstractSearch implements
Callable<Integer> {
*/
private static final Pattern PATTERN =
Pattern.compile("(.*):(.*)\\[(.*)\\]");
+ @Option(names = { "-h", "--help" }, usageHelp = true, description =
"Display the help and sub-commands")
+ private boolean helpRequested = false;
+
@Option(names = { "--search-term" }, defaultValue = "", description =
"Default debug level")
private String searchTerm;
@@ -301,6 +318,9 @@ class SearchOthers extends AbstractSearch implements
Callable<Integer> {
*/
private static final Pattern PATTERN =
Pattern.compile("(.*):(.*)\\[(.*)\\]");
+ @Option(names = { "-h", "--help" }, usageHelp = true, description =
"Display the help and sub-commands")
+ private boolean helpRequested = false;
+
@Option(names = { "--search-term" }, defaultValue = "", description =
"Default debug level")
private String searchTerm;
diff --git
a/dsl/camel-jbang/camel-jbang-main/src/main/jbang/main/CamelJBang.java
b/dsl/camel-jbang/camel-jbang-main/src/main/jbang/main/CamelJBang.java
index a3cee46..a39eb09 100755
--- a/dsl/camel-jbang/camel-jbang-main/src/main/jbang/main/CamelJBang.java
+++ b/dsl/camel-jbang/camel-jbang-main/src/main/jbang/main/CamelJBang.java
@@ -75,6 +75,9 @@ class Run implements Callable<Integer> {
@Parameters(description = "The path to the kamelet binding", arity = "1")
private String binding;
+ @Option(names = { "-h", "--help" }, usageHelp = true, description =
"Display the help and sub-commands")
+ private boolean helpRequested = false;
+
@Option(names = { "--debug-level" }, defaultValue = "info", description =
"Default debug level")
private String debugLevel;
@@ -149,6 +152,9 @@ class Run implements Callable<Integer> {
@Command(name = "search", description = "Search for kameletes, components and
patterns (use --help)")
class Search extends AbstractSearch implements Callable<Integer> {
+ @Option(names = { "-h", "--help" }, usageHelp = true, description =
"Display the help and sub-commands")
+ private boolean helpRequested = false;
+
public Search() {
super(null, null);
}
@@ -158,7 +164,7 @@ class Search extends AbstractSearch implements
Callable<Integer> {
@Override
public Integer call() throws Exception {
- CommandLine.usage(this, System.out);
+ new CommandLine(this).execute("--help");
return 0;
}
@@ -166,6 +172,7 @@ class Search extends AbstractSearch implements
Callable<Integer> {
@Command(name = "kamelets", description = "Search for a Kamelet in the Kamelet
catalog")
class SearchKamelets extends AbstractSearch implements Callable<Integer> {
+
/*
* Matches the following line. Separate them into groups and pick the last
* which contains the description:
@@ -174,6 +181,9 @@ class SearchKamelets extends AbstractSearch implements
Callable<Integer> {
*/
private static final Pattern PATTERN =
Pattern.compile("(.*):(.*):(.*)\\[(.*)\\[\\] (.*)\\]");
+ @Option(names = { "-h", "--help" }, usageHelp = true, description =
"Display the help and sub-commands")
+ private boolean helpRequested = false;
+
@Option(names = { "--search-term" }, defaultValue = "", description =
"Default debug level")
private String searchTerm;
@@ -209,6 +219,7 @@ class SearchKamelets extends AbstractSearch implements
Callable<Integer> {
@Command(name = "components", description = "Search for Camel Core components")
class SearchComponents extends AbstractSearch implements Callable<Integer> {
+
/*
* Matches the following line. Separate them into groups and pick the last
* which contains the description:
@@ -217,6 +228,9 @@ class SearchComponents extends AbstractSearch implements
Callable<Integer> {
*/
private static final Pattern PATTERN =
Pattern.compile("(.*):(.*)\\[(.*)\\]");
+ @Option(names = { "-h", "--help" }, usageHelp = true, description =
"Display the help and sub-commands")
+ private boolean helpRequested = false;
+
@Option(names = { "--search-term" }, defaultValue = "", description =
"Default debug level")
private String searchTerm;
@@ -259,6 +273,9 @@ class SearchLanguages extends AbstractSearch implements
Callable<Integer> {
*/
private static final Pattern PATTERN =
Pattern.compile("(.*):(.*)\\[(.*)\\]");
+ @Option(names = { "-h", "--help" }, usageHelp = true, description =
"Display the help and sub-commands")
+ private boolean helpRequested = false;
+
@Option(names = { "--search-term" }, defaultValue = "", description =
"Default debug level")
private String searchTerm;
@@ -301,6 +318,9 @@ class SearchOthers extends AbstractSearch implements
Callable<Integer> {
*/
private static final Pattern PATTERN =
Pattern.compile("(.*):(.*)\\[(.*)\\]");
+ @Option(names = { "-h", "--help" }, usageHelp = true, description =
"Display the help and sub-commands")
+ private boolean helpRequested = false;
+
@Option(names = { "--search-term" }, defaultValue = "", description =
"Default debug level")
private String searchTerm;