Skip to content

Commit 67921bc

Browse files
authored
Merge pull request #1031 from zsh-users/update_nanoc
Update nanoc completion and cleanup its code
2 parents 5ccec94 + 796ee33 commit 67921bc

File tree

1 file changed

+31
-43
lines changed

1 file changed

+31
-43
lines changed

src/_nanoc

Lines changed: 31 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
# Description
2424
# -----------
2525
#
26-
# Completion script for nanoc (https://nanoc.app/)
26+
# Completion script for nanoc 4.12.16 (https://nanoc.app/)
2727
#
2828
# ------------------------------------------------------------------------------
2929
# Authors
@@ -36,24 +36,26 @@
3636
#
3737
# ------------------------------------------------------------------------------
3838

39-
local ret=1 state
39+
local ret=1
40+
local context state line
41+
local curcontext="$curcontext"
4042

4143
local -a common_ops
4244
common_ops=(
4345
{-C,--no-color}"[disable color]"
4446
{-V,--verbose}"[make output more detailed]"
4547
{-d,--debug}"[enable debugging]"
46-
{-e,--env=}"[set environment]"
47-
{-h,--help}"[show the help message and quit]"
48+
\*{-e,--env=}"[set environment]:envvar:_parameters -g '*export*' -qS="
49+
'(- *)'{-h,--help}"[show the help message and quit]"
4850
{-l,--color}"[enable color]"
49-
{-v,--version}"[show version information and quit]"
51+
'(- *)'{-v,--version}"[show version information and quit]"
5052
{-w,--warn}"[enable warnings]"
5153
)
5254

5355
typeset -A opt_args
54-
_arguments \
55-
':subcommand:->subcommand' \
56+
_arguments -C \
5657
$common_ops \
58+
'1:subcommand:->subcommand' \
5759
'*::options:->options' && ret=0
5860

5961
case $state in
@@ -74,83 +76,61 @@ case $state in
7476
)
7577

7678
_describe -t subcommands 'nanoc subcommand' subcommands && ret=0
77-
;;
78-
79+
;;
7980
options)
8081
local -a args
8182
args=(
8283
$common_ops
8384
)
8485

85-
local -a help
86-
help=(
87-
"--help[Display help information]"
88-
)
89-
9086
case $words[1] in
9187
check)
9288
args=(
9389
{-L,--list}"[list all checks]"
9490
{-a,--all}"[run all checks]"
9591
)
96-
;;
97-
92+
;;
9893
compile)
9994
args=(
95+
{-W,--watch}'[watch for changes and recompile when needed]'
10096
"--diff[generate diff]"
10197
)
102-
;;
103-
98+
;;
10499
create-site)
105100
args=(
106101
"--force[force creation of new site]"
107102
)
108-
;;
109-
103+
;;
110104
deploy)
111105
args=(
112106
{-C,--no-check}"[do not run the issue checks marked for deployment]"
113107
{-D,--list-deployers}"[list available deployers]"
114108
{-L,--list}"[list available locations to deploy to]"
115109
{-n,--dry-run}"[show what would be deployed]"
116-
{-t,--target=}"[specify the location to deploy to (default:\`default\`)]"
110+
{-t,--target=}"[specify the location to deploy to (default:\`default\`)]:target"
117111
)
118-
;;
119-
112+
;;
120113
prune)
121114
args=(
122115
{-n,--dry-run}"[print files to be deleted instead of actually deleting them]"
123116
{-y,--yes}"[confirm deletion]"
124117
)
125-
;;
126-
118+
;;
127119
shell)
128120
args=(
129121
{-p,--preprocess}"[run preprocessor]"
130122
)
131-
;;
132-
133-
show-data)
123+
;;
124+
show-data|show-plugins|show-rules)
134125
args=(
135126
)
136-
;;
137-
138-
show-plugins)
139-
args=(
140-
)
141-
;;
142-
143-
show-rules)
144-
args=(
145-
)
146-
;;
147-
127+
;;
148128
view)
149129
args=(
150-
{-H,--handler=}"[specify the handler to use(webrick/mongrel/...)]"
130+
{-H,--handler=}"[specify the handler to use(webrick/mongrel/...)]:handler"
151131
{-L,--live-reload}"[reload on changes]"
152-
{-o,--host=}"[specify the host to listen on(default: 127.0.0.1)]"
153-
{-p,--port=}"[specify the port to listen on(default: 3000)]"
132+
{-o,--host=}"[specify the host to listen on(default: 127.0.0.1)]:host"
133+
{-p,--port=}"[specify the port to listen on(default: 3000)]:port"
154134
)
155135
;;
156136
esac
@@ -160,3 +140,11 @@ case $state in
160140
esac
161141

162142
return ret
143+
144+
# Local Variables:
145+
# mode: Shell-Script
146+
# sh-indentation: 2
147+
# indent-tabs-mode: nil
148+
# sh-basic-offset: 2
149+
# End:
150+
# vim: ft=zsh sw=2 ts=2 et

0 commit comments

Comments
 (0)