Michael Blow has submitted this change and it was merged. Change subject: [NO ISSUE][*DB] Client helper cleanup ......................................................................
[NO ISSUE][*DB] Client helper cleanup Avoiding printing internal options, minor refactoring Change-Id: Ib9edefa1dcfe157fa013e5ce63bc55c7d5cb92b1 Reviewed-on: https://asterix-gerrit.ics.uci.edu/1966 Sonar-Qube: Jenkins <[email protected]> Tested-by: Jenkins <[email protected]> Contrib: Jenkins <[email protected]> Integration-Tests: Jenkins <[email protected]> Reviewed-by: abdullah alamoudi <[email protected]> --- M asterixdb/asterix-client-helper/src/main/java/org/apache/asterix/clienthelper/Args.java M asterixdb/asterix-client-helper/src/main/java/org/apache/asterix/clienthelper/AsterixHelperExecution.java 2 files changed, 18 insertions(+), 9 deletions(-) Approvals: Anon. E. Moose #1000171: abdullah alamoudi: Looks good to me, approved Jenkins: Verified; No violations found; ; Verified diff --git a/asterixdb/asterix-client-helper/src/main/java/org/apache/asterix/clienthelper/Args.java b/asterixdb/asterix-client-helper/src/main/java/org/apache/asterix/clienthelper/Args.java index ceb873d..8a721b9 100644 --- a/asterixdb/asterix-client-helper/src/main/java/org/apache/asterix/clienthelper/Args.java +++ b/asterixdb/asterix-client-helper/src/main/java/org/apache/asterix/clienthelper/Args.java @@ -35,11 +35,11 @@ @Option(name = "-clusterport", metaVar = "<port>", usage = "Port of the cluster to connect to") protected int clusterPort = 19002; - @Option(name = "-clusterstatepath", metaVar = "<path>", + @Option(name = "-clusterstatepath", metaVar = "<path>", hidden = true, usage = "Path on host:port to check for cluster readiness") protected String clusterStatePath = "admin/cluster"; - @Option(name = "-shutdownpath", metaVar = "<path>", + @Option(name = "-shutdownpath", metaVar = "<path>", hidden = true, usage = "Path on host:port to invoke to initiate shutdown") protected String shutdownPath = "admin/shutdown"; diff --git a/asterixdb/asterix-client-helper/src/main/java/org/apache/asterix/clienthelper/AsterixHelperExecution.java b/asterixdb/asterix-client-helper/src/main/java/org/apache/asterix/clienthelper/AsterixHelperExecution.java index dcb4d24..cf7fd4f 100644 --- a/asterixdb/asterix-client-helper/src/main/java/org/apache/asterix/clienthelper/AsterixHelperExecution.java +++ b/asterixdb/asterix-client-helper/src/main/java/org/apache/asterix/clienthelper/AsterixHelperExecution.java @@ -60,14 +60,19 @@ } } catch (CmdLineException e) { System.err.println("ERROR: " + e.getMessage() + "\n\n" - + "Usage: " + getHelperCommandName() + " [options] <command>\n\n" - + "Commands:"); - printCommandsUsage(System.err); - System.err.println("Options:"); - parser.printUsage(System.err); - System.err.flush(); + + "Usage: " + getHelperCommandName() + " [options] <command>"); + + printUsageDetails(parser, System.err); return 99; } + } + + protected void printUsageDetails(CmdLineParser parser, PrintStream ps) { + ps.println("\nCommands:"); + printCommandsUsage(ps); + ps.println("\nOptions:"); + parser.printUsage(ps); + ps.flush(); } protected String getHelperCommandName() { @@ -76,10 +81,14 @@ protected void printCommandsUsage(PrintStream out) { for (Command command : Command.values()) { - printCommandUsage(out, command.name(), command.usage()); + printCommandUsage(out, command); } } + protected void printCommandUsage(PrintStream out, Command command) { + printCommandUsage(out, command.name(), command.usage()); + } + protected void printCommandUsage(PrintStream out, String name, String usage) { StringBuilder padding = new StringBuilder(); for (int i = name.length(); i < COMMAND_USAGE_ALIGNMENT; i++) { -- To view, visit https://asterix-gerrit.ics.uci.edu/1966 To unsubscribe, visit https://asterix-gerrit.ics.uci.edu/settings Gerrit-MessageType: merged Gerrit-Change-Id: Ib9edefa1dcfe157fa013e5ce63bc55c7d5cb92b1 Gerrit-PatchSet: 2 Gerrit-Project: asterixdb Gerrit-Branch: master Gerrit-Owner: Michael Blow <[email protected]> Gerrit-Reviewer: Anon. E. Moose #1000171 Gerrit-Reviewer: Ian Maxon <[email protected]> Gerrit-Reviewer: Jenkins <[email protected]> Gerrit-Reviewer: Michael Blow <[email protected]> Gerrit-Reviewer: abdullah alamoudi <[email protected]>
