zola/completions/_zola

123 lines
3.5 KiB
Plaintext
Raw Permalink Normal View History

#compdef zola
2017-07-15 04:24:31 +00:00
2018-02-02 16:37:30 +00:00
autoload -U is-at-least
_zola() {
2017-07-15 04:24:31 +00:00
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]' \
":: :_zola_commands" \
"*::: :->zola" \
2017-07-15 04:24:31 +00:00
&& ret=0
case $state in
(zola)
2018-02-02 16:37:30 +00:00
words=($line[1] "${words[@]}")
(( CURRENT += 1 ))
curcontext="${curcontext%:*:*}:zola-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)]' \
'-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]' \
'-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]' \
2018-11-12 20:37:26 +00:00
'--watch-only[Do not start a server, just re-build project on changes]' \
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[_zola_commands] )) ||
_zola_commands() {
2017-07-15 04:24:31 +00:00
local commands; commands=(
"init:Create a new Zola project" \
2017-07-15 04:24:31 +00:00
"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 'zola commands' commands "$@"
2017-07-15 04:24:31 +00:00
}
(( $+functions[_zola__build_commands] )) ||
_zola__build_commands() {
2017-07-15 04:24:31 +00:00
local commands; commands=(
)
_describe -t commands 'zola build commands' commands "$@"
2017-07-15 04:24:31 +00:00
}
(( $+functions[_zola__help_commands] )) ||
_zola__help_commands() {
2017-07-15 04:24:31 +00:00
local commands; commands=(
)
_describe -t commands 'zola help commands' commands "$@"
2017-07-15 04:24:31 +00:00
}
(( $+functions[_zola__init_commands] )) ||
_zola__init_commands() {
2017-07-15 04:24:31 +00:00
local commands; commands=(
2018-02-02 16:37:30 +00:00
2017-07-15 04:24:31 +00:00
)
_describe -t commands 'zola init commands' commands "$@"
2017-07-15 04:24:31 +00:00
}
(( $+functions[_zola__serve_commands] )) ||
_zola__serve_commands() {
2017-07-15 04:24:31 +00:00
local commands; commands=(
2017-10-20 08:44:14 +00:00
2017-07-15 04:24:31 +00:00
)
_describe -t commands 'zola serve commands' commands "$@"
2017-07-15 04:24:31 +00:00
}
_zola "$@"