aboutsummaryrefslogtreecommitdiffstats
path: root/src/_coffee
diff options
context:
space:
mode:
authordongweiming <ciici123@hotmail.com>2013-06-28 15:18:46 +0800
committerdongweiming <ciici123@hotmail.com>2013-06-28 15:18:46 +0800
commitbf701062dec41103e9bdf990f08dab1b393310ac (patch)
tree9c2cd10bccb8d9de37d447dbbffef78c3289930d /src/_coffee
parentMerge pull request #154 from panth0r/master (diff)
downloadzsh-completions-bf701062dec41103e9bdf990f08dab1b393310ac.tar
zsh-completions-bf701062dec41103e9bdf990f08dab1b393310ac.tar.gz
zsh-completions-bf701062dec41103e9bdf990f08dab1b393310ac.tar.bz2
zsh-completions-bf701062dec41103e9bdf990f08dab1b393310ac.tar.lz
zsh-completions-bf701062dec41103e9bdf990f08dab1b393310ac.tar.xz
zsh-completions-bf701062dec41103e9bdf990f08dab1b393310ac.tar.zst
zsh-completions-bf701062dec41103e9bdf990f08dab1b393310ac.zip
Update coffee completion
Diffstat (limited to 'src/_coffee')
-rw-r--r--src/_coffee16
1 files changed, 13 insertions, 3 deletions
diff --git a/src/_coffee b/src/_coffee
index 5c8eb9a..10b6b81 100644
--- a/src/_coffee
+++ b/src/_coffee
@@ -35,27 +35,37 @@
# -------
#
# * Mario Fernandez (https://github.com/sirech)
+# * Dong Weiming (https://github.com/dongweiming)
#
# ------------------------------------------------------------------------------
-local curcontext="$curcontext" state line ret=1
+local curcontext="$curcontext" state line ret=1 version opts first second third
typeset -A opt_args
+version=(${(f)"$(_call_program version $words[1] --version)"})
+version=${${(z)${version[1]}}[3]}
+first=$(echo $version|cut -d '.' -f 1)
+second=$(echo $version|cut -d '.' -f 2)
+third=$(echo $version|cut -d '.' -f 3)
+if (( $first < 2 )) && (( $second < 7 )) && (( $third < 3 ));then
+ opts+=('(-l --lint)'{-l,--lint}'[pipe the compiled JavaScript through JavaScript Lint]'
+ '(-r --require)'{-r,--require}'[require a library before executing your script]:library')
+fi
+
_arguments -C \
'(- *)'{-h,--help}'[display this help message]' \
'(- *)'{-v,--version}'[display the version number]' \
+ $opts \
'(-b --bare)'{-b,--bare}'[compile without a top-level function wrapper]' \
'(-e --eval)'{-e,--eval}'[pass a string from the command line as input]:Inline Script' \
'(-i --interactive)'{-i,--interactive}'[run an interactive CoffeeScript REPL]' \
'(-j --join)'{-j,--join}'[concatenate the source CoffeeScript before compiling]:Destination JS file:_files -g "*.js"' \
- '(-l --lint)'{-l,--lint}'[pipe the compiled JavaScript through JavaScript Lint]' \
'(--nodejs)--nodejs[pass options directly to the "node" binary]' \
'(-c --compile)'{-c,--compile}'[compile to JavaScript and save as .js files]' \
'(-o --output)'{-o,--output}'[set the output directory for compiled JavaScript]:Output Directory:_files -/' \
'(-n -t -p)'{-n,--nodes}'[print out the parse tree that the parser produces]' \
'(-n -t -p)'{-p,--print}'[print out the compiled JavaScript]' \
'(-n -t -p)'{-t,--tokens}'[print out the tokens that the lexer/rewriter produce]' \
- '(-r --require)'{-r,--require}'[require a library before executing your script]:library' \
'(-s --stdio)'{-s,--stdio}'[listen for and compile scripts over stdio]' \
'(-w --watch)'{-w,--watch}'[watch scripts for changes and rerun commands]' \
'*:script or directory:_files' && ret=0