Add shell completion templates and manpage template

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

View File

@@ -0,0 +1,43 @@
# bash completion for {{spec.name}} v{{spec.version}} #
# Auto-generated by cli-spec-generator
{{spec.name}}() {
local cur prev words cword
_init_completion || return
# Main commands
if [[ $cword -eq 1 ]]; then
COMPREPLY=( $( compgen -W '
{{#each spec.commands}}
{{name}}{{#if aliases}} {{aliases}}{{/if}}
{{/each}}
--help
--version
' -- "$cur" ) )
return
fi
# Command-specific options and arguments
local cmd="${words[1]}"
case "$cmd" in
{{#each spec.commands}}
{{name}})
if [[ "$prev" == "--"* ]]; then
COMPREPLY=( $( compgen -W '
{{#each options}}
--{{name}}{{#if short}} -{{short}}{{/if}}
{{/each}}
--help
' -- "$cur" ) )
else
COMPREPLY=( $( compgen -W '
{{#each options}}
--{{name}}{{#if short}} -{{short}}{{/if}}
{{/each}}
--help
' -- "$cur" ) )
fi
;;
{{/each}}
esac
} && complete -F {{spec.name}} {{spec.name}}