Add a new Console object for console interactions.

Review Request #11409 — Created Jan. 26, 2021 and submitted — Latest diff uploaded

Information

Review Board
release-4.0.x

Reviewers

This introduces reviewboard.cmdline.utils.console.Console, which is a
new interface for outputting to the console. It takes care of wrapping
text to terminal widths, styling some content, and has functions for
outputting standard pieces of content to the console (such as
paragraphs, notes, warnings, errors, lists of items, and progress
steps).

This is the successor to the old ConsoleUI, built to be more generic
and usable outside of a wizard setup. ConsoleUI still exists, but now
wraps this and will be phased out, since the multi-UI support hasn't
been needed in a long time, and much of its remaining page-based design
is no longer relevant.

The new Console interface will be used for some parts of rbext and
for other command line helpers in the future.

Some styling has improved. The default terminal width is now wider at 79
characters. Itemized lists are no longer indented too far, and their
items now wrap correctly. Errors are no longer treated specially with
regards to their prefix vs. text placement (previously, we indented all
text to align with the placement of error text, after the [!] prefix).
These changes should help keep console output a bit more consistent.

Otherwise, rb-site and prepare-dev.py both appear more or less the
same as they did before.

Tested all of rb-site and prepare-dev.py with Python 2.7, 3.6, and
3.9, at different terminal widths. Verified the results looked the way
I wanted.

Commits

Files

    Loading...