Skip to content

Terminal width

H90 edited this page May 4, 2021 · 14 revisions

By default, a terminal width of 80 columns is assumed. On Linux terminals, this often leaves a lot of empty space on the right side of the screen when the usage information is printed.

If you can use a library like jline to determine the actual terminal width, then this information can be passed to the generated parser, to make better use of the available space:

public static void main(String[] args) {
  int width = TerminalBuilder.terminal().getWidth();
  DeleteCommand command = new DeleteCommand_Parser()
      .withTerminalWidth(width)
      .parseOrExit(args);
}
Clone this wiki locally