Skip to content

Commit

Permalink
Invoke command fix
Browse files Browse the repository at this point in the history
  • Loading branch information
pvlasov committed Oct 7, 2024
1 parent e68c51b commit 3b048b1
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
4 changes: 3 additions & 1 deletion cli/src/main/java/module-info.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import org.nasdanika.capability.CapabilityFactory;
import org.nasdanika.cli.DrawioCommandFactory;
import org.nasdanika.cli.HelpCommandFactory;
import org.nasdanika.cli.InvokeCommandFactory;
import org.nasdanika.cli.ModelCommandFactory;
import org.nasdanika.cli.RootCommandFactory;
import org.nasdanika.cli.SaveModelCommandFactory;
Expand All @@ -22,6 +23,7 @@
HelpCommandFactory,
DrawioCommandFactory,
ModelCommandFactory,
SaveModelCommandFactory;
SaveModelCommandFactory,
InvokeCommandFactory;

}
10 changes: 3 additions & 7 deletions cli/src/main/java/org/nasdanika/cli/InvokeCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
import org.nasdanika.common.NasdanikaException;
import org.nasdanika.common.ProgressMonitor;

import picocli.CommandLine;
import picocli.CommandLine.Command;
import picocli.CommandLine.Mixin;
import picocli.CommandLine.Option;
Expand Down Expand Up @@ -52,7 +51,7 @@ public InvokeCommand(CapabilityLoader capablityLoader) {
private PropertiesMixIn propertiesMixIn;

@ParentCommand
CommandLine parentCommand;
Invocable.Invoker parentCommand;

@Mixin
private ProgressMonitorMixIn progressMonitorMixIn;
Expand Down Expand Up @@ -110,11 +109,8 @@ protected Invocable getInvocable() {
@Override
public Integer call() throws Exception {
if (parentCommand != null) {
Object puo = parentCommand.getCommandSpec().userObject();
if (puo instanceof Invocable.Invoker) {
((Invocable.Invoker) puo).invoke(getInvocable());
return 0;
}
((Invocable.Invoker) parentCommand).invoke(getInvocable());
return 0;
}
getInvocable().invoke();
return 0;
Expand Down

0 comments on commit 3b048b1

Please sign in to comment.