1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-19 03:50:54 +01:00

Convert ./bin/storage status to use PhutilConsoleTable.

Summary: Constructing tables manually just isn't fun.

Test Plan:
```
./bin/storage status
phabricator:db.audit                                      Applied db   audit
phabricator:db.calendar                                   Applied db   calendar
phabricator:db.chatlog                                    Applied db   chatlog
phabricator:db.conduit                                    Applied db   conduit
phabricator:db.countdown                                  Applied db   countdown
phabricator:db.daemon                                     Applied db   daemon
phabricator:db.differential                               Applied db   differential
phabricator:db.draft                                      Applied db   draft
phabricator:db.drydock                                    Applied db   drydock
phabricator:db.feed                                       Applied db   feed
phabricator:db.file                                       Applied db   file
phabricator:db.flag                                       Applied db   flag
phabricator:db.harbormaster                               Applied db   harbormaster
...
```

This probably isn't ready to land yet, we should fix `PhutilConsoleTable` to truncate columns which would otherwise cause overflow.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: epriestley, Korvin

Differential Revision: https://secure.phabricator.com/D9604
This commit is contained in:
Joshua Spence 2014-06-22 06:20:59 +10:00
parent ddd8c9c567
commit b7b0458303

View file

@ -24,27 +24,25 @@ final class PhabricatorStorageManagementStatusWorkflow
return 1;
}
$len = 0;
foreach ($patches as $patch) {
$len = max($len, strlen($patch->getFullKey()));
}
$table = id(new PhutilConsoleTable())
->setShowHeader(false)
->addColumn('id', array('title' => 'ID'))
->addColumn('status', array('title' => 'Status'))
->addColumn('type', array('title' => 'Type'))
->addColumn('name', array('title' => 'Name'));
foreach ($patches as $patch) {
printf(
"% -".($len + 2)."s ".
"%-".strlen('Not Applied')."s ".
"%-4s ".
"%s\n",
$patch->getFullKey(),
in_array($patch->getFullKey(), $applied)
$table->addRow(array(
'id' => $patch->getFullKey(),
'status' => in_array($patch->getFullKey(), $applied)
? 'Applied'
: 'Not Applied',
$patch->getType(),
$patch->getName());
'type' => $patch->getType(),
'name' => $patch->getName(),
));
}
$table->draw();
return 0;
}