1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-11 17:32:41 +01:00
phorge-phorge/src/applications/daemon/management/PhabricatorDaemonManagementLaunchWorkflow.php
epriestley 5a352d0a69 Improve phd help
Summary: Fixes T3680. One description was wrong, and clean up some of the other stuff.

Test Plan: Ran `phd`.

Reviewers: btrahan, Korvin

Reviewed By: Korvin

CC: aran, jifriedman, Korvin

Maniphest Tasks: T3680

Differential Revision: https://secure.phabricator.com/D6683
2013-08-06 09:10:53 -07:00

57 lines
1.3 KiB
PHP

<?php
final class PhabricatorDaemonManagementLaunchWorkflow
extends PhabricatorDaemonManagementWorkflow {
public function shouldParsePartial() {
return true;
}
public function didConstruct() {
$this
->setName('launch')
->setExamples('**launch** [n] __daemon__ [options]')
->setSynopsis(pht(
'Start a specific __daemon__, or __n__ copies of a specific '.
'__daemon__.'))
->setArguments(
array(
array(
'name' => 'argv',
'wildcard' => true,
),
));
}
public function execute(PhutilArgumentParser $args) {
$argv = $args->getArg('argv');
$daemon_count = 1;
if ($argv) {
if (is_numeric(head($argv))) {
$daemon_count = array_shift($argv);
}
if ($daemon_count < 1) {
throw new PhutilArgumentUsageException(
pht('You must launch at least one daemon.'));
}
}
if (!$argv) {
throw new PhutilArgumentUsageException(
pht('You must specify which daemon to launch.'));
}
$daemon_class = array_shift($argv);
$this->willLaunchDaemons();
for ($ii = 0; $ii < $daemon_count; $ii++) {
$this->launchDaemon($daemon_class, $argv, $is_debug = false);
}
return 0;
}
}