Changeset View
Changeset View
Standalone View
Standalone View
src/workflow/ArcanistBaseWorkflow.php
Show First 20 Lines • Show All 588 Lines • ▼ Show 20 Lines | final public function getPassedArguments() { | ||||
return $this->passedArguments; | 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; | $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['*']); | ||||
$dict[$more_key] = array(); | $dict[$more_key] = array(); | ||||
} | } | ||||
$short_to_long_map = array(); | $short_to_long_map = array(); | ||||
foreach ($spec as $long => $options) { | foreach ($spec as $long => $options) { | ||||
if (!empty($options['short'])) { | if (!empty($options['short'])) { | ||||
epriestley: I think this will raise a (confusing) warning/fatal if there's no `=` in the argument.
Instead… | |||||
$short_to_long_map[$options['short']] = $long; | $short_to_long_map[$options['short']] = $long; | ||||
Not Done Inline ActionsThis should use ArcanistSettings->willWriteValue() to interpret the value (the name is a little confusing, but willWriteValue() is the one that takes a user-entered value and converts it into a machine-readable value). Otherwise, it's impossible to configure lists/maps, and values like "true", "false", "on" and "off" will not be interpreted correctly. epriestley: This should use `ArcanistSettings->willWriteValue()` to interpret the value (the name is a… | |||||
} | } | ||||
} | } | ||||
foreach ($spec as $long => $options) { | foreach ($spec as $long => $options) { | ||||
if (!empty($options['repeat'])) { | if (!empty($options['repeat'])) { | ||||
$dict[$long] = array(); | $dict[$long] = array(); | ||||
} | } | ||||
} | } | ||||
▲ Show 20 Lines • Show All 1,165 Lines • Show Last 20 Lines |
I think this will raise a (confusing) warning/fatal if there's no = in the argument.
Instead, we should throw ArcanistUsageException.