mirror of
https://we.phorge.it/source/arcanist.git
synced 2024-12-23 14:00:55 +01:00
Improve bash completion for commands like 'arc lint' and 'arc unit'.
Summary: Test Plan: Reviewers: CC:
This commit is contained in:
parent
1040046f3a
commit
834b375e47
1 changed files with 18 additions and 2 deletions
|
@ -123,6 +123,7 @@ EOTEXT
|
|||
}
|
||||
return 0;
|
||||
} else {
|
||||
|
||||
$output = array();
|
||||
foreach ($arguments as $argument => $spec) {
|
||||
if ($argument == '*') {
|
||||
|
@ -135,8 +136,23 @@ EOTEXT
|
|||
}
|
||||
$output[] = '--'.$argument;
|
||||
}
|
||||
|
||||
echo implode(' ', $output)."\n";
|
||||
|
||||
$cur = idx($argv, $pos, '');
|
||||
$any_match = false;
|
||||
foreach ($output as $possible) {
|
||||
if (!strncmp($possible, $cur, strlen($cur))) {
|
||||
$any_match = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (!$any_match && isset($arguments['*'])) {
|
||||
// TODO: the '*' specifier should probably have more details about
|
||||
// whether or not it is a list of files. Since it almost always is in
|
||||
// practice, assume FILE for now.
|
||||
echo "FILE\n";
|
||||
} else {
|
||||
echo implode(' ', $output)."\n";
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue