Add shell completion templates and manpage template

This commit is contained in:
2026-01-30 07:11:33 +00:00
parent be0bf538ea
commit 4c11569bb6

View File

@@ -0,0 +1,39 @@
#compdef _{{spec.name}} {{spec.name}}
# Zsh completion for {{spec.name}}
# Auto-generated by cli-spec-generator
_{{_name}}() {
local line
_arguments -C \
'(-h --help)'{-h,--help}'[Show help]' \
'(-v --version)'{-v,--version}'[Show version]' \
{{#each spec.globalOptions}}
'{{#if short}}-{{short}}, {{/if}}--{{name}}[{{escape description}}]' \
{{/each}}
{{#each spec.commands}}
'{{name}}[{{escape description}}]' \
{{/each}}
'*::arg:->args'
if [[ -z "$line" ]]; then
return
fi
local cmd="${line[1]}"
shift line
case "$cmd" in
{{#each spec.commands}}
{{name}})
_arguments \
{{#each options}}
'{{#if short}}-{{short}}, {{/if}}--{{name}}[{{escape description}}]' \
{{/each}}
'*::arg:->args'
;;
{{/each}}
esac
}
_{{_spec.name}} "$@"