hive-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ser...@apache.org
Subject hive git commit: HIVE-13378 : LLAP help formatter is too narrow (Sergey Shelukhin, reviewed by Siddharth Seth)
Date Wed, 06 Apr 2016 19:09:15 GMT
Repository: hive
Updated Branches:
  refs/heads/master 4dff65f43 -> 7420e3658


HIVE-13378 : LLAP help formatter is too narrow (Sergey Shelukhin, reviewed by Siddharth Seth)


Project: http://git-wip-us.apache.org/repos/asf/hive/repo
Commit: http://git-wip-us.apache.org/repos/asf/hive/commit/7420e365
Tree: http://git-wip-us.apache.org/repos/asf/hive/tree/7420e365
Diff: http://git-wip-us.apache.org/repos/asf/hive/diff/7420e365

Branch: refs/heads/master
Commit: 7420e36587b6c8bb93fd63639c7e6584134bd139
Parents: 4dff65f
Author: Sergey Shelukhin <sershe@apache.org>
Authored: Wed Apr 6 12:08:30 2016 -0700
Committer: Sergey Shelukhin <sershe@apache.org>
Committed: Wed Apr 6 12:08:30 2016 -0700

----------------------------------------------------------------------
 .../hadoop/hive/llap/cli/LlapOptionsProcessor.java  | 16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hive/blob/7420e365/llap-server/src/java/org/apache/hadoop/hive/llap/cli/LlapOptionsProcessor.java
----------------------------------------------------------------------
diff --git a/llap-server/src/java/org/apache/hadoop/hive/llap/cli/LlapOptionsProcessor.java
b/llap-server/src/java/org/apache/hadoop/hive/llap/cli/LlapOptionsProcessor.java
index cdc919e..418f77f 100644
--- a/llap-server/src/java/org/apache/hadoop/hive/llap/cli/LlapOptionsProcessor.java
+++ b/llap-server/src/java/org/apache/hadoop/hive/llap/cli/LlapOptionsProcessor.java
@@ -18,6 +18,8 @@
 
 package org.apache.hadoop.hive.llap.cli;
 
+import jline.TerminalFactory;
+
 import java.io.IOException;
 import java.util.Properties;
 
@@ -224,9 +226,9 @@ public class LlapOptionsProcessor {
         .withDescription("Use value for given property. Overridden by explicit parameters")
         .create());
 
-    options.addOption(OptionBuilder.hasArg().withArgName(OPTION_SLIDER_AM_CONTAINER_MB)
+    options.addOption(OptionBuilder.hasArg().withArgName("b")
         .withLongOpt(OPTION_SLIDER_AM_CONTAINER_MB)
-        .withDescription("The size of the slider AppMaster container in MB").create());
+        .withDescription("The size of the slider AppMaster container in MB").create('b'));
 
     options.addOption(OptionBuilder.hasArg().withArgName(OPTION_IO_THREADS)
         .withLongOpt(OPTION_IO_THREADS).withDescription("executor per instance").create('t'));
@@ -284,6 +286,14 @@ public class LlapOptionsProcessor {
   }
 
   private void printUsage() {
-    new HelpFormatter().printHelp("llap", options);
+    HelpFormatter hf = new HelpFormatter();
+    try {
+      int width = hf.getWidth();
+      int jlineWidth = TerminalFactory.get().getWidth();
+      width = Math.min(160, Math.max(jlineWidth, width)); // Ignore potentially incorrect
values
+      hf.setWidth(width);
+    } catch (Throwable t) { // Ignore
+    }
+    hf.printHelp("llap", options);
   }
 }


Mime
View raw message