Update nanoc completion and cleanup its code

This commit is contained in:
Shohei YOSHIDA 2023-08-27 20:43:14 +09:00
parent 5ccec94b18
commit 7603240219
No known key found for this signature in database
GPG Key ID: C9A1BB11BB940CF2
1 changed files with 31 additions and 43 deletions

View File

@ -23,7 +23,7 @@
# Description # Description
# ----------- # -----------
# #
# Completion script for nanoc (https://nanoc.app/) # Completion script for nanoc 4.12.16 (https://nanoc.app/)
# #
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
# Authors # Authors
@ -36,24 +36,26 @@
# #
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
local ret=1 state local ret=1
local context state line
local curcontext="$curcontext"
local -a common_ops local -a common_ops
common_ops=( common_ops=(
{-C,--no-color}"[disable color]" {-C,--no-color}"[disable color]"
{-V,--verbose}"[make output more detailed]" {-V,--verbose}"[make output more detailed]"
{-d,--debug}"[enable debugging]" {-d,--debug}"[enable debugging]"
{-e,--env=}"[set environment]" {-e,--env=}"[set environment]:envvar:_parameters -g '*export*' -qS="
{-h,--help}"[show the help message and quit]" '(- *)'{-h,--help}"[show the help message and quit]"
{-l,--color}"[enable color]" {-l,--color}"[enable color]"
{-v,--version}"[show version information and quit]" '(- *)'{-v,--version}"[show version information and quit]"
{-w,--warn}"[enable warnings]" {-w,--warn}"[enable warnings]"
) )
typeset -A opt_args typeset -A opt_args
_arguments \ _arguments -C \
':subcommand:->subcommand' \
$common_ops \ $common_ops \
'1:subcommand:->subcommand' \
'*::options:->options' && ret=0 '*::options:->options' && ret=0
case $state in case $state in
@ -74,83 +76,61 @@ case $state in
) )
_describe -t subcommands 'nanoc subcommand' subcommands && ret=0 _describe -t subcommands 'nanoc subcommand' subcommands && ret=0
;; ;;
options) options)
local -a args local -a args
args=( args=(
$common_ops $common_ops
) )
local -a help
help=(
"--help[Display help information]"
)
case $words[1] in case $words[1] in
check) check)
args=( args=(
{-L,--list}"[list all checks]" {-L,--list}"[list all checks]"
{-a,--all}"[run all checks]" {-a,--all}"[run all checks]"
) )
;; ;;
compile) compile)
args=( args=(
{-W,--watch}'[watch for changes and recompile when needed]'
"--diff[generate diff]" "--diff[generate diff]"
) )
;; ;;
create-site) create-site)
args=( args=(
"--force[force creation of new site]" "--force[force creation of new site]"
) )
;; ;;
deploy) deploy)
args=( args=(
{-C,--no-check}"[do not run the issue checks marked for deployment]" {-C,--no-check}"[do not run the issue checks marked for deployment]"
{-D,--list-deployers}"[list available deployers]" {-D,--list-deployers}"[list available deployers]"
{-L,--list}"[list available locations to deploy to]" {-L,--list}"[list available locations to deploy to]"
{-n,--dry-run}"[show what would be deployed]" {-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) prune)
args=( args=(
{-n,--dry-run}"[print files to be deleted instead of actually deleting them]" {-n,--dry-run}"[print files to be deleted instead of actually deleting them]"
{-y,--yes}"[confirm deletion]" {-y,--yes}"[confirm deletion]"
) )
;; ;;
shell) shell)
args=( args=(
{-p,--preprocess}"[run preprocessor]" {-p,--preprocess}"[run preprocessor]"
) )
;; ;;
show-data|show-plugins|show-rules)
show-data)
args=( args=(
) )
;; ;;
show-plugins)
args=(
)
;;
show-rules)
args=(
)
;;
view) view)
args=( 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]" {-L,--live-reload}"[reload on changes]"
{-o,--host=}"[specify the host to listen on(default: 127.0.0.1)]" {-o,--host=}"[specify the host to listen on(default: 127.0.0.1)]:host"
{-p,--port=}"[specify the port to listen on(default: 3000)]" {-p,--port=}"[specify the port to listen on(default: 3000)]:port"
) )
;; ;;
esac esac
@ -160,3 +140,11 @@ case $state in
esac esac
return ret 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