Add idiomatic documentation to Go, Java, Python, and Rust clients
This commit is contained in:
+24
@@ -38,6 +38,10 @@ import picocli.CommandLine.Model.CommandSpec;
|
||||
import picocli.CommandLine.Option;
|
||||
import picocli.CommandLine.Spec;
|
||||
|
||||
/**
|
||||
* Picocli entry point for the {@code mxgw-java} test CLI used by the
|
||||
* cross-language smoke matrix.
|
||||
*/
|
||||
@Command(
|
||||
name = "mxgw-java",
|
||||
mixinStandardHelpOptions = true,
|
||||
@@ -48,6 +52,9 @@ public final class MxGatewayCli implements Callable<Integer> {
|
||||
@Spec
|
||||
private CommandSpec spec;
|
||||
|
||||
/**
|
||||
* Builds a CLI bound to the default gRPC client factory.
|
||||
*/
|
||||
public MxGatewayCli() {
|
||||
this(new GrpcMxGatewayCliClientFactory());
|
||||
}
|
||||
@@ -56,11 +63,25 @@ public final class MxGatewayCli implements Callable<Integer> {
|
||||
this.clientFactory = clientFactory;
|
||||
}
|
||||
|
||||
/**
|
||||
* Process entry point.
|
||||
*
|
||||
* @param args command-line arguments
|
||||
*/
|
||||
public static void main(String[] args) {
|
||||
int exitCode = commandLine(new GrpcMxGatewayCliClientFactory()).execute(args);
|
||||
System.exit(exitCode);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test-friendly entry point that runs the CLI against the supplied
|
||||
* {@link PrintWriter} pair instead of the system streams.
|
||||
*
|
||||
* @param out writer that receives standard output
|
||||
* @param err writer that receives standard error
|
||||
* @param args command-line arguments
|
||||
* @return the picocli exit code
|
||||
*/
|
||||
public static int execute(PrintWriter out, PrintWriter err, String... args) {
|
||||
return execute(new GrpcMxGatewayCliClientFactory(), out, err, args);
|
||||
}
|
||||
@@ -280,6 +301,9 @@ public final class MxGatewayCli implements Callable<Integer> {
|
||||
return values;
|
||||
}
|
||||
|
||||
/**
|
||||
* Picocli subcommand that prints the client and protocol version numbers.
|
||||
*/
|
||||
@Command(name = "version", description = "Prints the Java client version.")
|
||||
public static final class VersionCommand implements Callable<Integer> {
|
||||
@Spec
|
||||
|
||||
Reference in New Issue
Block a user