Skip to content

Commit d758759

Browse files
authored
Sets default column size when terminal size is 0 (apache#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
1 parent d6f823c commit d758759

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

shell/src/main/java/org/apache/accumulo/shell/commands/HelpCommand.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,8 @@ public class HelpCommand extends Command {
3939
@Override
4040
public int execute(final String fullCommand, final CommandLine cl, final Shell shellState)
4141
throws ShellCommandException, IOException {
42-
int numColumns = shellState.getTerminal().getWidth();
42+
int numColumns =
43+
(shellState.getTerminal().getWidth() == 0) ? 80 : shellState.getTerminal().getWidth();
4344
if (cl.hasOption(noWrapOpt.getOpt())) {
4445
numColumns = Integer.MAX_VALUE;
4546
}

0 commit comments

Comments
 (0)