Changeset View
Changeset View
Standalone View
Standalone View
src/workflow/ArcanistWorkflow.php
| Show First 20 Lines • Show All 46 Lines • ▼ Show 20 Lines | abstract class ArcanistWorkflow extends Phobject { | ||||
| private $conduitAuthenticated; | private $conduitAuthenticated; | ||||
| private $conduitTimeout; | private $conduitTimeout; | ||||
| private $userPHID; | private $userPHID; | ||||
| private $userName; | private $userName; | ||||
| private $repositoryAPI; | private $repositoryAPI; | ||||
| private $configurationManager; | private $configurationManager; | ||||
| private $arguments = array(); | private $arguments = array(); | ||||
| private $passedArguments = array(); | |||||
| private $command; | private $command; | ||||
| private $stashed; | private $stashed; | ||||
| private $shouldAmend; | private $shouldAmend; | ||||
| private $projectInfo; | private $projectInfo; | ||||
| private $repositoryInfo; | private $repositoryInfo; | ||||
| private $repositoryReasons; | private $repositoryReasons; | ||||
| ▲ Show 20 Lines • Show All 708 Lines • ▼ Show 20 Lines | final public function getArgument($key, $default = null) { | ||||
| // TOOLSETS: Remove this legacy code. | // TOOLSETS: Remove this legacy code. | ||||
| if (is_array($this->arguments)) { | if (is_array($this->arguments)) { | ||||
| return idx($this->arguments, $key, $default); | return idx($this->arguments, $key, $default); | ||||
| } | } | ||||
| return $this->arguments->getArg($key); | return $this->arguments->getArg($key); | ||||
| } | } | ||||
| final public function getPassedArguments() { | |||||
| return $this->passedArguments; | |||||
| } | |||||
| final public function getCompleteArgumentSpecification() { | final public function getCompleteArgumentSpecification() { | ||||
| $spec = $this->getArguments(); | $spec = $this->getArguments(); | ||||
| $arc_config = $this->getArcanistConfiguration(); | $arc_config = $this->getArcanistConfiguration(); | ||||
| $command = $this->getCommand(); | $command = $this->getCommand(); | ||||
| $spec += $arc_config->getCustomArgumentsForCommand($command); | $spec += $arc_config->getCustomArgumentsForCommand($command); | ||||
| return $spec; | return $spec; | ||||
| } | } | ||||
| final public function parseArguments(array $args) { | final public function parseArguments(array $args) { | ||||
| $this->passedArguments = $args; | |||||
| $spec = $this->getCompleteArgumentSpecification(); | $spec = $this->getCompleteArgumentSpecification(); | ||||
| $dict = array(); | $dict = array(); | ||||
| $more_key = null; | $more_key = null; | ||||
| if (!empty($spec['*'])) { | if (!empty($spec['*'])) { | ||||
| $more_key = $spec['*']; | $more_key = $spec['*']; | ||||
| unset($spec['*']); | unset($spec['*']); | ||||
| ▲ Show 20 Lines • Show All 1,602 Lines • ▼ Show 20 Lines | /* -( Phabricator Repositories )------------------------------------------- */ | ||||
| final protected function getSymbolEngine() { | final protected function getSymbolEngine() { | ||||
| return $this->getRuntime()->getSymbolEngine(); | return $this->getRuntime()->getSymbolEngine(); | ||||
| } | } | ||||
| final protected function getViewer() { | final protected function getViewer() { | ||||
| return $this->getRuntime()->getViewer(); | return $this->getRuntime()->getViewer(); | ||||
| } | } | ||||
| final protected function readStdin() { | |||||
| $log = $this->getLogEngine(); | |||||
| $log->writeWaitingForInput(); | |||||
| // NOTE: We can't just "file_get_contents()" here because signals don't | |||||
| // interrupt it. If the user types "^C", we want to interrupt the read. | |||||
| $raw_handle = fopen('php://stdin', 'rb'); | |||||
| $stdin = new PhutilSocketChannel($raw_handle); | |||||
| while ($stdin->update()) { | |||||
| PhutilChannel::waitForAny(array($stdin)); | |||||
| } | |||||
| return $stdin->read(); | |||||
| } | |||||
| } | } | ||||