From f179d183ef38f6a634197c93d16de4a2fff57efc Mon Sep 17 00:00:00 2001 From: Vincent Prouillet Date: Fri, 2 Feb 2018 17:37:30 +0100 Subject: [PATCH] Update completions --- completions/_gutenberg | 43 +++++++++++++++++++++++++------------- completions/_gutenberg.ps1 | 2 +- completions/gutenberg.bash | 10 ++++++++- completions/gutenberg.fish | 1 + 4 files changed, 39 insertions(+), 17 deletions(-) diff --git a/completions/_gutenberg b/completions/_gutenberg index 99c9909..465719f 100644 --- a/completions/_gutenberg +++ b/completions/_gutenberg @@ -1,39 +1,50 @@ #compdef gutenberg +autoload -U is-at-least + _gutenberg() { 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 -s -S -C \ + _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]' \ -"1:: :_gutenberg_commands" \ -"*:: :->gutenberg" \ +":: :_gutenberg_commands" \ +"*::: :->gutenberg" \ && ret=0 case $state in (gutenberg) - curcontext="${curcontext%:*:*}:gutenberg-command-$words[1]:" + words=($line[1] "${words[@]}") + (( CURRENT += 1 )) + curcontext="${curcontext%:*:*}:gutenberg-command-$line[1]:" case $line[1] in (init) -_arguments -s -S -C \ +_arguments "${_arguments_options[@]}" \ '-h[Prints help information]' \ '--help[Prints help information]' \ '-V[Prints version information]' \ '--version[Prints version information]' \ -"1:: :_gutenberg__init_commands" \ +':name -- Name of the project. Will create a new directory with that name in the current directory:_files' \ && ret=0 ;; (build) -_arguments -s -S -C \ +_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)]' \ +'--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]' \ +'--output-dir=[Outputs the generated site in the given path]' \ '-h[Prints help information]' \ '--help[Prints help information]' \ '-V[Prints version information]' \ @@ -41,13 +52,15 @@ _arguments -s -S -C \ && ret=0 ;; (serve) -_arguments -s -S -C \ +_arguments "${_arguments_options[@]}" \ '-i+[Interface to bind on]' \ -'--interface+[Interface to bind on]' \ +'--interface=[Interface to bind on]' \ '-p+[Which port to use]' \ -'--port+[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]' \ +'--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]' \ @@ -55,7 +68,7 @@ _arguments -s -S -C \ && ret=0 ;; (help) -_arguments -s -S -C \ +_arguments "${_arguments_options[@]}" \ '-h[Prints help information]' \ '--help[Prints help information]' \ '-V[Prints version information]' \ @@ -94,7 +107,7 @@ _gutenberg__help_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 "$@" } diff --git a/completions/_gutenberg.ps1 b/completions/_gutenberg.ps1 index 49159b8..8448a77 100644 --- a/completions/_gutenberg.ps1 +++ b/completions/_gutenberg.ps1 @@ -57,7 +57,7 @@ } '_gutenberg_serve' { - $completions = @('-h', '-V', '-i', '-p', '-o', '--help', '--version', '--interface', '--port', '--output-dir') + $completions = @('-h', '-V', '-i', '-p', '-o', '-u', '--help', '--version', '--interface', '--port', '--output-dir', '--base-url') } '_gutenberg_help' { diff --git a/completions/gutenberg.bash b/completions/gutenberg.bash index 3fed15c..23159a5 100644 --- a/completions/gutenberg.bash +++ b/completions/gutenberg.bash @@ -109,7 +109,7 @@ _gutenberg() { return 0 ;; gutenberg__serve) - opts=" -h -V -i -p -o --help --version --interface --port --output-dir " + opts=" -h -V -i -p -o -u --help --version --interface --port --output-dir --base-url " if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) ) return 0 @@ -140,6 +140,14 @@ _gutenberg() { COMPREPLY=("") return 0 ;; + --base-url) + COMPREPLY=("") + return 0 + ;; + -u) + COMPREPLY=("") + return 0 + ;; *) COMPREPLY=() ;; diff --git a/completions/gutenberg.fish b/completions/gutenberg.fish index f7befb2..3627b32 100644 --- a/completions/gutenberg.fish +++ b/completions/gutenberg.fish @@ -27,6 +27,7 @@ complete -c gutenberg -n "__fish_using_command gutenberg build" -s V -l version 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 o -l output-dir -d 'Outputs the generated site in the given path' +complete -c gutenberg -n "__fish_using_command gutenberg serve" -s u -l base-url -d 'Changes the base_url' 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'