1
0
Fork 0
mirror of https://we.phorge.it/source/arcanist.git synced 2024-12-23 05:50:54 +01:00

When tab-completing "arc" commands, suggest paths if the argument is empty and a path wildcard argument exists

Summary:
Currently, if you type "arc upload <tab>", we do not autocomplete the working directory. We should, but the "current argument" is the empty string and that's technically a prefix of every flag, so we suggest that you might want a flag instead.

You probably don't. Suggest paths in this case.

Test Plan:
  - Ran "arc upload <tab>", saw path completions.
  - Ran "arc land <tab>" (this workflow does NOT take paths as arguments), saw flag completions.

Differential Revision: https://secure.phabricator.com/D21385
This commit is contained in:
epriestley 2020-07-01 05:33:33 -07:00
parent 7e9f80971b
commit 17f2668d1f

View file

@ -585,12 +585,18 @@ EOTEXT
$matches = $this->getMatches($flags, $current);
// If whatever the user is completing does not match the prefix of any
// flag, try to autcomplete a wildcard argument if it has some kind of
// meaningful completion. For example, "arc lint READ<tab>" should
// autocomplete a file.
// flag (or is entirely empty), try to autcomplete a wildcard argument
// if it has some kind of meaningful completion. For example, "arc lint
// READ<tab>" should autocomplete a file, and "arc lint <tab>" should
// suggest files in the current directory.
if (!$matches && $wildcard) {
if (!strlen($current) || !$matches) {
$try_paths = true;
} else {
$try_paths = false;
}
if ($try_paths && $wildcard) {
// TOOLSETS: There was previously some very questionable support for
// autocompleting branches here. This could be moved into Arguments
// and Workflows.