4
* Stop time tracking on an object
6
final class ArcanistStopWorkflow extends ArcanistPhrequentWorkflow {
8
public function getWorkflowName() {
12
public function getCommandSynopses() {
13
return phutil_console_format(<<<EOTEXT
14
**stop** [--note __note__] [__objects__]
19
public function getCommandHelp() {
20
return phutil_console_format(<<<EOTEXT
21
Start tracking work in Phrequent.
26
public function requiresConduit() {
30
public function desiresWorkingCopy() {
34
public function requiresAuthentication() {
38
public function getArguments() {
43
'A note to attach to the tracked time.',
49
public function run() {
50
$conduit = $this->getConduit();
52
$names = $this->getArgument('name');
54
$object_lookup = $conduit->callMethodSynchronous(
60
foreach ($names as $object_name) {
61
if (!array_key_exists($object_name, $object_lookup)) {
62
throw new ArcanistUsageException(
63
"No such object '".$object_name."' found.");
68
if (count($names) === 0) {
69
// Implicit stop; add an entry so the loop will call
70
// phrequent.pop with a null objectPHID.
71
$object_lookup[] = array('phid' => null);
74
$stopped_phids = array();
75
foreach ($object_lookup as $ref) {
76
$object_phid = $ref['phid'];
78
$stopped_phid = $conduit->callMethodSynchronous(
81
'objectPHID' => $object_phid,
82
'note' => $this->getArgument('note'),
84
if ($stopped_phid !== null) {
85
$stopped_phids[] = $stopped_phid;
89
if (count($stopped_phids) === 0) {
90
if (count($names) === 0) {
91
echo phutil_console_format(
92
"Not currently tracking time against any object\n");
95
foreach ($object_lookup as $ref) {
97
$name = $ref['fullName'];
99
$name = ', '.$ref['fullName'];
103
echo phutil_console_format(
104
"Not currently tracking time against %s\n",
110
$phid_query = $conduit->callMethodSynchronous(
113
'phids' => $stopped_phids,
117
foreach ($phid_query as $ref) {
119
$name = $ref['fullName'];
121
$name .= ', '.$ref['fullName'];
125
echo phutil_console_format(
129
$this->printCurrentTracking(true);