Add a new Console object for console interactions.

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

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.

Summary ID
Add a new Console object for console interactions.
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.
52f87eb63c63a9d22ac8a19013022c66021c59df
Description From Last Updated

F401 'reviewboard.cmdline.utils.console.ConsoleUI' imported but unused

reviewbotreviewbot
Checks run (1 failed, 1 succeeded)
flake8 failed.
JSHint passed.

flake8

david
  1. Ship It!
  2. 
      
chipx86
Review request changed
Status:
Completed
Change Summary:
Pushed to release-4.0.x (f12445e)