14edd2b875
From #191
109 lines
3.1 KiB
Plaintext
109 lines
3.1 KiB
Plaintext
#compdef gutenberg
|
|
|
|
_gutenberg() {
|
|
typeset -A opt_args
|
|
local ret=1
|
|
|
|
local context curcontext="$curcontext" state line
|
|
_arguments -s -S -C \
|
|
'-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]' \
|
|
"1:: :_gutenberg_commands" \
|
|
"*:: :->gutenberg" \
|
|
&& ret=0
|
|
case $state in
|
|
(gutenberg)
|
|
curcontext="${curcontext%:*:*}:gutenberg-command-$words[1]:"
|
|
case $line[1] in
|
|
(init)
|
|
_arguments -s -S -C \
|
|
'-h[Prints help information]' \
|
|
'--help[Prints help information]' \
|
|
'-V[Prints version information]' \
|
|
'--version[Prints version information]' \
|
|
"1:: :_gutenberg__init_commands" \
|
|
&& ret=0
|
|
;;
|
|
(build)
|
|
_arguments -s -S -C \
|
|
'-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 -s -S -C \
|
|
'-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]' \
|
|
'-h[Prints help information]' \
|
|
'--help[Prints help information]' \
|
|
'-V[Prints version information]' \
|
|
'--version[Prints version information]' \
|
|
&& ret=0
|
|
;;
|
|
(help)
|
|
_arguments -s -S -C \
|
|
'-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=(
|
|
"NAME:Name of the project. Will create a new directory with that name in the current directory" \
|
|
)
|
|
_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 "$@" |