summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--plugins/bower/bower.plugin.zsh101
-rw-r--r--plugins/coffee/_coffee16
-rw-r--r--plugins/git/git.plugin.zsh2
-rw-r--r--plugins/rvm/rvm.plugin.zsh7
4 files changed, 89 insertions, 37 deletions
diff --git a/plugins/bower/bower.plugin.zsh b/plugins/bower/bower.plugin.zsh
index ed9c04840..68a67a3cc 100644
--- a/plugins/bower/bower.plugin.zsh
+++ b/plugins/bower/bower.plugin.zsh
@@ -2,37 +2,80 @@ alias bi="bower install"
alias bl="bower list"
alias bs="bower search"
-bower_package_list=''
-
+_bower_installed_packages () {
+ bower_package_list=$(bower ls --no-color 2>/dev/null| awk 'NR>3{print p}{p=$0}'| cut -d ' ' -f 2|sed 's/#.*//')
+}
_bower ()
{
- local curcontext="$curcontext" state line
- typeset -A opt_args
-
- _arguments -C \
- ':command:->command' \
- '*::options:->options'
-
- case $state in
- (command)
-
- local -a subcommands
- subcommands=(${=$(bower help | grep help | sed -e 's/,//g')})
- _describe -t commands 'bower' subcommands
- ;;
-
- (options)
- case $line[1] in
-
- (install)
- if [ -z "$bower_package_list" ];then
- bower_package_list=$(bower search | awk 'NR > 2' | cut -d '-' -f 2 | cut -d ' ' -f 2 | sed -r "s/\x1B\[([0-9]{1,2}(;[0-9]{1,2})?)?[m|K]//g")
- fi
- compadd "$@" $(echo $bower_package_list)
- ;;
- esac
- ;;
- esac
+ local -a _1st_arguments _no_color _dopts _save_dev _force_lastest _production
+ local expl
+ typeset -A opt_args
+
+ _no_color=('--no-color[Do not print colors (available in all commands)]')
+
+ _dopts=(
+ '(--save)--save[Save installed packages into the project"s bower.json dependencies]'
+ '(--force)--force[Force fetching remote resources even if a local copy exists on disk]'
+ )
+
+ _save_dev=('(--save-dev)--save-dev[Save installed packages into the project"s bower.json devDependencies]')
+
+ _force_lastest=('(--force-latest)--force-latest[Force latest version on conflict]')
+
+ _production=('(--production)--production[Do not install project devDependencies]')
+
+ _1st_arguments=(
+ 'cache-clean:Clean the Bower cache, or the specified package caches' \
+ 'help:Display help information about Bower' \
+ 'info:Version info and description of a particular package' \
+ 'init:Interactively create a bower.json file' \
+ 'install:Install a package locally' \
+ 'link:Symlink a package folder' \
+ 'lookup:Look up a package URL by name' \
+ 'register:Register a package' \
+ 'search:Search for a package by name' \
+ 'uninstall:Remove a package' \
+ 'update:Update a package' \
+ {ls,list}:'[List all installed packages]'
+ )
+ _arguments \
+ $_no_color \
+ '*:: :->subcmds' && return 0
+
+ if (( CURRENT == 1 )); then
+ _describe -t commands "bower subcommand" _1st_arguments
+ return
+ fi
+
+ case "$words[1]" in
+ install)
+ _arguments \
+ $_dopts \
+ $_save_dev \
+ $_force_lastest \
+ $_no_color \
+ $_production
+ ;;
+ update)
+ _arguments \
+ $_dopts \
+ $_no_color \
+ $_force_lastest
+ _bower_installed_packages
+ compadd "$@" $(echo $bower_package_list)
+ ;;
+ uninstall)
+ _arguments \
+ $_no_color \
+ $_dopts
+ _bower_installed_packages
+ compadd "$@" $(echo $bower_package_list)
+ ;;
+ *)
+ $_no_color \
+ ;;
+ esac
+
}
compdef _bower bower
diff --git a/plugins/coffee/_coffee b/plugins/coffee/_coffee
index 5c8eb9a08..10b6b8164 100644
--- a/plugins/coffee/_coffee
+++ b/plugins/coffee/_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
diff --git a/plugins/git/git.plugin.zsh b/plugins/git/git.plugin.zsh
index 851fdf24b..2ecc74eb6 100644
--- a/plugins/git/git.plugin.zsh
+++ b/plugins/git/git.plugin.zsh
@@ -78,7 +78,7 @@ compdef _git gm=git-mergetool
alias gg='git gui citool'
alias gga='git gui citool --amend'
alias gk='gitk --all --branches'
-alias gss='git stash show --text'
+alias gsts='git stash show --text'
# Will cd into the top of the current repository
# or submodule.
diff --git a/plugins/rvm/rvm.plugin.zsh b/plugins/rvm/rvm.plugin.zsh
index cdd0a7847..e6ad6450d 100644
--- a/plugins/rvm/rvm.plugin.zsh
+++ b/plugins/rvm/rvm.plugin.zsh
@@ -3,9 +3,9 @@ fpath=($rvm_path/scripts/zsh/Completion $fpath)
alias rubies='rvm list rubies'
alias gemsets='rvm gemset list'
-local ruby18='ruby-1.8.7-p371'
-local ruby19='ruby-1.9.3-p392'
-local ruby20='ruby-2.0.0-p0'
+local ruby18='ruby-1.8.7'
+local ruby19='ruby-1.9.3'
+local ruby20='ruby-2.0.0'
function rb18 {
if [ -z "$1" ]; then
@@ -42,7 +42,6 @@ compdef _rb20 rb20
function rvm-update {
rvm get head
- rvm reload # TODO: Reload rvm completion?
}
# TODO: Make this usable w/o rvm.