Changeset View
Changeset View
Standalone View
Standalone View
src/workflow/ArcanistStartWorkflow.php
- This file was added.
<?php | |||||
/** | |||||
* Start time tracking on an object | |||||
*/ | |||||
final class ArcanistStartWorkflow extends ArcanistPhrequentWorkflow { | |||||
public function getWorkflowName() { | |||||
return 'start'; | |||||
} | |||||
public function getCommandSynopses() { | |||||
return phutil_console_format(<<<EOTEXT | |||||
**start** __object__ | |||||
EOTEXT | |||||
); | |||||
} | |||||
public function getCommandHelp() { | |||||
return phutil_console_format(<<<EOTEXT | |||||
Start tracking work in Phrequent. | |||||
EOTEXT | |||||
); | |||||
} | |||||
public function requiresConduit() { | |||||
return true; | |||||
} | |||||
public function desiresWorkingCopy() { | |||||
return false; | |||||
} | |||||
public function requiresAuthentication() { | |||||
return true; | |||||
} | |||||
public function getArguments() { | |||||
return array( | |||||
'*' => 'name', | |||||
); | |||||
} | |||||
public function run() { | |||||
$conduit = $this->getConduit(); | |||||
epriestley: Is there any reason to have this? | |||||
$started_phids = array(); | |||||
$short_name = $this->getArgument('name'); | |||||
foreach ($short_name as $object_name) { | |||||
$object_lookup = $conduit->callMethodSynchronous( | |||||
'phid.lookup', | |||||
array( | |||||
'names' => array($object_name), | |||||
)); | |||||
if (!array_key_exists($object_name, $object_lookup)) { | |||||
echo "No such object '".$object_name."' found.\n"; | |||||
Not Done Inline ActionsThis permits arc start T1 T2 but ignores T2. This also permits arc start --object T1 T2 but ignores T1. epriestley: This permits `arc start T1 T2` but ignores `T2`.
This also permits `arc start --object T1 T2`… | |||||
return 1; | |||||
} | |||||
$object_phid = $object_lookup[$object_name]['phid']; | |||||
$started_phids[] = $conduit->callMethodSynchronous( | |||||
'phrequent.push', | |||||
array( | |||||
'objectPHID' => $object_phid | |||||
)); | |||||
} | |||||
$phid_query = $conduit->callMethodSynchronous( | |||||
Not Done Inline Actionsthrow new ArcanistUsageException(...) epriestley: `throw new ArcanistUsageException(...)` | |||||
'phid.query', | |||||
array( | |||||
'phids' => $started_phids, | |||||
)); | |||||
$name = ''; | |||||
foreach ($phid_query as $ref) { | |||||
if ($name === '') { | |||||
$name = $ref['fullName']; | |||||
} else { | |||||
$name .= ', '.$ref['fullName']; | |||||
} | |||||
} | |||||
echo phutil_console_format( | |||||
Not Done Inline ActionsThese calls could use futures, although probably not worth bothering. epriestley: These calls could use futures, although probably not worth bothering. | |||||
"Started: %s\n\n", | |||||
$name); | |||||
$this->printCurrentTracking(true); | |||||
} | |||||
} | |||||
Not Done Inline ActionsBecause the current timestamp is the same as the time that just ended, it can't distinguish between a user time that's currently running (where end time == now) and a user time that's been ended at the current time (where end time == now as well). We should probably fix this inside Phrequent at some point, but all of the strata and time block calculations stuff is complex and I don't want to break it. hach-que: Because the current timestamp is the same as the time that just ended, it can't distinguish… | |||||
Not Done Inline ActionsSleeping seems pretty bad. We should find another way to get around this for now so users arent' stuck watiing. epriestley: Sleeping seems pretty bad. We should find another way to get around this for now so users… |
Is there any reason to have this?