Merge pull request #934 from zsh-users/update-coffee

Update coffee completion
This commit is contained in:
Shohei YOSHIDA 2022-11-18 11:52:14 +09:00 committed by GitHub
commit ba6f1e662e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 20 additions and 25 deletions

View File

@ -1,6 +1,6 @@
#compdef coffee
# ------------------------------------------------------------------------------
# Copyright (c) 2011 Github zsh-users - http://github.com/zsh-users
# Copyright (c) 2011 Github zsh-users - https://github.com/zsh-users
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
@ -28,7 +28,7 @@
# Description
# -----------
#
# Completion script for Coffee.js v0.6.11 (http://coffeejs.org)
# Completion script for Coffee.js v2.7.0 (https://coffeescript.org/)
#
# ------------------------------------------------------------------------------
# Authors
@ -39,34 +39,29 @@
#
# ------------------------------------------------------------------------------
local curcontext="$curcontext" state line ret=1 version opts first second third
local curcontext="$curcontext" state line ret=1
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 \
_arguments -s -S \
'--ast[generate an abstract syntax tree of nodes]' \
'(-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"' \
'(--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]' \
'(-e --eval)'{-e,--eval}'[pass a string from the command line as input]:Inline Script' \
'(- *)'{-h,--help}'[display this help message]' \
'(-i --interactive)'{-i,--interactive}'[run an interactive CoffeeScript REPL]' \
'(-j --join)'{-j,--join}'[concatenate the source CoffeeScript before compiling]: :_files -g "*.coffee"' \
'(-l --literate)'{-l,--literate}'[treat stdio as literate style coffeescript]' \
'(-m --map)'{-m,--map}'[generate source map and save as .js.map files]' \
'(-M --inline-map)'{-M,--inline-map}'[generate source map and include it directly in output]' \
'(-n --nodes)'{-n,--nodes}'[print out the parse tree that the parser produces]' \
'--nodejs[pass options directly to the "node" binary]' \
'(-o --output)'{-o,--output}'[set the output directory for compiled JavaScript]: :_files' \
'(-p --print --tokens)'{-p,--print}'[print out the compiled JavaScript]' \
'(-r --require)'\*{-r,--require}'[require the given module before eval or REPL]:module' \
'(-s --stdio)'{-s,--stdio}'[listen for and compile scripts over stdio]' \
'(-t --transpile)'{-t,--transpile}'[pipe generated JavaScript through Babel]' \
'(-p --print --tokens)--tokens[print out the tokens that the lexer/rewriter produce]' \
'(- *)'{-v,--version}'[display the version number]' \
'(-w --watch)'{-w,--watch}'[watch scripts for changes and rerun commands]' \
'*:script or directory:_files' && ret=0