Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F14395259
D9268.id22008.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
2 KB
Referenced Files
None
Subscribers
None
D9268.id22008.diff
View Options
diff --git a/src/workflow/ArcanistShellCompleteWorkflow.php b/src/workflow/ArcanistShellCompleteWorkflow.php
--- a/src/workflow/ArcanistShellCompleteWorkflow.php
+++ b/src/workflow/ArcanistShellCompleteWorkflow.php
@@ -30,8 +30,9 @@
public function getArguments() {
return array(
'current' => array(
- 'help' => 'Current term in the argument list being completed.',
'param' => 'cursor_position',
+ 'paramtype' => 'int',
+ 'help' => 'Current term in the argument list being completed.',
),
'*' => 'argv',
);
@@ -42,7 +43,6 @@
}
public function run() {
-
$pos = $this->getArgument('current');
$argv = $this->getArgument('argv', array());
$argc = count($argv);
@@ -50,6 +50,11 @@
$pos = $argc - 1;
}
+ if ($pos > $argc) {
+ throw new ArcanistUsageException(
+ 'Specified position is greater than the number of arguments provided.');
+ }
+
// Determine which revision control system the working copy uses, so we
// can filter out commands and flags which aren't supported. If we can't
// figure it out, just return all flags/commands.
@@ -70,7 +75,7 @@
$arc_config = $this->getArcanistConfiguration();
- if ($pos == 1) {
+ if ($pos <= 1) {
$workflows = $arc_config->buildAllWorkflows();
$complete = array();
@@ -81,8 +86,7 @@
$supported = $workflow->getSupportedRevisionControlSystems();
- $ok = (in_array('any', $supported)) ||
- (in_array($vcs, $supported));
+ $ok = (in_array('any', $supported) || in_array($vcs, $supported));
if (!$ok) {
continue;
}
@@ -146,7 +150,6 @@
}
return 0;
} else {
-
$output = array();
foreach ($arguments as $argument => $spec) {
if ($argument == '*') {
@@ -181,7 +184,7 @@
$branches = ipull($branches, 'name');
$output = $branches;
} else {
- $output = array("FILE");
+ $output = array('FILE');
}
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mon, Dec 23, 3:51 AM (2 h, 56 m)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6920505
Default Alt Text
D9268.id22008.diff (2 KB)
Attached To
Mode
D9268: Make `arc shell-complete` more robust.
Attached
Detach File
Event Timeline
Log In to Comment