zola/completions/_gutenberg
Vincent Prouillet 2eacb8247b Fix config CLI option
Closes #254
2018-03-16 19:11:12 +01:00

122 lines
3.5 KiB
Plaintext

#compdef gutenberg
autoload -U is-at-least
_gutenberg() {
typeset -A opt_args
typeset -a _arguments_options
local ret=1
if is-at-least 5.2; then
_arguments_options=(-s -S -C)
else
_arguments_options=(-s -C)
fi
local context curcontext="$curcontext" state line
_arguments "${_arguments_options[@]}" \
'-c+[Path to a config file other than config.toml]' \
'--config=[Path to a config file other than config.toml]' \
'-h[Prints help information]' \
'--help[Prints help information]' \
'-V[Prints version information]' \
'--version[Prints version information]' \
":: :_gutenberg_commands" \
"*::: :->gutenberg" \
&& ret=0
case $state in
(gutenberg)
words=($line[1] "${words[@]}")
(( CURRENT += 1 ))
curcontext="${curcontext%:*:*}:gutenberg-command-$line[1]:"
case $line[1] in
(init)
_arguments "${_arguments_options[@]}" \
'-h[Prints help information]' \
'--help[Prints help information]' \
'-V[Prints version information]' \
'--version[Prints version information]' \
':name -- Name of the project. Will create a new directory with that name in the current directory:_files' \
&& ret=0
;;
(build)
_arguments "${_arguments_options[@]}" \
'-u+[Force the base URL to be that value (default to the one in config.toml)]' \
'--base-url=[Force the base URL to be that value (default to the one in config.toml)]' \
'-o+[Outputs the generated site in the given path]' \
'--output-dir=[Outputs the generated site in the given path]' \
'-h[Prints help information]' \
'--help[Prints help information]' \
'-V[Prints version information]' \
'--version[Prints version information]' \
&& ret=0
;;
(serve)
_arguments "${_arguments_options[@]}" \
'-i+[Interface to bind on]' \
'--interface=[Interface to bind on]' \
'-p+[Which port to use]' \
'--port=[Which port to use]' \
'-o+[Outputs the generated site in the given path]' \
'--output-dir=[Outputs the generated site in the given path]' \
'-u+[Changes the base_url]' \
'--base-url=[Changes the base_url]' \
'-h[Prints help information]' \
'--help[Prints help information]' \
'-V[Prints version information]' \
'--version[Prints version information]' \
&& ret=0
;;
(help)
_arguments "${_arguments_options[@]}" \
'-h[Prints help information]' \
'--help[Prints help information]' \
'-V[Prints version information]' \
'--version[Prints version information]' \
&& ret=0
;;
esac
;;
esac
}
(( $+functions[_gutenberg_commands] )) ||
_gutenberg_commands() {
local commands; commands=(
"init:Create a new Gutenberg project" \
"build:Builds the site" \
"serve:Serve the site. Rebuild and reload on change automatically" \
"help:Prints this message or the help of the given subcommand(s)" \
)
_describe -t commands 'gutenberg commands' commands "$@"
}
(( $+functions[_gutenberg__build_commands] )) ||
_gutenberg__build_commands() {
local commands; commands=(
)
_describe -t commands 'gutenberg build commands' commands "$@"
}
(( $+functions[_gutenberg__help_commands] )) ||
_gutenberg__help_commands() {
local commands; commands=(
)
_describe -t commands 'gutenberg help commands' commands "$@"
}
(( $+functions[_gutenberg__init_commands] )) ||
_gutenberg__init_commands() {
local commands; commands=(
)
_describe -t commands 'gutenberg init commands' commands "$@"
}
(( $+functions[_gutenberg__serve_commands] )) ||
_gutenberg__serve_commands() {
local commands; commands=(
)
_describe -t commands 'gutenberg serve commands' commands "$@"
}
_gutenberg "$@"