[
https://issues.apache.org/jira/browse/ARTEMIS-4372?focusedWorklogId=873368&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-873368
]
ASF GitHub Bot logged work on ARTEMIS-4372:
-------------------------------------------
Author: ASF GitHub Bot
Created on: 27/Jul/23 16:17
Start Date: 27/Jul/23 16:17
Worklog Time Spent: 10m
Work Description: clebertsuconic commented on code in PR #4565:
URL: https://github.com/apache/activemq-artemis/pull/4565#discussion_r1276523807
##########
artemis-cli/src/main/java/org/apache/activemq/artemis/cli/Artemis.java:
##########
@@ -194,62 +186,102 @@ public static Object execute(boolean inputEnabled,
boolean useSystemOut, File ar
* Useful on test cases
*/
private static Object internalExecute(File artemisHome, File
artemisInstance, File etcFolder, String[] args) throws Exception {
- return internalExecute(artemisHome, artemisInstance, etcFolder, args,
ActionContext.system());
+ return internalExecute(artemisHome, artemisInstance, etcFolder, args,
new ActionContext());
}
public static Object internalExecute(File artemisHome, File
artemisInstance, File etcFolder, String[] args, ActionContext context) throws
Exception {
- Action action = builder(artemisInstance).build().parse(args);
- action.setHomeValues(artemisHome, artemisInstance, etcFolder);
+ boolean isInstance = artemisInstance != null ||
System.getProperty("artemis.instance") != null;
+ CommandLine commandLine = buildCommand(isInstance, !isInstance);
+
+ Object userObject = parseAction(commandLine, args);
+ if (userObject instanceof Action) {
+ Action action = (Action) userObject;
+ action.setHomeValues(artemisHome, artemisInstance, etcFolder);
+ if (action.isVerbose()) {
+ context.out.print("Executing " + action.getClass().getName() + "
");
+ for (String arg : args) {
+ context.out.print(arg + " ");
+ }
+ context.out.println();
+ context.out.println("Home::" + action.getBrokerHome() + ",
Instance::" + action.getBrokerInstance());
+ }
- if (action.isVerbose()) {
- context.out.print("Executing " + action.getClass().getName() + " ");
- for (String arg : args) {
- context.out.print(arg + " ");
+ return action.execute(context);
+ } else {
+ if (userObject instanceof Runnable) {
+ ((Runnable) userObject).run();
+ }
Review Comment:
we shouldn't really add anything to do the CommandLine that's not a Runnable
or an Action. But I will add a check.
That should prevent future devs from making a mistake.
Issue Time Tracking
-------------------
Worklog Id: (was: 873368)
Time Spent: 1h (was: 50m)
> Move CLI framework to picocli and implement auto-complete
> ---------------------------------------------------------
>
> Key: ARTEMIS-4372
> URL: https://issues.apache.org/jira/browse/ARTEMIS-4372
> Project: ActiveMQ Artemis
> Issue Type: New Feature
> Reporter: Clebert Suconic
> Assignee: Clebert Suconic
> Priority: Major
> Fix For: 2.31.0
>
> Time Spent: 1h
> Remaining Estimate: 0h
>
--
This message was sent by Atlassian Jira
(v8.20.10#820010)