Changeset View
Changeset View
Standalone View
Standalone View
src/workflow/ArcanistFlagWorkflow.php
| Show First 20 Lines • Show All 109 Lines • ▼ Show 20 Lines | public function run() { | ||||
| $color = $this->getArgument('color', -1); | $color = $this->getArgument('color', -1); | ||||
| $note = $this->getArgument('note'); | $note = $this->getArgument('note'); | ||||
| $editing = $edit || ($color != -1) || $note; | $editing = $edit || ($color != -1) || $note; | ||||
| if ($editing && $clear) { | if ($editing && $clear) { | ||||
| throw new ArcanistUsageException("You can't both edit and clear a flag."); | throw new ArcanistUsageException("You can't both edit and clear a flag."); | ||||
| } | } | ||||
| if (($editing || $clear) && count($objects) != 1) { | if (($editing || $clear) && count($objects) != 1) { | ||||
| throw new ArcanistUsageException("Specify exactly one object."); | throw new ArcanistUsageException('Specify exactly one object.'); | ||||
| } | } | ||||
| if (!empty($objects)) { | if (!empty($objects)) { | ||||
| // First off, convert the passed objects to PHIDs. | // First off, convert the passed objects to PHIDs. | ||||
| $handles = $conduit->callMethodSynchronous( | $handles = $conduit->callMethodSynchronous( | ||||
| 'phid.lookup', | 'phid.lookup', | ||||
| array( | array( | ||||
| 'names' => $objects, | 'names' => $objects, | ||||
| Show All 23 Lines | if ($clear) { | ||||
| array( | array( | ||||
| 'objectPHID' => head($phids), | 'objectPHID' => head($phids), | ||||
| )); | )); | ||||
| if (!$flag) { | if (!$flag) { | ||||
| echo phutil_console_format("**%s** has no flag to clear.\n", $object); | echo phutil_console_format("**%s** has no flag to clear.\n", $object); | ||||
| } else { | } else { | ||||
| self::flagWasEdited($flag, 'deleted'); | self::flagWasEdited($flag, 'deleted'); | ||||
| } | } | ||||
| } elseif ($editing) { | } else if ($editing) { | ||||
| // Let's set some flags. Just like Minesweeper, but less distracting. | // Let's set some flags. Just like Minesweeper, but less distracting. | ||||
| $flag_params = array( | $flag_params = array( | ||||
| 'objectPHID' => head($phids), | 'objectPHID' => head($phids), | ||||
| ); | ); | ||||
| if (isset(self::$colorSpec[$color])) { | if (isset(self::$colorSpec[$color])) { | ||||
| $flag_params['color'] = self::$colorSpec[strtolower($color)]; | $flag_params['color'] = self::$colorSpec[strtolower($color)]; | ||||
| } | } | ||||
| if ($note) { | if ($note) { | ||||
| ▲ Show 20 Lines • Show All 52 Lines • Show Last 20 Lines | |||||