Changeset View
Changeset View
Standalone View
Standalone View
src/workflow/ArcanistPasteWorkflow.php
| Show First 20 Lines • Show All 61 Lines • ▼ Show 20 Lines | EOTEXT | ||||
| protected function didParseArguments() { | protected function didParseArguments() { | ||||
| $this->language = $this->getArgument('lang'); | $this->language = $this->getArgument('lang'); | ||||
| $this->title = $this->getArgument('title'); | $this->title = $this->getArgument('title'); | ||||
| $this->json = $this->getArgument('json'); | $this->json = $this->getArgument('json'); | ||||
| $argv = $this->getArgument('argv'); | $argv = $this->getArgument('argv'); | ||||
| if (count($argv) > 1) { | if (count($argv) > 1) { | ||||
| throw new ArcanistUsageException("Specify only one paste to retrieve."); | throw new ArcanistUsageException('Specify only one paste to retrieve.'); | ||||
| } else if (count($argv) == 1) { | } else if (count($argv) == 1) { | ||||
| $id = $argv[0]; | $id = $argv[0]; | ||||
| if (!preg_match('/^P?\d+/', $id)) { | if (!preg_match('/^P?\d+/', $id)) { | ||||
| throw new ArcanistUsageException("Specify a paste ID, like P123."); | throw new ArcanistUsageException('Specify a paste ID, like P123.'); | ||||
| } | } | ||||
| $this->id = (int)ltrim($id, 'P'); | $this->id = (int)ltrim($id, 'P'); | ||||
| if ($this->language || $this->title) { | if ($this->language || $this->title) { | ||||
| throw new ArcanistUsageException( | throw new ArcanistUsageException( | ||||
| "Use options --lang and --title only when creating pastes."); | 'Use options --lang and --title only when creating pastes.'); | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| private function getTitle() { | private function getTitle() { | ||||
| return $this->title; | return $this->title; | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 65 Lines • Show Last 20 Lines | |||||