The ZSH autocompletion works great for commands and flags. I have been having issues with completion .positional filename on a command gets clobbered by the .completion() builtin script.
I noticed that the bashrc has a fallback to filename completion. Not sure if that resolves the clobbering of the filename completion after the command is completed.
In this instance it will give be the command in tab completes, then immediately gives --name as the next complete option.
yargs.completion("completion", false)
yargs.command(
"dev <filename>",
"stuff described here",
(yargs) => {
return yargs
.positional("filename", { describe: "entry point", type: "string" })
.option("name", {
describe: "name of the script",
type: "string",
})
Autocomplete script in .zshrc
{app}_yargs_completions()
{
local reply
local si=$IFS
IFS=$'
' reply=($(COMP_CWORD="$((CURRENT-1))" COMP_LINE="$BUFFER" COMP_POINT="$CURSOR" {script} --get-yargs-completions "${words[@]}"))
IFS=$si
_describe 'values' reply
}
The ZSH autocompletion works great for commands and flags. I have been having issues with completion
.positionalfilename on a command gets clobbered by the.completion()builtin script.I noticed that the bashrc has a fallback to filename completion. Not sure if that resolves the clobbering of the filename completion after the command is completed.
In this instance it will give be the command in tab completes, then immediately gives --name as the next complete option.
Autocomplete script in .zshrc