Skip to content
Browse files

[BGBUILD-332] Add support for bash completion

  • Loading branch information...
1 parent 3445408 commit 3bf4bfec756388acf9dade399866d550ab8e465d @goldmann goldmann committed Dec 27, 2011
Showing with 46 additions and 0 deletions.
  1. +2 −0 CHANGELOG
  2. +2 −0 Manifest
  3. +37 −0 bash_completion
  4. +5 −0 rubygem-boxgrinder-build.spec
View
2 CHANGELOG
@@ -1,5 +1,7 @@
v0.11.0
+* [BGBUILD-332] Add support for bash completion
+
v0.10.0
* [BGBUILD-313] boxgrinder build fails to build ec2 image if ec2-user already exists
View
2 Manifest
@@ -3,7 +3,9 @@ LICENSE
Manifest
README.md
Rakefile
+bash_completion
bin/boxgrinder-build
+boxgrinder-build.gemspec
integ/appliances/gnome-fedora.appl
integ/appliances/jeos-centos5-files.appl
integ/appliances/jeos-centos5.appl
View
37 bash_completion
@@ -0,0 +1,37 @@
+_boxgrinder-build()
+{
+ local cur prev opts
+ COMPREPLY=()
+ cur="${COMP_WORDS[COMP_CWORD]}"
+ prev="${COMP_WORDS[COMP_CWORD-1]}"
+ opts="--help --version --platform --delivery --force --os-config --platform-config --delivery-config --plugins --debug --trace --backtrace"
+
+ if [[ ${cur} == -* ]] ; then
+ COMPREPLY=($(compgen -W "${opts}" -- ${cur}))
+ return 0
+ fi
+
+ case "${prev}" in
+ --os-config|--platform-config|--delivery-config|-l|--plugins)
+ return 0
+ ;;
+ -p|--platform)
+ local platform="ec2 virtualbox virtualpc vmware"
+ COMPREPLY=($(compgen -W "${platform}" -- ${cur}))
+ ;;
+ -d|--delivery)
+ local delivery="ami cloudfront ebs elastichosts libvirt local openstack s3 sftp"
+ COMPREPLY=($(compgen -W "${delivery}" -- ${cur}))
+ ;;
+ *)
+ if [[ ${COMP_CWORD} -eq 1 ]]; then
+ _filedir appl
+ else
+ COMPREPLY=($(compgen -W "${opts}" -- ${cur}))
+ fi
+ ;;
+ esac
+}
+
+complete -F _boxgrinder-build boxgrinder-build
+
View
5 rubygem-boxgrinder-build.spec
@@ -110,6 +110,9 @@ find %{_builddir}%{geminstdir}/bin -type f | xargs chmod a+x
rm -rf %{_builddir}/%{geminstdir}/integ/packages/*.rpm
cp -r %{_builddir}%{gemdir}/* %{buildroot}/%{gemdir}
+install -d -m 755 %{buildroot}/%{_sysconfdir}/bash_completion.d
+mv %{buildroot}/%{geminstdir}/bash_completion %{buildroot}/%{_sysconfdir}/bash_completion.d/%{name}
+
%check
pushd %{_builddir}/%{geminstdir}
rake spec
@@ -118,6 +121,7 @@ popd
%files
%defattr(-, root, root, -)
%{_bindir}/boxgrinder-build
+%{_sysconfdir}/bash_completion.d/%{name}
%dir %{geminstdir}
%{geminstdir}/bin
%{geminstdir}/lib
@@ -141,6 +145,7 @@ popd
%changelog
* Tue Dec 27 2011 Marek Goldmann <mgoldman@redhat.com> - 0.11.0-1
- Upstream release: 0.11.0
+- [BGBUILD-332] Add support for bash completion
* Tue Nov 29 2011 Marek Goldmann <mgoldman@redhat.com> - 0.10.0-1
- Upstream release: 0.10.0

0 comments on commit 3bf4bfe

Please sign in to comment.
Something went wrong with that request. Please try again.