From 760324021989b3c5fc8e1af4e453af2cae50083f Mon Sep 17 00:00:00 2001 From: Shohei YOSHIDA Date: Sun, 27 Aug 2023 20:43:14 +0900 Subject: [PATCH 1/2] Update nanoc completion and cleanup its code --- src/_nanoc | 74 +++++++++++++++++++++++------------------------------- 1 file changed, 31 insertions(+), 43 deletions(-) diff --git a/src/_nanoc b/src/_nanoc index d0a334da..c3f0bb04 100644 --- a/src/_nanoc +++ b/src/_nanoc @@ -23,7 +23,7 @@ # Description # ----------- # -# Completion script for nanoc (https://nanoc.app/) +# Completion script for nanoc 4.12.16 (https://nanoc.app/) # # ------------------------------------------------------------------------------ # Authors @@ -36,24 +36,26 @@ # # ------------------------------------------------------------------------------ -local ret=1 state +local ret=1 +local context state line +local curcontext="$curcontext" local -a common_ops common_ops=( {-C,--no-color}"[disable color]" {-V,--verbose}"[make output more detailed]" {-d,--debug}"[enable debugging]" - {-e,--env=}"[set environment]" - {-h,--help}"[show the help message and quit]" + {-e,--env=}"[set environment]:envvar:_parameters -g '*export*' -qS=" + '(- *)'{-h,--help}"[show the help message and quit]" {-l,--color}"[enable color]" - {-v,--version}"[show version information and quit]" + '(- *)'{-v,--version}"[show version information and quit]" {-w,--warn}"[enable warnings]" ) typeset -A opt_args -_arguments \ - ':subcommand:->subcommand' \ +_arguments -C \ $common_ops \ + '1:subcommand:->subcommand' \ '*::options:->options' && ret=0 case $state in @@ -74,83 +76,61 @@ case $state in ) _describe -t subcommands 'nanoc subcommand' subcommands && ret=0 - ;; - + ;; options) local -a args args=( $common_ops ) - local -a help - help=( - "--help[Display help information]" - ) - case $words[1] in check) args=( {-L,--list}"[list all checks]" {-a,--all}"[run all checks]" ) - ;; - + ;; compile) args=( + {-W,--watch}'[watch for changes and recompile when needed]' "--diff[generate diff]" ) - ;; - + ;; create-site) args=( "--force[force creation of new site]" ) - ;; - + ;; deploy) args=( {-C,--no-check}"[do not run the issue checks marked for deployment]" {-D,--list-deployers}"[list available deployers]" {-L,--list}"[list available locations to deploy to]" {-n,--dry-run}"[show what would be deployed]" - {-t,--target=}"[specify the location to deploy to (default:\`default\`)]" + {-t,--target=}"[specify the location to deploy to (default:\`default\`)]:target" ) - ;; - + ;; prune) args=( {-n,--dry-run}"[print files to be deleted instead of actually deleting them]" {-y,--yes}"[confirm deletion]" ) - ;; - + ;; shell) args=( {-p,--preprocess}"[run preprocessor]" ) - ;; - - show-data) + ;; + show-data|show-plugins|show-rules) args=( ) - ;; - - show-plugins) - args=( - ) - ;; - - show-rules) - args=( - ) - ;; - + ;; view) args=( - {-H,--handler=}"[specify the handler to use(webrick/mongrel/...)]" + {-H,--handler=}"[specify the handler to use(webrick/mongrel/...)]:handler" {-L,--live-reload}"[reload on changes]" - {-o,--host=}"[specify the host to listen on(default: 127.0.0.1)]" - {-p,--port=}"[specify the port to listen on(default: 3000)]" + {-o,--host=}"[specify the host to listen on(default: 127.0.0.1)]:host" + {-p,--port=}"[specify the port to listen on(default: 3000)]:port" ) ;; esac @@ -160,3 +140,11 @@ case $state in esac return ret + +# Local Variables: +# mode: Shell-Script +# sh-indentation: 2 +# indent-tabs-mode: nil +# sh-basic-offset: 2 +# End: +# vim: ft=zsh sw=2 ts=2 et From 796ee337fac490d2be50e92baf334d71b8abcd14 Mon Sep 17 00:00:00 2001 From: Shohei YOSHIDA Date: Mon, 28 Aug 2023 12:01:03 +0900 Subject: [PATCH 2/2] Accpet multiple env arguments --- src/_nanoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/_nanoc b/src/_nanoc index c3f0bb04..0a87f1a3 100644 --- a/src/_nanoc +++ b/src/_nanoc @@ -45,7 +45,7 @@ common_ops=( {-C,--no-color}"[disable color]" {-V,--verbose}"[make output more detailed]" {-d,--debug}"[enable debugging]" - {-e,--env=}"[set environment]:envvar:_parameters -g '*export*' -qS=" + \*{-e,--env=}"[set environment]:envvar:_parameters -g '*export*' -qS=" '(- *)'{-h,--help}"[show the help message and quit]" {-l,--color}"[enable color]" '(- *)'{-v,--version}"[show version information and quit]"