You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by "sk-reddy17 (via GitHub)" <gi...@apache.org> on 2026/06/27 15:44:55 UTC
[PR] CAMEL-23654: camel-jbang - group commands in --help output by categor… [camel]
sk-reddy17 opened a new pull request, #24276:
URL: https://github.com/apache/camel/pull/24276
The `camel --help` output lists 40+ commands in one flat alphabetical list,
which is hard to scan. This groups them into categories (Running, Monitoring,
Actions, Development, Configuration, Catalog, AI) so it's easier to find what
you need.
Done with a small picocli `IHelpSectionRenderer` wired into `CamelJBangMain`.
Anything not mapped to a group falls into "Other", so no command gets dropped.
Fixes https://issues.apache.org/jira/browse/CAMEL-23654
## Example
Commands:
Running:
run Run as local Camel integration
dev Run in dev mode with live reload
stop Shuts down running Camel integrations
Monitoring:
get Get status of Camel integrations
top Top status of Camel integrations
Configuration:
config Get and set user configuration values
Catalog:
catalog List artifacts from Camel Catalog
AI:
ask Ask a question about a running Camel application using AI
...
## Test plan
- [x] Test checks all the category headers show up in `--help`
- [x] Test checks the key commands (run, get, config, catalog) are still listed
- [x] Ran `camel --help` by hand to confirm it looks right
--
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: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] CAMEL-23654: camel-jbang - group commands in --help output by categor… [camel]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #24276:
URL: https://github.com/apache/camel/pull/24276#issuecomment-4819908490
:star2: Thank you for your contribution to the Apache Camel project! :star2:
:robot: CI automation will test this PR automatically.
:camel: Apache Camel Committers, please review the following items:
* First-time contributors **require MANUAL approval** for the GitHub Actions to run
* You can use the command `/component-test (camel-)component-name1 (camel-)component-name2..` to request a test from the test bot although they are normally detected and executed by CI.
* You can label PRs using `skip-tests` and `test-dependents` to fine-tune the checks executed by this PR.
* Build and test logs are available in the summary page. **Only** [Apache Camel committers](https://camel.apache.org/community/team/#committers) have access to the summary.
:warning: Be careful when sharing logs. Review their contents before sharing them publicly.
--
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: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] CAMEL-23654: camel-jbang - group commands in --help output by categor… [camel]
Posted by "davsclaus (via GitHub)" <gi...@apache.org>.
davsclaus commented on code in PR #24276:
URL: https://github.com/apache/camel/pull/24276#discussion_r3486621018
##########
dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/GroupedCommandHelpRenderer.java:
##########
@@ -0,0 +1,95 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.dsl.jbang.core.commands;
+
+import java.util.ArrayList;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+
+import picocli.CommandLine;
+
+/**
+ * Renders the camel CLI subcommand list grouped by functional category, replacing the default flat alphabetical list.
+ */
+public class GroupedCommandHelpRenderer implements CommandLine.IHelpSectionRenderer {
+
+ private static final Map<String, List<String>> GROUPS = new LinkedHashMap<>();
+
+ static {
+ GROUPS.put("Running", List.of("run", "dev", "stop", "restart", "ps", "log", "shell", "script"));
+ GROUPS.put("Monitoring", List.of("get", "top", "trace", "hawtio", "jolokia"));
+ GROUPS.put("Actions", List.of("cmd", "bind"));
+ GROUPS.put("Development",
+ List.of("init", "export", "debug", "eval", "explain", "transform", "dirty", "doctor", "sbom", "nano"));
+ GROUPS.put("Configuration", List.of("config", "dependency", "version", "update", "wrapper", "completion", "plugin"));
+ GROUPS.put("Catalog", List.of("catalog", "doc", "infra"));
+ GROUPS.put("AI", List.of("ask", "harden"));
+ }
+
+ @Override
+ public String render(CommandLine.Help help) {
+ Map<String, CommandLine> subcommands = help.commandSpec().subcommands();
+ if (subcommands.isEmpty()) {
+ return "";
+ }
+
+ int nameWidth = subcommands.keySet().stream().mapToInt(String::length).max().orElse(10);
+
+ List<String> assigned = new ArrayList<>();
+ StringBuilder sb = new StringBuilder();
+
Review Comment:
Minor: the default picocli renderer skips commands with `hidden = true`. Consider adding a guard here and in the ungrouped loop below:
```suggestion
if (sub != null) {
if (!sub.getCommandSpec().usageMessage().hidden()) {
present.add(sub);
}
assigned.add(name);
```
This way hidden commands are still tracked as "assigned" (so they don't leak into "Other") but won't be rendered.
##########
dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/GroupedCommandHelpRenderer.java:
##########
@@ -0,0 +1,95 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.dsl.jbang.core.commands;
+
+import java.util.ArrayList;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+
+import picocli.CommandLine;
+
+/**
+ * Renders the camel CLI subcommand list grouped by functional category, replacing the default flat alphabetical list.
+ */
+public class GroupedCommandHelpRenderer implements CommandLine.IHelpSectionRenderer {
+
+ private static final Map<String, List<String>> GROUPS = new LinkedHashMap<>();
+
+ static {
+ GROUPS.put("Running", List.of("run", "dev", "stop", "restart", "ps", "log", "shell", "script"));
+ GROUPS.put("Monitoring", List.of("get", "top", "trace", "hawtio", "jolokia"));
+ GROUPS.put("Actions", List.of("cmd", "bind"));
+ GROUPS.put("Development",
+ List.of("init", "export", "debug", "eval", "explain", "transform", "dirty", "doctor", "sbom", "nano"));
+ GROUPS.put("Configuration", List.of("config", "dependency", "version", "update", "wrapper", "completion", "plugin"));
+ GROUPS.put("Catalog", List.of("catalog", "doc", "infra"));
+ GROUPS.put("AI", List.of("ask", "harden"));
+ }
+
+ @Override
+ public String render(CommandLine.Help help) {
+ Map<String, CommandLine> subcommands = help.commandSpec().subcommands();
+ if (subcommands.isEmpty()) {
+ return "";
+ }
+
+ int nameWidth = subcommands.keySet().stream().mapToInt(String::length).max().orElse(10);
+
+ List<String> assigned = new ArrayList<>();
+ StringBuilder sb = new StringBuilder();
+
+ for (Map.Entry<String, List<String>> entry : GROUPS.entrySet()) {
+ List<CommandLine> present = new ArrayList<>();
+ for (String name : entry.getValue()) {
+ CommandLine sub = subcommands.get(name);
+ if (sub != null) {
+ present.add(sub);
+ assigned.add(name);
+ }
+ }
+ if (!present.isEmpty()) {
+ sb.append(String.format("%n %s:%n", entry.getKey()));
+ for (CommandLine sub : present) {
+ appendCommand(sb, sub, nameWidth);
Review Comment:
Same hidden-command concern here — ungrouped commands from plugins could be hidden:
```suggestion
if (!assigned.contains(entry.getKey()) && !entry.getValue().getCommandSpec().usageMessage().hidden()) {
```
--
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: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] CAMEL-23654: camel-jbang - group commands in --help output by categor… [camel]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #24276:
URL: https://github.com/apache/camel/pull/24276#issuecomment-4820094915
<!-- ci-tested-modules -->
:test_tube: **CI tested the following changed modules:**
- `dsl/camel-jbang/camel-jbang-core`
:warning: **Some tests are disabled on GitHub Actions** (`@DisabledIfSystemProperty(named = "ci.env.name")`) and require manual verification:
- `dsl/camel-jbang/camel-jbang-core`: 1 test(s) disabled on GitHub Actions
:bulb: **Manual integration tests recommended:**
> You modified `dsl/camel-jbang/camel-jbang-core`. The related integration tests in `dsl/camel-jbang/camel-jbang-it` are excluded from CI. Consider running them manually:
> ```
> mvn verify -f dsl/camel-jbang/camel-jbang-it -Djbang-it-test
> ```
<details><summary>All tested modules (6 modules)</summary>
- Camel :: JBang :: Core
- Camel :: JBang :: MCP
- Camel :: JBang :: Plugin :: Route Parser
- Camel :: JBang :: Plugin :: TUI
- Camel :: JBang :: Plugin :: Validate
- Camel :: Launcher :: Container
</details>
---
:gear: [View full build and test results](https://github.com/apache/camel/actions/runs/28293959001)
--
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: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] CAMEL-23654: camel-jbang - group commands in --help output by categor… [camel]
Posted by "davsclaus (via GitHub)" <gi...@apache.org>.
davsclaus merged PR #24276:
URL: https://github.com/apache/camel/pull/24276
--
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: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org