Mvn: Some cleaning
This commit is contained in:
parent
30515972f2
commit
3e0ecc2846
104
_mvn
104
_mvn
|
@ -155,7 +155,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 zstyle -t ":completion:${curcontext}:" show-advanced-phases || [[ $#PREFIX -gt 0 ]]; then
|
if [[ $#PREFIX -gt 0 ]] || zstyle -t ":completion:${curcontext}:" show-advanced-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'
|
||||||
|
@ -199,17 +199,19 @@ _mvn_plugins() {
|
||||||
local plugins
|
local plugins
|
||||||
# TODO Add the plugins for which we have a cache
|
# TODO Add the plugins for which we have a cache
|
||||||
zstyle -a ":completion:${curcontext}:" plugins plugins
|
zstyle -a ":completion:${curcontext}:" plugins plugins
|
||||||
[[ $#plugins -gt 0 ]] || plugins=(
|
if [[ $#plugins -eq 0 ]]; then
|
||||||
'assembly:create archives of your projects sources, classes, dependencies etc. from flexible assembly descriptors'
|
plugins=(
|
||||||
'release:release a project with Maven, saving a lot of repetitive, manual work'
|
'assembly:create archives of your projects sources, classes, dependencies etc. from flexible assembly descriptors'
|
||||||
'help:provides goals aimed at helping to make sense out of the build environment.'
|
'release:release a project with Maven, saving a lot of repetitive, manual work'
|
||||||
'versions:diagnose and update the versions of components in the POM'
|
'help:provides goals aimed at helping to make sense out of the build environment.'
|
||||||
'deploy:add your artifact(s) to a remote repository for sharing with other developers and project'
|
'versions:diagnose and update the versions of components in the POM'
|
||||||
'dependency:provides the capability to manipulate artifacts'
|
'deploy:add your artifact(s) to a remote repository for sharing with other developers and project'
|
||||||
'archetype:create a Maven project from an existing template called an archetype'
|
'dependency:provides the capability to manipulate artifacts'
|
||||||
'site:generate a site for the project'
|
'archetype:create a Maven project from an existing template called an archetype'
|
||||||
'install:copies the project artifacts to the local repository.'
|
'site:generate a site for the project'
|
||||||
)
|
'install:copies the project artifacts to the local repository.'
|
||||||
|
)
|
||||||
|
fi
|
||||||
_describe -t 'plugin' "plugin" plugins -S ':'
|
_describe -t 'plugin' "plugin" plugins -S ':'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -357,59 +359,71 @@ _mvn_projects() {
|
||||||
_mvn_properties() {
|
_mvn_properties() {
|
||||||
local ret=1
|
local ret=1
|
||||||
if compset -P '*='; then
|
if compset -P '*='; then
|
||||||
local property=${${IPREFIX%=}#-D}
|
_wanted property-value expl 'property value' _mvn_property_values ${${IPREFIX%=}#-D} && ret=0
|
||||||
case $property in
|
|
||||||
file) _wanted file expl 'file' _files && ret=0;;
|
|
||||||
pomFile) _wanted pom-file expl 'POM file' _mvn_pom_files && ret=0;;
|
|
||||||
groupId) _wanted groupId expl 'groupId' _mvn_groupIds && ret=0;;
|
|
||||||
artifactId) _wanted artifactId expl 'artifactId' _mvn_artifactIds && ret=0;;
|
|
||||||
repositoryId) _message -e repositoryIds 'repositoryId' && ret=0;; # TODO Not implemented
|
|
||||||
classifier) _message -e classifiers 'classifier' && ret=0;;
|
|
||||||
scope) _wanted scope expl 'scope' _mvn_scopes && ret=0;;
|
|
||||||
*url*) _wanted url expl 'url' _urls && ret=0;; # TODO Use _alternative and add repository urls from settings + projects
|
|
||||||
*password|*passphrase) _wanted password expl $property _mvn_passwords && ret=0;;
|
|
||||||
version) _wanted version expl 'version' _mvn_versions && ret=0;;
|
|
||||||
createChecksum|generatePom|maven.test.skip) _wanted boolean expl 'boolean' _mvn_booleans && ret=0;;
|
|
||||||
user|username) _wanted user expl 'user' _users && ret=0;; # TODO Use _alternative and add repository usernames from settings + projects
|
|
||||||
*) _default && ret=0;;
|
|
||||||
esac
|
|
||||||
else
|
else
|
||||||
local alternatives; alternatives=(
|
_wanted property-name expl 'property name' _mvn_property_names && ret=0
|
||||||
'maven properties:maven property:_mvn_maven_properties'
|
|
||||||
)
|
|
||||||
for plugin_colon_goal in ${(M)words:#*:*}; do # FIXME pretty sure this matches more than just plugin:goals
|
|
||||||
alternatives+=("plugin properties:plugin property:_mvn_plugin_goal_properties '${plugin_colon_goal%:*}' '${plugin_colon_goal#*:}'")
|
|
||||||
done
|
|
||||||
_alternative "${alternatives[@]}" && ret=0
|
|
||||||
fi
|
fi
|
||||||
return ret
|
return ret
|
||||||
}
|
}
|
||||||
|
|
||||||
(( $+functions[_mvn_maven_properties] )) ||
|
(( $+functions[_mvn_property_names] )) ||
|
||||||
_mvn_maven_properties() {
|
_mvn_property_names() {
|
||||||
# TODO Split in properties with values/properties without
|
local alternatives; alternatives=(
|
||||||
|
'common property names:common property:_mvn_common_property_names'
|
||||||
|
)
|
||||||
|
for plugin_colon_goal in ${(M)words:#*:*}; do # FIXME pretty sure this matches more than just plugin:goals
|
||||||
|
alternatives+=("plugin property names:plugin property name:_mvn_plugin_goal_property_names '${plugin_colon_goal%:*}' '${plugin_colon_goal#*:}'")
|
||||||
|
done
|
||||||
|
_alternative "${alternatives[@]}"
|
||||||
|
}
|
||||||
|
|
||||||
|
(( $+functions[_mvn_common_property_names] )) ||
|
||||||
|
_mvn_common_property_names() {
|
||||||
local properties; properties=(
|
local properties; properties=(
|
||||||
'skipTests:skip tests execution'
|
'skipTests:skip tests execution'
|
||||||
'maven.test.skip:skip tests compilation and execution'
|
'maven.test.skip:skip tests compilation and execution'
|
||||||
'gpg.passphrase:gpg passphrase'
|
'gpg.passphrase:gpg passphrase'
|
||||||
)
|
)
|
||||||
_describe -t 'maven-properties' "Maven property" properties -qS=
|
_describe -t 'common-properties-names' "Common property name" properties -qS=
|
||||||
}
|
}
|
||||||
|
|
||||||
(( $+functions[_mvn_plugins_goals_properties] )) ||
|
(( $+functions[_mvn_plugin_goal_property_names] )) ||
|
||||||
_mvn_plugin_goal_properties() {
|
_mvn_plugin_goal_property_names() {
|
||||||
local plugin="${(P)$(($# -1))}" goal="${(P)${#}}" update_policy ret=1
|
local plugin="${(P)$(($# -1))}" goal="${(P)${#}}" update_policy ret=1
|
||||||
|
|
||||||
zstyle -s ":completion:${curcontext}:" cache-policy update_policy
|
zstyle -s ":completion:${curcontext}:" cache-policy update_policy
|
||||||
[[ -z "$update_policy" ]] && zstyle ":completion:${curcontext}:" cache-policy _mvn_plugin_goal_properties_caching_policy
|
[[ -z "$update_policy" ]] && zstyle ":completion:${curcontext}:" cache-policy _mvn_plugin_goal_property_names_caching_policy
|
||||||
|
|
||||||
unset properties
|
unset properties
|
||||||
if ( [[ ${+properties} -eq 0 ]] || _cache_invalid "mvn/plugins/${plugin}/${goal}" ) && ! _retrieve_cache "mvn/plugins/${plugin}/${goal}"; then
|
if ( [[ ${+properties} -eq 0 ]] || _cache_invalid "mvn/plugins/${plugin}/${goal}" ) && ! _retrieve_cache "mvn/plugins/${plugin}/${goal}"; then
|
||||||
properties=(${(M)${(ps:,,,:)${${${${(pj: :)${${${(f)${"$(_call_program goals $words[1] -N org.apache.maven.plugins:maven-help-plugin:2.1.1:describe -Dplugin=$plugin -Dgoal=$goal -Ddetail)"#*Available parameters:}%%\[INFO\]*}//# [a-z]*/,,,}##*Expression: \$\{}}//\}[[:space:]]##/:}//[[:space:]]##/ }//[[:space:]]#,,,[[:space:]]#/,,,}}:#[a-zA-Z]##:*})
|
properties=(${(M)${(ps:,,,:)${${${${(pj: :)${${${(f)${"$(_call_program properties $words[1] -N org.apache.maven.plugins:maven-help-plugin:2.1.1:describe -Dplugin=$plugin -Dgoal=$goal -Ddetail)"#*Available parameters:}%%\[INFO\]*}//# [a-z]*/,,,}##*Expression: \$\{}}//\}[[:space:]]##/:}//[[:space:]]##/ }//[[:space:]]#,,,[[:space:]]#/,,,}}:#[a-zA-Z]##:*})
|
||||||
[[ $#properties -gt 0 ]] && _store_cache "mvn/plugins/${plugin}/${goal}" properties
|
[[ $#properties -gt 0 ]] && _store_cache "mvn/plugins/${plugin}/${goal}" properties
|
||||||
fi
|
fi
|
||||||
|
|
||||||
[[ $#properties -gt 0 ]] && _describe -t "plugin-${plugin}-${goal}-properties" "${plugin}:${goal} property" properties -qS= && ret=0
|
[[ $#properties -gt 0 ]] && _describe -t "${plugin}-${goal}-property-names" "${plugin}:${goal} property name" properties -qS= && ret=0
|
||||||
|
|
||||||
|
return ret
|
||||||
|
}
|
||||||
|
|
||||||
|
(( $+functions[_mvn_property_values] )) ||
|
||||||
|
_mvn_property_values() {
|
||||||
|
local property="${(P)${#}}" ret=1
|
||||||
|
|
||||||
|
case $property in
|
||||||
|
file) _wanted file expl 'file' _files && ret=0;;
|
||||||
|
pomFile) _wanted pom-file expl 'POM file' _mvn_pom_files && ret=0;;
|
||||||
|
groupId) _wanted groupId expl 'groupId' _mvn_groupIds && ret=0;;
|
||||||
|
artifactId) _wanted artifactId expl 'artifactId' _mvn_artifactIds && ret=0;;
|
||||||
|
repositoryId) _message -e repositoryIds 'repositoryId' && ret=0;; # TODO Not implemented
|
||||||
|
classifier) _message -e classifiers 'classifier' && ret=0;;
|
||||||
|
scope) _wanted scope expl 'scope' _mvn_scopes && ret=0;;
|
||||||
|
*url*) _wanted url expl 'url' _urls && ret=0;; # TODO Use _alternative and add repository urls from settings + projects
|
||||||
|
*password|*passphrase) _wanted password expl $property _mvn_passwords && ret=0;;
|
||||||
|
version) _wanted version expl 'version' _mvn_versions && ret=0;;
|
||||||
|
createChecksum|generatePom|maven.test.skip) _wanted boolean expl 'boolean' _mvn_booleans && ret=0;;
|
||||||
|
user|username) _wanted user expl 'user' _users && ret=0;; # TODO Use _alternative and add repository usernames from settings + projects
|
||||||
|
*) _default && ret=0;;
|
||||||
|
esac
|
||||||
|
|
||||||
return ret
|
return ret
|
||||||
}
|
}
|
||||||
|
@ -495,7 +509,7 @@ _mvn_plugin_goals_caching_policy() {
|
||||||
(( $#oldp ))
|
(( $#oldp ))
|
||||||
}
|
}
|
||||||
|
|
||||||
_mvn_plugin_goal_properties_caching_policy() {
|
_mvn_plugin_goal_property_names_caching_policy() {
|
||||||
_mvn_plugin_goals_caching_policy
|
_mvn_plugin_goals_caching_policy
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue