Shell: add 'start' as an alias for 'flow start'.

This commit is contained in:
Mike Hearn 2017-04-25 15:14:34 +02:00
parent b6fa7095e3
commit aed9495b37
3 changed files with 22 additions and 1 deletions

View File

@ -26,6 +26,10 @@ public class FlowShellCommand extends InteractiveShellCommand {
@Usage("The class name of the flow to run, or an unambiguous substring") @Argument String name,
@Usage("The data to pass as input") @Argument(unquote = false) List<String> input
) {
startFlow(name, input, out);
}
static void startFlow(@Usage("The class name of the flow to run, or an unambiguous substring") @Argument String name, @Usage("The data to pass as input") @Argument(unquote = false) List<String> input, RenderPrintWriter out) {
if (name == null) {
out.println("You must pass a name for the flow, see 'man flow'", Color.red);
return;

View File

@ -0,0 +1,16 @@
package net.corda.node.shell;
// A simple forwarded to the "flow start" command, for easier typing.
import org.crsh.cli.*;
import java.util.*;
public class StartShellCommand extends InteractiveShellCommand {
@Command
@Man("An alias for 'flow start'. Example: \"start Yo target: Some other company\"")
public void main(@Usage("The class name of the flow to run, or an unambiguous substring") @Argument String name,
@Usage("The data to pass as input") @Argument(unquote = false) List<String> input) {
FlowShellCommand.startFlow(name, input, out);
}
}

View File

@ -102,7 +102,8 @@ object InteractiveShell {
}
ExternalResolver.INSTANCE.addCommand("run", "Runs a method from the CordaRPCOps interface on the node.", RunShellCommand::class.java)
ExternalResolver.INSTANCE.addCommand("flow", "Start a (work)flow on the node. This is how you can change the ledger.", FlowShellCommand::class.java)
ExternalResolver.INSTANCE.addCommand("flow", "Commands to work with flows. Flows are how you can change the ledger.", FlowShellCommand::class.java)
ExternalResolver.INSTANCE.addCommand("start", "An alias for 'flow start'", StartShellCommand::class.java)
val shell = ShellLifecycle(dir).start(config)
if (runSSH) {