db82b8e8d86d159a3aa7396c3543657fdd8a66db
- Author
- Robby Russell <robby@planetargon.com>
- Committer
- Robby Russell <robby@planetargon.com>
- Date
Message
Diff
This diff is truncated to protect this page.
1diff --git a/plugins/bower/bower.plugin.zsh b/plugins/bower/bower.plugin.zsh
2index ed9c048400bdc77b90354d69e6de433b6c3032c0..68a67a3cc625d6c4afde142b14f5d60abfb6d1d3 100644
3--- a/plugins/bower/bower.plugin.zsh
4+++ b/plugins/bower/bower.plugin.zsh
5@@ -2,37 +2,80 @@ alias bi="bower install"
6 alias bl="bower list"
7 alias bs="bower search"
8
9-bower_package_list=''
10-
11+_bower_installed_packages () {
12+ bower_package_list=$(bower ls --no-color 2>/dev/null| awk 'NR>3{print p}{p=$0}'| cut -d ' ' -f 2|sed 's/#.*//')
13+}
14 _bower ()
15 {
16- local curcontext="$curcontext" state line
17- typeset -A opt_args
18-
19- _arguments -C \
20- ':command:->command' \
21- '*::options:->options'
22-
23- case $state in
24- (command)
25-
26- local -a subcommands
27- subcommands=(${=$(bower help | grep help | sed -e 's/,//g')})
28- _describe -t commands 'bower' subcommands
29- ;;
30-
31- (options)
32- case $line[1] in
33-
34- (install)
35- if [ -z "$bower_package_list" ];then
36- 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")
37- fi
38- compadd "$@" $(echo $bower_package_list)
39- ;;
40- esac
41- ;;
42- esac
43+ local -a _1st_arguments _no_color _dopts _save_dev _force_lastest _production
44+ local expl
45+ typeset -A opt_args
46+
47+ _no_color=('--no-color[Do not print colors (available in all commands)]')
48+
49+ _dopts=(
50+ '(--save)--save[Save installed packages into the project"s bower.json dependencies]'
51+ '(--force)--force[Force fetching remote resources even if a local copy exists on disk]'
52+ )
53+
54+ _save_dev=('(--save-dev)--save-dev[Save installed packages into the project"s bower.json devDependencies]')
55+
56+ _force_lastest=('(--force-latest)--force-latest[Force latest version on conflict]')
57+
58+ _production=('(--production)--production[Do not install project devDependencies]')
59+
60+ _1st_arguments=(
61+ 'cache-clean:Clean the Bower cache, or the specified package caches' \
62+ 'help:Display help information about Bower' \
63+ 'info:Version info and description of a particular package' \
64+ 'init:Interactively create a bower.json file' \
65+ 'install:Install a package locally' \
66+ 'link:Symlink a package folder' \
67+ 'lookup:Look up a package URL by name' \
68+ 'register:Register a package' \
69+ 'search:Search for a package by name' \
70+ 'uninstall:Remove a package' \
71+ 'update:Update a package' \
72+ {ls,list}:'[List all installed packages]'
73+ )
74+ _arguments \
75+ $_no_color \
76+ '*:: :->subcmds' && return 0
77+
78+ if (( CURRENT == 1 )); then
79+ _describe -t commands "bower subcommand" _1st_arguments
80+ return
81+ fi
82+
83+ case "$words[1]" in
84+ install)
85+ _arguments \
86+ $_dopts \
87+ $_save_dev \
88+ $_force_lastest \
89+ $_no_color \
90+ $_production
91+ ;;
92+ update)
93+ _arguments \
94+ $_dopts \
95+ $_no_color \
96+ $_force_lastest
97+ _bower_installed_packages
98+ compadd "$@" $(echo $bower_package_list)
99+ ;;
100+ uninstall)
101+ _arguments \
102+ $_no_color \
103+ $_dopts
104+ _bower_installed_packages