HomePhabricator

Introduce PhutilConsoleView for rendering elements to the console

Description

Introduce PhutilConsoleView for rendering elements to the console

Summary:
Ref T8243. Ref T9455. Two general issues:

  • Some day, we need to deal with users putting console escape sequences in task titles, etc., and doing mischief on the CLI (this is T8243). This is very very low severity.
  • The phutil_console_x() / pht() / sprintf() / echo / PhutilConsole APIs are all really gross and inconsistent.

Try to make a positive step toward resolving these problems:

  • Introduce ConsoleView, which is like AphrontView but for console output (automatic escaping rules, etc).
  • Convert the existing ConsoleTable to be a ConsoleView.
  • Add a new ConsoleList (list of items) and ConsoleBlock (list of other views, approximately).
  • Get all the escaping working properly (API is a bit rough).

This needs more work eventually but lets us render console UIs that look and work like web UIs from an API standpoint.

Test Plan:

  • Ran a bunch of commands that use PhutilConsoleTable and all the output looked OK.
  • See next diff for List and Block.

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T8243, T9455

Differential Revision: https://secure.phabricator.com/D14136