zola/completions/_zola

144 lines
4.2 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]' \
2019-08-25 17:15:12 +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]' \
2019-08-25 17:15:12 +00:00
'--drafts[Include drafts when loading the site]' \
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]' \
2019-08-25 17:15:12 +00:00
'--drafts[Include drafts when loading the site]' \
'-O[Open site in the default browser]' \
'--open[Open site in the default browser]' \
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
;;
2019-06-21 07:04:05 +00:00
(check)
_arguments "${_arguments_options[@]}" \
2019-08-25 17:15:12 +00:00
'--drafts[Include drafts when loading the site]' \
2019-06-21 07:04:05 +00:00
'-h[Prints help information]' \
'--help[Prints help information]' \
'-V[Prints version information]' \
'--version[Prints version information]' \
&& ret=0
;;
2017-07-15 04:24:31 +00:00
(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" \
2019-06-21 07:04:05 +00:00
"build:Deletes the output directory if there is one and builds the site" \
2017-07-15 04:24:31 +00:00
"serve:Serve the site. Rebuild and reload on change automatically" \
2019-06-21 07:04:05 +00:00
"check:Try building the project without rendering it. Checks links" \
2017-07-15 04:24:31 +00:00
"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
}
2019-06-21 07:04:05 +00:00
(( $+functions[_zola__check_commands] )) ||
_zola__check_commands() {
local commands; commands=(
)
_describe -t commands 'zola check commands' commands "$@"
}
(( $+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 "$@"