Skip to content

Commit

Permalink
feat(zsh): Add default completion as fallback
Browse files Browse the repository at this point in the history
Fallback to default completion if no match was found (see
https://zsh.sourceforge.io/Doc/Release/Completion-System.html#Completion-Functions
for details on `_default`).
  • Loading branch information
wkunert committed May 14, 2023
1 parent 6654a5d commit bfd56cf
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/completion-templates.ts
Expand Up @@ -42,7 +42,11 @@ _{{app_name}}_yargs_completions()
local si=$IFS
IFS=$'\n' reply=($(COMP_CWORD="$((CURRENT-1))" COMP_LINE="$BUFFER" COMP_POINT="$CURSOR" {{app_path}} --get-yargs-completions "\${words[@]}"))
IFS=$si
_describe 'values' reply || _default
if [ \${#reply[@]} -gt 0 ]; then
_describe 'values' reply
else
_default
fi
}
compdef _{{app_name}}_yargs_completions {{app_name}}
###-end-{{app_name}}-completions-###
Expand Down

0 comments on commit bfd56cf

Please sign in to comment.