You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hive.apache.org by se...@apache.org on 2016/04/06 21:09:15 UTC

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

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 <se...@apache.org>
Authored: Wed Apr 6 12:08:30 2016 -0700
Committer: Sergey Shelukhin <se...@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);
   }
 }