Mvn: Add a zstyle for always showing full form plugins

This commit is contained in:
Julien Nicoulaud 2011-08-08 22:20:02 +02:00
parent a032123791
commit 1a26ad9a87
1 changed files with 15 additions and 10 deletions

25
_mvn
View File

@ -39,8 +39,18 @@
# * Julien Nicoulaud <julien.nicoulaud@gmail.com> # * Julien Nicoulaud <julien.nicoulaud@gmail.com>
# #
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
# How to tweak # Notes
# ------------ # -----
#
# * By default advanced phases are displayed only if you start typing them. To have
# them always displayed:
#
# zstyle ':completion:*:mvn:*' show-all-phases true
#
# * By default full form plugins (groupId:artifactId[:version]) are only shown if you
# start typing them. To have them always displayed:
#
# zstyle ':completion:*:mvn:*' show-full-form-plugins true
# #
# * By default only the plugins for which the completion has already been # * By default only the plugins for which the completion has already been
# called ("mvn plugin:<TAB>") are shown. To define your own list of plugins: # called ("mvn plugin:<TAB>") are shown. To define your own list of plugins:
@ -48,11 +58,6 @@
# maven_plugins=(jboss tomcat gwt android) # maven_plugins=(jboss tomcat gwt android)
# zstyle ':completion:*:mvn:*' plugins $maven_plugins # zstyle ':completion:*:mvn:*' plugins $maven_plugins
# #
# * By default advanced phases are displayed only if you start typing them. To have
# them always displayed:
#
# zstyle ':completion:*:mvn:*' show-advanced-phases true
#
# * To have a better presentation of completions: # * To have a better presentation of completions:
# #
# zstyle ':completion:*:*:mvn:*:matches' group 'yes' # zstyle ':completion:*:*:mvn:*:matches' group 'yes'
@ -149,7 +154,7 @@ _mvn_phases() {
'site:generates the projects site documentation' 'site:generates the projects site documentation'
'site-deploy:deploys the generated site documentation to the specified web server' 'site-deploy:deploys the generated site documentation to the specified web server'
) )
if [[ $#PREFIX -gt 0 ]] || zstyle -t ":completion:${curcontext}:" show-advanced-phases; then if [[ $#PREFIX -gt 0 ]] || zstyle -t ":completion:${curcontext}:" show-all-phases; then
phases+=( phases+=(
'pre-clean:executes processes needed prior to the actual project cleaning' 'pre-clean:executes processes needed prior to the actual project cleaning'
'post-clean:executes processes needed to finalize the project cleaning' 'post-clean:executes processes needed to finalize the project cleaning'
@ -179,7 +184,7 @@ _mvn_phases() {
(( $+functions[_mvn_plugins] )) || (( $+functions[_mvn_plugins] )) ||
_mvn_plugins() { _mvn_plugins() {
local ret=1 local ret=1
if [[ $words[CURRENT] == *.* ]]; then if [[ $words[CURRENT] == *.* ]] || zstyle -t ":completion:${curcontext}:" show-full-form-plugins; then
_wanted full-form-plugins expl 'full form plugin' _mvn_full_form_plugins && ret=0 _wanted full-form-plugins expl 'full form plugin' _mvn_full_form_plugins && ret=0
else else
_wanted plugin-prefixes expl 'plugin prefix' _mvn_plugin_prefixes && ret=0 _wanted plugin-prefixes expl 'plugin prefix' _mvn_plugin_prefixes && ret=0
@ -190,7 +195,7 @@ _mvn_plugins() {
(( $+functions[_mvn_plugin_colon_goals] )) || (( $+functions[_mvn_plugin_colon_goals] )) ||
_mvn_plugin_colon_goals() { _mvn_plugin_colon_goals() {
local ret=1 local ret=1
if [[ $words[CURRENT] == *.* ]]; then if [[ $words[CURRENT] == *.* ]] || zstyle -t ":completion:${curcontext}:" show-full-form-plugins; then
_wanted full-form-plugin-colon-goals expl 'full form plugin colon goal' _mvn_full_form_plugin_colon_goals && ret=0 _wanted full-form-plugin-colon-goals expl 'full form plugin colon goal' _mvn_full_form_plugin_colon_goals && ret=0
else else
_wanted plugin-prefix-colon-goals expl 'plugin prefix colon goal' _mvn_plugin_prefix_colon_goals && ret=0 _wanted plugin-prefix-colon-goals expl 'plugin prefix colon goal' _mvn_plugin_prefix_colon_goals && ret=0