Add a PhutilConsoleTable class for drawing tables.
Summary: Currently there is no easy way to draw a table. PhabricatorDaemonManagementStatusWorkflow draws a table in an ad-hoc way, but it would be useful to provide a more flexible mechanism to do so.
Test Plan:
$table = id(new PhutilConsoleTable()) ->addColumn('foo', array('title' => 'Foo', 'align' => 'right')) ->addColumn('bar', array('title' => 'Foobar', 'align' => 'center')) ->addColumn('baz', array('title' => '日本語')) ->addRow(array('foo' => 12345, 'bar' => 'foo', 'baz' => 'baz')) ->addRow(array('foo' => '汉语漢語', 'bar' => '한국어조선말', 'baz' => 'ру́сский язы́к')) ->addRow(array('foo' => 'aaa', 'bar' => '✓✗', 'baz' => 'dddddddddddd')) ->addRow(array('foo' => '', 'bar' => '', 'baz' => '')); $table->setBorders(false)->draw(); echo "\n"; $table->setBorders(true)->draw();
Output
{F166929}
Reviewers: #blessed_reviewers, epriestley
Reviewed By: #blessed_reviewers, epriestley
Subscribers: epriestley, Korvin
Differential Revision: https://secure.phabricator.com/D9533