Add bash completion (#706856)

This commit is contained in:
Stanislav Ochotnicky 2011-07-26 16:08:34 +02:00
parent b755aadc15
commit 3ace7c298b
2 changed files with 92 additions and 1 deletions

84
maven-bash-completion Normal file
View File

@ -0,0 +1,84 @@
_m2_make_goals()
{
plugin=$1
mojos=$2
for mojo in $mojos
do
export goals="$goals $plugin:$mojo"
done
}
_m2_complete()
{
local cur goals
COMPREPLY=()
cur="${COMP_WORDS[COMP_CWORD]}"
prev="${COMP_WORDS[COMP_CWORD-1]}"
case "${prev}" in
-f | --file|-l|--log-file)
COMPREPLY=( $(compgen -f ${cur}) )
return 0
;;
*);;
esac
goals='clean compile test install package deploy site'
if [[ ${cur} == -* ]] ; then
goals="$goals -am --also-make
-amd --also-make-dependents
-B --batch-mode
-C --strict-checksums
-c --lax-checksums
-cpu --check-plugin-updates
-D --define
-e --errors
-emp --encrypt-master-password
-ep --encrypt-password
-f --file
-fae --fail-at-end
-ff --fail-fast
-fn --fail-never
-gs --global-settings
-h --help
-l --log-file
-N --non-recursive
-npr --no-plugin-registry
-npu --no-plugin-updates
-nsu --no-snapshot-updates
-o --offline
-P --activate-profiles
-pl --projects
-q --quiet
-rf --resume-from
-s --settings
-T --threads
-t --toolchains
-U --update-snapshots
-up --update-plugins
-V --show-version
-v --version
-X --debug
-Dmaven.repo.local=
-Dmaven.local.depmap.file=
-Dmaven.local.debug=true
-Dmaven.local.mode=true"
fi
goals=$goals _m2_make_goals "eclipse" "eclipse"
goals=$goals _m2_make_goals "idea" "idea"
goals=$goals _m2_make_goals "assembly" "assembly"
goals=$goals _m2_make_goals "plexus" "app bundle-application bundle-runtime descriptor runtime service"
goals=$goals _m2_make_goals "dependency" "analyze analyze-dep-mgt analyze-only analyze-report analyze-duplicate
build-classpath copy copy-dependencies get go-offline list properties
purge-local-repository resolve resolve-plugins sources tree unpack
unpack-dependencies"
cur=`echo $cur | sed 's/\\\\//g'`
COMPREPLY=($(compgen -W "${goals}" -- ${cur} | sed 's/\\\\//g') )
}
complete -F _m2_complete -o filenames mvn3
complete -F _m2_complete -o filenames mvn-local
complete -F _m2_complete -o filenames mvn-rpmbuild

View File

@ -1,7 +1,7 @@
Name: maven
Version: 3.0.3
Release: 9%{?dist}
Release: 10%{?dist}
Summary: Java project management and project comprehension tool
Group: Development/Tools
@ -10,6 +10,7 @@ URL: http://maven.apache.org/
# Source URL is for testing only, final version will be in different place:
# http://www.apache.org/dyn/closer.cgi/maven/source/apache-%{name}-%{version}-src.tar.gz
Source0: http://www.apache.org/dyn/closer.cgi/maven/source/apache-%{name}-%{version}-src.tar.gz
Source1: maven-bash-completion
# custom resolver java files
# source: git clone git://fedorapeople.org/~sochotni/maven-javadir-resolver/
@ -293,6 +294,8 @@ install -m 644 pom.xml $RPM_BUILD_ROOT%{_datadir}/%{name}/poms/JPP.%{name}-maven
install -d -m 755 $RPM_BUILD_ROOT%{_javadocdir}/%{name}
cp -pr target/site/apidocs/* $RPM_BUILD_ROOT%{_javadocdir}/%{name}
# Install bash-completion
install -Dm 644 %{SOURCE1} %{buildroot}%{_sysconfdir}/bash_completion.d/%{name}
%files
%doc LICENSE.txt NOTICE.txt README.txt
@ -316,6 +319,7 @@ cp -pr target/site/apidocs/* $RPM_BUILD_ROOT%{_javadocdir}/%{name}
%config %{_mavendepmapfragdir}/%{name}
%{_javadir}/%{name}
%{_datadir}/%{name}/repo-metadata.tar.xz
%config(noreplace) %{_sysconfdir}/bash_completion.d/%{name}
%files javadoc
%doc LICENSE.txt
@ -323,6 +327,9 @@ cp -pr target/site/apidocs/* $RPM_BUILD_ROOT%{_javadocdir}/%{name}
%changelog
* Tue Jul 26 2011 Stanislav Ochotnicky <sochotnicky@redhat.com> - 3.0.3-10
- Add bash completion (#706856)
* Mon Jul 4 2011 Stanislav Ochotnicky <sochotnicky@redhat.com> - 3.0.3-9
- Add resolving from jnidir and java-jni