asterixdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mb...@apache.org
Subject asterixdb git commit: [NO ISSUE][*DB] Client helper cleanup
Date Thu, 24 Aug 2017 17:53:05 GMT
Repository: asterixdb
Updated Branches:
  refs/heads/master d828754b3 -> 5eb13036d


[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 <jenkins@fulliautomatix.ics.uci.edu>
Tested-by: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Contrib: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Integration-Tests: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Reviewed-by: abdullah alamoudi <bamousaa@gmail.com>


Project: http://git-wip-us.apache.org/repos/asf/asterixdb/repo
Commit: http://git-wip-us.apache.org/repos/asf/asterixdb/commit/5eb13036
Tree: http://git-wip-us.apache.org/repos/asf/asterixdb/tree/5eb13036
Diff: http://git-wip-us.apache.org/repos/asf/asterixdb/diff/5eb13036

Branch: refs/heads/master
Commit: 5eb13036dc62840394e5dbb732194a6240199e33
Parents: d828754
Author: Michael Blow <mblow@apache.org>
Authored: Thu Aug 24 10:30:16 2017 -0400
Committer: Michael Blow <mblow@apache.org>
Committed: Thu Aug 24 10:52:38 2017 -0700

----------------------------------------------------------------------
 .../org/apache/asterix/clienthelper/Args.java   |  4 ++--
 .../clienthelper/AsterixHelperExecution.java    | 23 ++++++++++++++------
 2 files changed, 18 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/asterixdb/blob/5eb13036/asterixdb/asterix-client-helper/src/main/java/org/apache/asterix/clienthelper/Args.java
----------------------------------------------------------------------
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 @@ public class Args {
     @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";
 

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/5eb13036/asterixdb/asterix-client-helper/src/main/java/org/apache/asterix/clienthelper/AsterixHelperExecution.java
----------------------------------------------------------------------
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,26 +60,35 @@ public class AsterixHelperExecution {
             }
         } 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() {
         return ASTERIX_HELPER;
     }
 
     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++) {


Mime
View raw message