Skip to content

Commit

Permalink
fix: zsh completion is now autoloadable
Browse files Browse the repository at this point in the history
  • Loading branch information
gardenappl committed Jan 25, 2021
1 parent 169b815 commit 28b734f
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions lib/completion-templates.ts
Expand Up @@ -28,21 +28,22 @@ complete -o default -F _yargs_completions {{app_name}}
###-end-{{app_name}}-completions-###
`;

export const completionZshTemplate = `###-begin-{{app_name}}-completions-###
export const completionZshTemplate = `#compdef {{app_name}}
###-begin-{{app_name}}-completions-###
#
# yargs command completion script
#
# Installation: {{app_path}} {{completion_command}} >> ~/.zshrc
# or {{app_path}} {{completion_command}} >> ~/.zsh_profile on OSX.
#
_{{app_name}}_yargs_completions()
_{{app_name}}()
{
local reply
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
}
compdef _{{app_name}}_yargs_completions {{app_name}}
compdef _{{app_name}} {{app_name}}
###-end-{{app_name}}-completions-###
`;

0 comments on commit 28b734f

Please sign in to comment.