|
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122 |
- #compdef zola
-
- autoload -U is-at-least
-
- _zola() {
- 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]' \
- ":: :_zola_commands" \
- "*::: :->zola" \
- && ret=0
- case $state in
- (zola)
- words=($line[1] "${words[@]}")
- (( CURRENT += 1 ))
- curcontext="${curcontext%:*:*}:zola-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[_zola_commands] )) ||
- _zola_commands() {
- local commands; commands=(
- "init:Create a new Zola 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 'zola commands' commands "$@"
- }
- (( $+functions[_zola__build_commands] )) ||
- _zola__build_commands() {
- local commands; commands=(
-
- )
- _describe -t commands 'zola build commands' commands "$@"
- }
- (( $+functions[_zola__help_commands] )) ||
- _zola__help_commands() {
- local commands; commands=(
-
- )
- _describe -t commands 'zola help commands' commands "$@"
- }
- (( $+functions[_zola__init_commands] )) ||
- _zola__init_commands() {
- local commands; commands=(
-
- )
- _describe -t commands 'zola init commands' commands "$@"
- }
- (( $+functions[_zola__serve_commands] )) ||
- _zola__serve_commands() {
- local commands; commands=(
-
- )
- _describe -t commands 'zola serve commands' commands "$@"
- }
-
- _zola "$@"
|