1
0
Fork 0
mirror of https://we.phorge.it/source/arcanist.git synced 2024-11-21 22:32:41 +01:00

Improve bash completion for commands like 'arc lint' and 'arc unit'.

Summary:

Test Plan:

Reviewers:

CC:
This commit is contained in:
epriestley 2011-02-16 11:51:06 -08:00
parent 1040046f3a
commit 834b375e47

View file

@ -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;
}
}