zsh-completions: implemented argument completion.

This commit is contained in:
Haim Ashkenazi
2018-03-23 13:09:56 +03:00
committed by Steve Francia
parent d262154093
commit edbb6712e2
3 changed files with 283 additions and 11 deletions

View File

@ -14,10 +14,25 @@ The generated completion script should be put somewhere in your `$fpath` named
flag value - if it's empty then completion will expect an argument.
* Flags of one of the various `*Arrary` and `*Slice` types supports multiple
specifications (with or without argument depending on the specific type).
* Completion of positional arguments using the following rules:
* Argument position for all options below starts at `1`. If argument position
`0` is requested it will raise an error.
* Use `command.MarkZshCompPositionalArgumentFile` to complete filenames. Glob
patterns (e.g. `"*.log"`) are optional - if not specified it will offer to
complete all file types.
* Use `command.MarkZshCompPositionalArgumentWords` to offer specific words for
completion. At least one word is required.
* It's possible to specify completion for some arguments and leave some
unspecified (e.g. offer words for second argument but nothing for first
argument). This will cause no completion for first argument but words
completion for second argument.
* If no argument completion was specified for 1st argument (but optionally was
specified for 2nd) and the command has `ValidArgs` it will be used as
completion options for 1st argument.
* Argument completions only offered for commands with no subcommands.
### What's not yet Supported
* Positional argument completion are not supported yet.
* Custom completion scripts are not supported yet (We should probably create zsh
specific one, doesn't make sense to re-use the bash one as the functions will
be different).