Skip to content

Commit

Permalink
Sets default column size when terminal size is 0 (apache#5265)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
ddanielr authored Jan 16, 2025
1 parent d6f823c commit d758759
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit d758759

Please sign in to comment.