This is an automated email from the ASF dual-hosted git repository.

dlmarion pushed a commit to branch 2.1
in repository https://gitbox.apache.org/repos/asf/accumulo.git


The following commit(s) were added to refs/heads/2.1 by this push:
     new d758759fcb Sets default column size when terminal size is 0 (#5265)
d758759fcb is described below

commit d758759fcb0ce112337d809456c73ff58bf61ff6
Author: Daniel Roberts <[email protected]>
AuthorDate: Thu Jan 16 08:31:07 2025 -0500

    Sets default column size when terminal size is 0 (#5265)
    
    Sets a default column size of 80 characters if the terminal width is set
    to 0. This supports running the help command in a dumb terminal
---
 .../src/main/java/org/apache/accumulo/shell/commands/HelpCommand.java  | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git 
a/shell/src/main/java/org/apache/accumulo/shell/commands/HelpCommand.java 
b/shell/src/main/java/org/apache/accumulo/shell/commands/HelpCommand.java
index c7e516c617..baf740a141 100644
--- a/shell/src/main/java/org/apache/accumulo/shell/commands/HelpCommand.java
+++ b/shell/src/main/java/org/apache/accumulo/shell/commands/HelpCommand.java
@@ -39,7 +39,8 @@ public class HelpCommand extends Command {
   @Override
   public int execute(final String fullCommand, final CommandLine cl, final 
Shell shellState)
       throws ShellCommandException, IOException {
-    int numColumns = shellState.getTerminal().getWidth();
+    int numColumns =
+        (shellState.getTerminal().getWidth() == 0) ? 80 : 
shellState.getTerminal().getWidth();
     if (cl.hasOption(noWrapOpt.getOpt())) {
       numColumns = Integer.MAX_VALUE;
     }

Reply via email to