2017-07-15 04:24:31 +00:00
|
|
|
#compdef gutenberg
|
|
|
|
|
2018-02-02 16:37:30 +00:00
|
|
|
autoload -U is-at-least
|
|
|
|
|
2017-07-15 04:24:31 +00:00
|
|
|
_gutenberg() {
|
|
|
|
typeset -A opt_args
|
2018-02-02 16:37:30 +00:00
|
|
|
typeset -a _arguments_options
|
2017-07-15 04:24:31 +00:00
|
|
|
local ret=1
|
|
|
|
|
2018-02-02 16:37:30 +00:00
|
|
|
if is-at-least 5.2; then
|
|
|
|
_arguments_options=(-s -S -C)
|
|
|
|
else
|
|
|
|
_arguments_options=(-s -C)
|
|
|
|
fi
|
|
|
|
|
2017-07-15 04:24:31 +00:00
|
|
|
local context curcontext="$curcontext" state line
|
2018-02-02 16:37:30 +00:00
|
|
|
_arguments "${_arguments_options[@]}" \
|
2018-03-16 18:11:08 +00:00
|
|
|
'-c+[Path to a config file other than config.toml]' \
|
|
|
|
'--config=[Path to a config file other than config.toml]' \
|
2017-10-20 08:44:14 +00:00
|
|
|
'-h[Prints help information]' \
|
|
|
|
'--help[Prints help information]' \
|
|
|
|
'-V[Prints version information]' \
|
|
|
|
'--version[Prints version information]' \
|
2018-02-02 16:37:30 +00:00
|
|
|
":: :_gutenberg_commands" \
|
|
|
|
"*::: :->gutenberg" \
|
2017-07-15 04:24:31 +00:00
|
|
|
&& ret=0
|
|
|
|
case $state in
|
2017-10-20 08:44:14 +00:00
|
|
|
(gutenberg)
|
2018-02-02 16:37:30 +00:00
|
|
|
words=($line[1] "${words[@]}")
|
|
|
|
(( CURRENT += 1 ))
|
|
|
|
curcontext="${curcontext%:*:*}:gutenberg-command-$line[1]:"
|
2017-07-15 04:24:31 +00:00
|
|
|
case $line[1] in
|
|
|
|
(init)
|
2018-02-02 16:37:30 +00:00
|
|
|
_arguments "${_arguments_options[@]}" \
|
2017-10-20 08:44:14 +00:00
|
|
|
'-h[Prints help information]' \
|
|
|
|
'--help[Prints help information]' \
|
|
|
|
'-V[Prints version information]' \
|
|
|
|
'--version[Prints version information]' \
|
2018-02-02 16:37:30 +00:00
|
|
|
':name -- Name of the project. Will create a new directory with that name in the current directory:_files' \
|
2017-07-15 04:24:31 +00:00
|
|
|
&& ret=0
|
|
|
|
;;
|
|
|
|
(build)
|
2018-02-02 16:37:30 +00:00
|
|
|
_arguments "${_arguments_options[@]}" \
|
2017-10-20 08:44:14 +00:00
|
|
|
'-u+[Force the base URL to be that value (default to the one in config.toml)]' \
|
2018-02-02 16:37:30 +00:00
|
|
|
'--base-url=[Force the base URL to be that value (default to the one in config.toml)]' \
|
2017-12-29 18:25:06 +00:00
|
|
|
'-o+[Outputs the generated site in the given path]' \
|
2018-02-02 16:37:30 +00:00
|
|
|
'--output-dir=[Outputs the generated site in the given path]' \
|
2017-10-20 08:44:14 +00:00
|
|
|
'-h[Prints help information]' \
|
|
|
|
'--help[Prints help information]' \
|
|
|
|
'-V[Prints version information]' \
|
|
|
|
'--version[Prints version information]' \
|
2017-07-15 04:24:31 +00:00
|
|
|
&& ret=0
|
|
|
|
;;
|
|
|
|
(serve)
|
2018-02-02 16:37:30 +00:00
|
|
|
_arguments "${_arguments_options[@]}" \
|
2017-10-20 08:44:14 +00:00
|
|
|
'-i+[Interface to bind on]' \
|
2018-02-02 16:37:30 +00:00
|
|
|
'--interface=[Interface to bind on]' \
|
2017-10-20 08:44:14 +00:00
|
|
|
'-p+[Which port to use]' \
|
2018-02-02 16:37:30 +00:00
|
|
|
'--port=[Which port to use]' \
|
2017-12-29 18:25:06 +00:00
|
|
|
'-o+[Outputs the generated site in the given path]' \
|
2018-02-02 16:37:30 +00:00
|
|
|
'--output-dir=[Outputs the generated site in the given path]' \
|
|
|
|
'-u+[Changes the base_url]' \
|
|
|
|
'--base-url=[Changes the base_url]' \
|
2017-10-20 08:44:14 +00:00
|
|
|
'-h[Prints help information]' \
|
|
|
|
'--help[Prints help information]' \
|
|
|
|
'-V[Prints version information]' \
|
|
|
|
'--version[Prints version information]' \
|
2017-07-15 04:24:31 +00:00
|
|
|
&& ret=0
|
|
|
|
;;
|
|
|
|
(help)
|
2018-02-02 16:37:30 +00:00
|
|
|
_arguments "${_arguments_options[@]}" \
|
2017-10-20 08:44:14 +00:00
|
|
|
'-h[Prints help information]' \
|
|
|
|
'--help[Prints help information]' \
|
|
|
|
'-V[Prints version information]' \
|
|
|
|
'--version[Prints version information]' \
|
2017-07-15 04:24:31 +00:00
|
|
|
&& 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=(
|
2018-02-02 16:37:30 +00:00
|
|
|
|
2017-07-15 04:24:31 +00:00
|
|
|
)
|
|
|
|
_describe -t commands 'gutenberg init commands' commands "$@"
|
|
|
|
}
|
|
|
|
(( $+functions[_gutenberg__serve_commands] )) ||
|
|
|
|
_gutenberg__serve_commands() {
|
|
|
|
local commands; commands=(
|
2017-10-20 08:44:14 +00:00
|
|
|
|
2017-07-15 04:24:31 +00:00
|
|
|
)
|
|
|
|
_describe -t commands 'gutenberg serve commands' commands "$@"
|
|
|
|
}
|
|
|
|
|
|
|
|
_gutenberg "$@"
|