4fe4db51285af30f1195a817dadcf5d8b3b93e79

Author
dongweiming <ciici123@hotmail.com>
Committer
dongweiming <ciici123@hotmail.com>
Date

Message

Update coffee completion

Diff

 1diff --git a/plugins/coffee/_coffee b/plugins/coffee/_coffee
 2index 5c8eb9a084050bf740c12992af8b609cb99a104c..10b6b816489ddc43bb5d180519a0d93e37f91e4e 100644
 3--- a/plugins/coffee/_coffee
 4+++ b/plugins/coffee/_coffee
 5@@ -35,27 +35,37 @@
 6 # -------
 7 #
 8 #  * Mario Fernandez (https://github.com/sirech)
 9+#  * Dong Weiming (https://github.com/dongweiming)
10 #
11 # ------------------------------------------------------------------------------
12 
13-local curcontext="$curcontext" state line ret=1
14+local curcontext="$curcontext" state line ret=1 version opts first second third
15 typeset -A opt_args
16+version=(${(f)"$(_call_program version $words[1] --version)"})
17+version=${${(z)${version[1]}}[3]}
18+first=$(echo $version|cut -d '.' -f 1)
19+second=$(echo $version|cut -d '.' -f 2)
20+third=$(echo $version|cut -d '.' -f 3)
21+if (( $first < 2 )) &&  (( $second < 7 )) && (( $third < 3 ));then
22+  opts+=('(-l --lint)'{-l,--lint}'[pipe the compiled JavaScript through JavaScript Lint]'
23+         '(-r --require)'{-r,--require}'[require a library before executing your script]:library')
24+fi
25+
26 
27 _arguments -C \
28   '(- *)'{-h,--help}'[display this help message]' \
29   '(- *)'{-v,--version}'[display the version number]' \
30+  $opts \
31   '(-b --bare)'{-b,--bare}'[compile without a top-level function wrapper]' \
32   '(-e --eval)'{-e,--eval}'[pass a string from the command line as input]:Inline Script' \
33   '(-i --interactive)'{-i,--interactive}'[run an interactive CoffeeScript REPL]' \
34   '(-j --join)'{-j,--join}'[concatenate the source CoffeeScript before compiling]:Destination JS file:_files -g "*.js"' \
35-  '(-l --lint)'{-l,--lint}'[pipe the compiled JavaScript through JavaScript Lint]' \
36   '(--nodejs)--nodejs[pass options directly to the "node" binary]' \
37   '(-c --compile)'{-c,--compile}'[compile to JavaScript and save as .js files]' \
38   '(-o --output)'{-o,--output}'[set the output directory for compiled JavaScript]:Output Directory:_files -/' \
39   '(-n -t -p)'{-n,--nodes}'[print out the parse tree that the parser produces]' \
40   '(-n -t -p)'{-p,--print}'[print out the compiled JavaScript]' \
41   '(-n -t -p)'{-t,--tokens}'[print out the tokens that the lexer/rewriter produce]' \
42-  '(-r --require)'{-r,--require}'[require a library before executing your script]:library' \
43   '(-s --stdio)'{-s,--stdio}'[listen for and compile scripts over stdio]' \
44   '(-w --watch)'{-w,--watch}'[watch scripts for changes and rerun commands]' \
45   '*:script or directory:_files' && ret=0