From da3adb40b4e9d3d6cb5cf91ef2eec6b4c9a9585a Mon Sep 17 00:00:00 2001 From: jakubbielawa Date: Mon, 2 Mar 2020 11:14:55 +0000 Subject: [PATCH] ENT-5039 Improved help text for commands (#6006) * Improved help text for commands * Address feedback --- build.gradle | 2 +- .../net/corda/tools/shell/AttachmentShellCommand.java | 2 ++ .../net/corda/tools/shell/CheckpointShellCommand.java | 2 ++ .../main/java/net/corda/tools/shell/FlowShellCommand.java | 8 ++++++-- .../net/corda/tools/shell/HashLookupShellCommand.java | 6 +++++- .../java/net/corda/tools/shell/OutputFormatCommand.java | 1 + 6 files changed, 17 insertions(+), 4 deletions(-) diff --git a/build.gradle b/build.gradle index 3db5d81af9..b43b778053 100644 --- a/build.gradle +++ b/build.gradle @@ -104,7 +104,7 @@ buildscript { ext.dependency_checker_version = '5.2.0' ext.commons_collections_version = '4.3' ext.beanutils_version = '1.9.3' - ext.crash_version = '1.7.2' + ext.crash_version = '1.7.4' ext.jsr305_version = constants.getProperty("jsr305Version") ext.shiro_version = '1.4.1' ext.artifactory_plugin_version = constants.getProperty('artifactoryPluginVersion') diff --git a/tools/shell/src/main/java/net/corda/tools/shell/AttachmentShellCommand.java b/tools/shell/src/main/java/net/corda/tools/shell/AttachmentShellCommand.java index 1e58eb1c9c..ec075e38fb 100644 --- a/tools/shell/src/main/java/net/corda/tools/shell/AttachmentShellCommand.java +++ b/tools/shell/src/main/java/net/corda/tools/shell/AttachmentShellCommand.java @@ -2,6 +2,7 @@ package net.corda.tools.shell; import org.crsh.cli.Command; import org.crsh.cli.Man; +import org.crsh.cli.Usage; import static net.corda.tools.shell.InteractiveShell.runAttachmentTrustInfoView; @@ -9,6 +10,7 @@ public class AttachmentShellCommand extends InteractiveShellCommand { @Command @Man("Displays the trusted CorDapp attachments that have been manually installed or received over the network") + @Usage("Displays the trusted CorDapp attachments that have been manually installed or received over the network") public void trustInfo() { runAttachmentTrustInfoView(out, ops()); } diff --git a/tools/shell/src/main/java/net/corda/tools/shell/CheckpointShellCommand.java b/tools/shell/src/main/java/net/corda/tools/shell/CheckpointShellCommand.java index 8c0f50666c..19b5e99a53 100644 --- a/tools/shell/src/main/java/net/corda/tools/shell/CheckpointShellCommand.java +++ b/tools/shell/src/main/java/net/corda/tools/shell/CheckpointShellCommand.java @@ -2,6 +2,7 @@ package net.corda.tools.shell; import org.crsh.cli.Command; import org.crsh.cli.Man; +import org.crsh.cli.Usage; import static net.corda.tools.shell.InteractiveShell.*; @@ -9,6 +10,7 @@ public class CheckpointShellCommand extends InteractiveShellCommand { @Command @Man("Outputs the contents of all checkpoints as json to be manually reviewed") + @Usage("Outputs the contents of all checkpoints as json to be manually reviewed") public void dump() { runDumpCheckpoints(ops()); } diff --git a/tools/shell/src/main/java/net/corda/tools/shell/FlowShellCommand.java b/tools/shell/src/main/java/net/corda/tools/shell/FlowShellCommand.java index a99c767e54..d0120ed36f 100644 --- a/tools/shell/src/main/java/net/corda/tools/shell/FlowShellCommand.java +++ b/tools/shell/src/main/java/net/corda/tools/shell/FlowShellCommand.java @@ -31,7 +31,11 @@ public class FlowShellCommand extends InteractiveShellCommand { private static final Logger logger = LoggerFactory.getLogger(FlowShellCommand.class); @Command - @Usage("Start a (work)flow on the node. This is how you can change the ledger.") + @Usage("Start a (work)flow on the node. This is how you can change the ledger.\n\n" + + "\t\t Starting flow is the primary way in which you command the node to change the ledger.\n" + + "\t\t This command is generic, so the right way to use it depends on the flow you wish to start. You can use the 'flow start'\n" + + "\t\t command with either a full class name, or a substring of the class name that's unambiguous. The parameters to the\n" + + "\t\t flow constructors (the right one is picked automatically) are then specified using the same syntax as for the run command.\n") public void start( @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 input @@ -55,7 +59,7 @@ public class FlowShellCommand extends InteractiveShellCommand { ANSIProgressRenderer ansiProgressRenderer, ObjectMapper om) { if (name == null) { - out.println("You must pass a name for the flow, see 'man flow'", Decoration.bold, Color.red); + out.println("You must pass a name for the flow. Example: \"start Yo target: Some other company\"", Decoration.bold, Color.red); return; } String inp = input == null ? "" : String.join(" ", input).trim(); diff --git a/tools/shell/src/main/java/net/corda/tools/shell/HashLookupShellCommand.java b/tools/shell/src/main/java/net/corda/tools/shell/HashLookupShellCommand.java index 53b7c147d4..79cf1ee273 100644 --- a/tools/shell/src/main/java/net/corda/tools/shell/HashLookupShellCommand.java +++ b/tools/shell/src/main/java/net/corda/tools/shell/HashLookupShellCommand.java @@ -28,7 +28,11 @@ public class HashLookupShellCommand extends InteractiveShellCommand { logger.info("Executing command \"hashLookup\"."); if (txIdHash == null) { - out.println("Please provide a hexadecimal transaction Id hash value, see 'man hashLookup'", Decoration.bold, Color.red); + out.println("Checks if a transaction matching a specified Id hash value is recorded on this node.\n\n" + + "This is mainly intended to be used for troubleshooting notarisation issues when a\n" + + "state is claimed to be already consumed by another transaction.\n\n" + + "Example usage: hashLookup E470FD8A6350A74217B0A99EA5FB71F091C84C64AD0DE0E72ECC10421D03AAC9"); + out.println("Please provide a hexadecimal transaction Id hash value", Decoration.bold, Color.red); return; } diff --git a/tools/shell/src/main/java/net/corda/tools/shell/OutputFormatCommand.java b/tools/shell/src/main/java/net/corda/tools/shell/OutputFormatCommand.java index 3b20da82f0..1a3fffb79e 100644 --- a/tools/shell/src/main/java/net/corda/tools/shell/OutputFormatCommand.java +++ b/tools/shell/src/main/java/net/corda/tools/shell/OutputFormatCommand.java @@ -15,6 +15,7 @@ import org.crsh.text.RenderPrintWriter; import java.util.Map; @Man("Allows you to see and update the format that's currently used for the commands' output.") +@Usage("Allows you to see and update the format that's currently used for the commands' output.") public class OutputFormatCommand extends InteractiveShellCommand { public OutputFormatCommand() {}