Browse Source

Update completions

index-subcmd
Vincent Prouillet 6 years ago
parent
commit
8a76df0af3
4 changed files with 82 additions and 59 deletions
  1. +32
    -28
      completions/_gutenberg
  2. +5
    -5
      completions/_gutenberg.ps1
  3. +27
    -11
      completions/gutenberg.bash-completion
  4. +18
    -15
      completions/gutenberg.fish

+ 32
- 28
completions/_gutenberg View File

@@ -6,51 +6,56 @@ _gutenberg() {

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]" \
'-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" \
"*:: :->gutenberg" \
&& ret=0
case $state in
(Gutenberg)
(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]" \
'-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 \
"-h[Prints help information]" \
"--help[Prints help information]" \
"-V[Prints version information]" \
"--version[Prints version information]" \
'-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)]' \
'-h[Prints help information]' \
'--help[Prints help information]' \
'-V[Prints version information]' \
'--version[Prints version information]' \
&& ret=0
;;
(serve)
_arguments -s -S -C \
"-h[Prints help information]" \
"--help[Prints help information]" \
"-V[Prints version information]" \
"--version[Prints version information]" \
"1:: :_gutenberg__serve_commands" \
'-i+[Interface to bind on]' \
'--interface+[Interface to bind on]' \
'-p+[Which port to use]' \
'--port+[Which port to use]' \
'-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]" \
'-h[Prints help information]' \
'--help[Prints help information]' \
'-V[Prints version information]' \
'--version[Prints version information]' \
&& ret=0
;;
esac
@@ -85,15 +90,14 @@ _gutenberg__help_commands() {
(( $+functions[_gutenberg__init_commands] )) ||
_gutenberg__init_commands() {
local commands; commands=(
"NAME:Name of the project. Will create a directory with that name in the current directory" \
"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=(
"INTERFACE:Interface to bind on (default to 127.0.0.1)" \
"PORT:Which port to use (default to 1111)" \
)
_describe -t commands 'gutenberg serve commands' commands "$@"
}


+ 5
- 5
completions/_gutenberg.ps1 View File

@@ -9,8 +9,8 @@
%{
switch ($_.ToString()) {

'Gutenberg' {
$command += '_Gutenberg'
'gutenberg' {
$command += '_gutenberg'
break
}

@@ -45,7 +45,7 @@
switch ($command) {

'_gutenberg' {
$completions = @('init', 'build', 'serve', 'help', '-h', '-V', '-c', '--help', '--version', '--config')
$completions = @('init', 'build', 'serve', 'help', '-c', '-h', '-V', '--config', '--help', '--version')
}

'_gutenberg_init' {
@@ -53,11 +53,11 @@
}

'_gutenberg_build' {
$completions = @('-h', '-V', '--help', '--version')
$completions = @('-h', '-V', '-u', '--help', '--version', '--base-url')
}

'_gutenberg_serve' {
$completions = @('-h', '-V', '--help', '--version')
$completions = @('-h', '-V', '-i', '-p', '--help', '--version', '--interface', '--port')
}

'_gutenberg_help' {


+ 27
- 11
completions/gutenberg.bash-completion View File

@@ -32,21 +32,13 @@ _gutenberg() {

case "${cmd}" in
gutenberg)
opts=" -h -V -c --help --version --config init build serve help"
opts=" -c -h -V --config --help --version init build serve help"
if [[ ${cur} == -* || ${COMP_CWORD} -eq 1 ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
return 0
fi
case "${prev}" in
--config)
COMPREPLY=("<config>")
return 0
;;
-c)
COMPREPLY=("<config>")
return 0
;;
*)
COMPREPLY=()
;;
@@ -56,13 +48,21 @@ _gutenberg() {
;;
gutenberg__build)
opts=" -h -V --help --version "
opts=" -h -V -u --help --version --base-url "
if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
return 0
fi
case "${prev}" in
--base-url)
COMPREPLY=("<base_url>")
return 0
;;
-u)
COMPREPLY=("<base_url>")
return 0
;;
*)
COMPREPLY=()
;;
@@ -101,13 +101,29 @@ _gutenberg() {
return 0
;;
gutenberg__serve)
opts=" -h -V --help --version <interface> <port> "
opts=" -h -V -i -p --help --version --interface --port "
if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
return 0
fi
case "${prev}" in
--interface)
COMPREPLY=("<interface>")
return 0
;;
-i)
COMPREPLY=("<interface>")
return 0
;;
--port)
COMPREPLY=("<port>")
return 0
;;
-p)
COMPREPLY=("<port>")
return 0
;;
*)
COMPREPLY=()
;;


+ 18
- 15
completions/gutenberg.fish View File

@@ -11,18 +11,21 @@ function __fish_using_command
return 1
end

complete -c gutenberg -n "__fish_using_command gutenberg" -s c -l config -d "Path to a config file other than config.toml"
complete -c gutenberg -n "__fish_using_command gutenberg" -s h -l help -d "Prints help information"
complete -c gutenberg -n "__fish_using_command gutenberg" -s V -l version -d "Prints version information"
complete -c gutenberg -n "__fish_using_command gutenberg" -f -a "init" -d "Create a new Gutenberg project"
complete -c gutenberg -n "__fish_using_command gutenberg" -f -a "build" -d "Builds the site"
complete -c gutenberg -n "__fish_using_command gutenberg" -f -a "serve" -d "Serve the site. Rebuild and reload on change automatically"
complete -c gutenberg -n "__fish_using_command gutenberg" -f -a "help" -d "Prints this message or the help of the given subcommand(s)"
complete -c gutenberg -n "__fish_using_command gutenberg init" -s h -l help -d "Prints help information"
complete -c gutenberg -n "__fish_using_command gutenberg init" -s V -l version -d "Prints version information"
complete -c gutenberg -n "__fish_using_command gutenberg build" -s h -l help -d "Prints help information"
complete -c gutenberg -n "__fish_using_command gutenberg build" -s V -l version -d "Prints version information"
complete -c gutenberg -n "__fish_using_command gutenberg serve" -s h -l help -d "Prints help information"
complete -c gutenberg -n "__fish_using_command gutenberg serve" -s V -l version -d "Prints version information"
complete -c gutenberg -n "__fish_using_command gutenberg help" -s h -l help -d "Prints help information"
complete -c gutenberg -n "__fish_using_command gutenberg help" -s V -l version -d "Prints version information"
complete -c gutenberg -n "__fish_using_command gutenberg" -s c -l config -d 'Path to a config file other than config.toml'
complete -c gutenberg -n "__fish_using_command gutenberg" -s h -l help -d 'Prints help information'
complete -c gutenberg -n "__fish_using_command gutenberg" -s V -l version -d 'Prints version information'
complete -c gutenberg -n "__fish_using_command gutenberg" -f -a "init" -d 'Create a new Gutenberg project'
complete -c gutenberg -n "__fish_using_command gutenberg" -f -a "build" -d 'Builds the site'
complete -c gutenberg -n "__fish_using_command gutenberg" -f -a "serve" -d 'Serve the site. Rebuild and reload on change automatically'
complete -c gutenberg -n "__fish_using_command gutenberg" -f -a "help" -d 'Prints this message or the help of the given subcommand(s)'
complete -c gutenberg -n "__fish_using_command gutenberg init" -s h -l help -d 'Prints help information'
complete -c gutenberg -n "__fish_using_command gutenberg init" -s V -l version -d 'Prints version information'
complete -c gutenberg -n "__fish_using_command gutenberg build" -s u -l base-url -d 'Force the base URL to be that value (default to the one in config.toml)'
complete -c gutenberg -n "__fish_using_command gutenberg build" -s h -l help -d 'Prints help information'
complete -c gutenberg -n "__fish_using_command gutenberg build" -s V -l version -d 'Prints version information'
complete -c gutenberg -n "__fish_using_command gutenberg serve" -s i -l interface -d 'Interface to bind on'
complete -c gutenberg -n "__fish_using_command gutenberg serve" -s p -l port -d 'Which port to use'
complete -c gutenberg -n "__fish_using_command gutenberg serve" -s h -l help -d 'Prints help information'
complete -c gutenberg -n "__fish_using_command gutenberg serve" -s V -l version -d 'Prints version information'
complete -c gutenberg -n "__fish_using_command gutenberg help" -s h -l help -d 'Prints help information'
complete -c gutenberg -n "__fish_using_command gutenberg help" -s V -l version -d 'Prints version information'

Loading…
Cancel
Save