Problem/Motivation

Follow-up from #3594336: Add a command to list modules and themes on a site,

Should there be a consistent and standard table width for table-formatted console command output. In the above issue, the table output for extensions produces a 130-character width output.

This is wider than the 80-character terminal standard used for 640 width resolutions. This is still the width that we assume for editing code in Drupal, but should it also be the width that we still assume terminals are used.

On a 1920x1080 resolution laptop, a full-width terminal will display the 130-character output for drupal core (but it is not constrained to this) fine, but not on a 1280x720 resolution laptop.

Constraint: The Table class in Symfony Console only allows to limit the maximum width of columns and not the entire table.

Steps to reproduce

Testing commands

  • Run ./vendor/bin/dr ex:list in various terminal window widths

Proposed resolution

Provide guidance on accepted table-formatted TO BE DETERMINED width output for console commands, and suggest maximum column widths for table formatted output in existing core commands for command authors of TO BE DETERMINED width.

Remaining tasks

Compare terminal widths in 2026 and decide on a maximum output for table output.

Can this be checked or otherwise automated via a coding standard or test?

User interface changes

To be determined. Probably yes.

Introduced terminology

To be determined.

API changes

To be determined.

Data model changes

To be determined.

Release notes snippet

To be determined.

Comments

mradcliffe created an issue.

xmacinfo’s picture

120 is perfectly fine for the terminal.

For code, the 80-character limit has two goals:

  1. Make the code easier to read.
  2. Make sure that printing code (laser printer, book, pdf, etc.) does not truncate long lines or add unwanted line feeds.