Add some more control over Console output, and improve default behavior.

Review Request #11418 — Created Jan. 28, 2021 and submitted

Information

Review Board
release-4.0.x

Reviewers

This introduces some new changes that ease working with Console and
getting the behavior that the caller wants.

  • Newlines around some text blocks can now be turned off
    (console.note(), console.warning(), console.error()).

  • Results from prompt_input() are now stripped by default. This can be
    controlled by passing strip=False.

  • console.print() now processes text as paragraphs by default when
    wrapping, and adds leading indentation to each line when not. This
    also removes as_paragraphs=.

  • console.progress_step() now shows an ERROR: <message> if an
    exception is raised.

  • Wrap widths for the terminal no longer add padding to the right.

  • uninit_console() was added, which will unset the Console instance.

This somewhat breaks presentation with ConsoleUI, but that class will
soon be removed.

Ran through rb-site install --advanced and rb-site upgrade.

Tested with some upcoming changes that better utilized the features,
making sure that the presentation matched expectations.

Summary ID
Add some more control over Console output, and improve default behavior.
This introduces some new changes that ease working with `Console` and getting the behavior that the caller wants. * Newlines around some text blocks can now be turned off (`console.note()`, `console.warning()`, `console.error()`). * Results from `prompt_input()` are now stripped by default. This can be controlled by passing `strip=False`. * `console.print()` now processes text as paragraphs by default when wrapping, and adds leading indentation to each line when not. This also removes `as_paragraphs=`. * `console.progress_step()` now shows an `ERROR: <message>` if an exception is raised. * Wrap widths for the terminal no longer add padding to the right. This somewhat breaks presentation with `ConsoleUI`, but that class will soon be removed.
bff8345cfc075248c34d84df46df77abcdeaf43e
david
  1. Ship It!
  2. 
      
chipx86
Review request changed

Status: Closed (submitted)

Change Summary:

Pushed to release-4.0.x (e75d0b8)
Loading...