complete: Make -c optional

Currently, completions have to be specified like

```fish
complete -c foo -l opt
```

while

```fish
complete foo -l opt
```

just complains about there being too many arguments.

That's kinda useless, so we just assume if there is one left-over
argument that it's meant to be the command.

Theoretically we could also use *all* the arguments as commands to
complete, but that seems unlikely to be what the user wants.

(I don't think multi-command completions really happen)
This commit is contained in:
Fabian Homborg
2020-09-09 18:37:46 +02:00
parent a8e237f0f9
commit 903b7888d3
3 changed files with 20 additions and 1 deletions

View File

@@ -8,7 +8,7 @@ Synopsis
::
complete ( -c | --command | -p | --path ) COMMAND
complete [( -c | --command | -p | --path )] COMMAND
[( -c | --command | -p | --path ) COMMAND]...
[( -e | --erase )]
[( -s | --short-option ) SHORT_OPTION]...