Homec4science

Introduce PhutilConsoleView for rendering elements to the console

Authored by epriestley <git@epriestley.com> on Sep 21 2015, 21:39.

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

Details

Committed
epriestley <git@epriestley.com>Sep 21 2015, 21:39
Pushed
aubortMar 17 2017, 12:03
Parents
rPHU880c0fb3448f: Implement Cowsay in PHP
Branches
Unknown
Tags
Unknown

Event Timeline

epriestley <git@epriestley.com> committed rPHU50d5e4939928: Introduce PhutilConsoleView for rendering elements to the console (authored by epriestley <git@epriestley.com>).Sep 21 2015, 21:39