This repository has been archived by the owner on Feb 21, 2023. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
static/completions/yak.zsh: Improve completion of commands after
--
.
I have found that yak's completion breaks down in the following situation: ```ShellSession $ yak env -- <TAB> ``` I expect it to expand possible executables, but instead, it completes filenames (which is just a Zsh fallback shining though, i believe). A side-effect is that completions for commands i rely on also break: ```ShellSession $ yak env -- aws <TAB> # Completes external commands, instead of aws-subcommands ``` This improvement does two things: * Enable the `-S` flag to `_arguments` as documented here: https://zsh.sourceforge.io/Doc/Release/Completion-System.html#Completion-Functions. Specifically, "-S -> Do not complete options after a ‘--’ appearing on the line, and ignore the ‘--’." * Don't modify the `words` array ourselves; just call `_normal` completion once we've got an environment specified in positional argument 1. Also, use 3 instead of 2 colons for `'*:::command...`, which according to the docs means: With three colons before the message, the words special array and the CURRENT special parameter are modified to refer only to the normal arguments covered by this description. * Finally, i've removed `--` as an explicit option, because `-S` takes care of this in a nice built-in way. Completions now work as i expect them to, with or without the `--` between yak and the command i'm keen to run.
- Loading branch information