diff --git a/README.md b/README.md index dfb1373..98a7797 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,4 @@ # bash-completion +bash-completion is a collection of shell functions that take advantage of the programmable completion feature of bash 2.04 and later. + diff --git a/bash-completion-1.2-rpm-630328.patch b/bash-completion-1.2-rpm-630328.patch new file mode 100644 index 0000000..d9bf466 --- /dev/null +++ b/bash-completion-1.2-rpm-630328.patch @@ -0,0 +1,76 @@ +--- bash-completion-1.2/contrib/rpm 2010-06-13 12:21:19.000000000 +0200 ++++ bash-completion-1.2/contrib/rpm.fix 2011-02-02 22:14:45.000000000 +0100 +@@ -142,7 +142,7 @@ + -- "$cur" ) ) + return 0 + ;; +- --define|-D) ++ --define|-D|--fileid|--hdrid|--pkgid) + # argument required but no completions available + return 0 + ;; +@@ -180,12 +180,11 @@ + # options common to all query types + opts="$opts --changelog --configfiles --conflicts --docfiles + --dump --enhances --filesbypkg --filecaps --fileclass +- --filecolor --fileprovide --filerequire --filesbypkg +- --info --list --obsoletes --pipe --provides +- --queryformat --rcfile --requires --scripts --suggests +- --triggeredby --triggers --whatprovides --whatrequires --xml" ++ --filecolor --fileprovide --filerequire --filesbypkg --info ++ --list --obsoletes --pipe --provides --queryformat --rcfile ++ --requires --scripts --suggests --triggers --xml" + +- if [ "${COMP_LINE#* -*([^ -])f}" != "$COMP_LINE" ]; then ++ if [[ $COMP_LINE == *\ -@(*([^ -])f|-file )* ]]; then + # -qf completion + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W "$opts --dbpath --fscontext \ +@@ -193,23 +192,26 @@ + else + _filedir + fi +- elif [ "${COMP_LINE#* -*([^ -])g}" != "$COMP_LINE" ]; then ++ elif [[ $COMP_LINE == *\ -@(*([^ -])g|-group )* ]]; then + # -qg completion + _rpm_groups +- elif [ "${COMP_LINE#* -*([^ -])p}" != "$COMP_LINE" ]; then ++ elif [[ $COMP_LINE == *\ -@(*([^ -])p|-package )* ]]; then + # -qp; uninstalled package completion + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W "$opts --ftpport --ftpproxy \ +- --httpport --httpproxy" -- "$cur" ) ) ++ --httpport --httpproxy --nomanifest" -- "$cur" ) ) + else + _filedir 'rpm' + fi + else + # -q; installed package completion + if [[ "$cur" == -* ]]; then +- COMPREPLY=( $( compgen -W "$opts --dbpath --fscontext \ +- --last --root --state" -- "$cur" ) ) +- elif [ "${COMP_LINE#* -*([^ -])a}" == "$COMP_LINE" ]; then ++ COMPREPLY=( $( compgen -W "$opts --all --file --fileid ++ --dbpath --fscontext --ftswalk --group --hdrid --last ++ --package --pkgid --root --specfile --state ++ --triggeredby --whatprovides --whatrequires" \ ++ -- "$cur" ) ) ++ elif [[ $COMP_LINE != *\ -@(*([^ -])a|-all )* ]]; then + _rpm_installed_packages "$nodig" "$nosig" + fi + fi +@@ -229,11 +231,11 @@ + --nofiles --noscripts --nomd5 --querytags --specfile \ + --whatrequires --whatprovides" -- "$cur" ) ) + # check whether we're doing file completion +- elif [ "${COMP_LINE#* -*([^ -])f}" != "$COMP_LINE" ]; then ++ elif [[ $COMP_LINE == *\ -@(*([^ -])f|-file )* ]]; then + _filedir +- elif [ "${COMP_LINE#* -*([^ -])g}" != "$COMP_LINE" ]; then ++ elif [[ $COMP_LINE == *\ -@(*([^ -])g|-group )* ]]; then + _rpm_groups +- elif [ "${COMP_LINE#* -*([^ -])p}" != "$COMP_LINE" ]; then ++ elif [[ $COMP_LINE == *\ -@(*([^ -])p|-package )* ]]; then + _filedir 'rpm' + else + _rpm_installed_packages "$nodig" "$nosig" diff --git a/bash-completion-2.1-bash-4.3.patch b/bash-completion-2.1-bash-4.3.patch new file mode 100644 index 0000000..cc7ce3e --- /dev/null +++ b/bash-completion-2.1-bash-4.3.patch @@ -0,0 +1,12 @@ +diff -Nru bash-completion-2.1.orig/bash_completion bash-completion-2.1/bash_completion +--- bash-completion-2.1.orig/bash_completion 2013-04-05 10:55:51.000000000 +0000 ++++ bash-completion-2.1/bash_completion 2014-05-05 07:56:56.720101465 +0000 +@@ -707,7 +707,7 @@ + fi + done + +- [[ $cword -eq 0 ]] && return 1 ++ [[ $cword -le 0 ]] && return 1 + prev=${words[cword-1]} + + [[ ${split-} ]] && _split_longopt && split=true diff --git a/bash-completion.spec b/bash-completion.spec new file mode 100644 index 0000000..0a00485 --- /dev/null +++ b/bash-completion.spec @@ -0,0 +1,107 @@ +### AUTOUPDATE-OFF: 0 +Name: bash-completion +Version: 2.1 +Release: 4mamba +Epoch: 1 +Summary: Programmable completion for bash +Group: Applications/Shells +Vendor: openmamba +Distribution: openmamba +Packager: Ercole 'ercolinux' Carpanetto +URL: http://bash-completion.alioth.debian.org +Source: http://bash-completion.alioth.debian.org/files/bash-completion-%{version}.tar.bz2 +Patch0: %{name}-1.2-rpm-630328.patch +Patch1: bash-completion-2.1-bash-4.3.patch +License: GPL +## AUTOBUILDREQ-BEGIN +## AUTOBUILDREQ-END +Requires: bash +BuildRoot: %{_tmppath}/%{name}-%{version}-root + +%description +bash-completion is a collection of shell functions that take advantage of the programmable completion feature of bash 2.04 and later. + +%prep +%setup -q +#%patch -p1 +%patch1 -p1 + +%build +%configure +%make +# bash_completion.sh + +%install +[ "%{buildroot}" != / ] && rm -rf "%{buildroot}" +%makeinstall +install -d %{buildroot}%{_sysconfdir}/profile.d +install -m644 bash_completion.sh %{buildroot}%{_sysconfdir}/profile.d/ +#install -m644 bash_completion %{buildroot}%{_sysconfdir}/ + +# provided in udev since 198 +rm -f %{buildroot}%{_datadir}/bash-completion/completions/udevadm + +# provided in NetworkManager +rm -f %{buildroot}%{_datadir}/bash-completion/completions/nmcli + +# provided in util-linux +rm -f %{buildroot}%{_datadir}/bash-completion/completions/\ +{cal,dmesg,eject,hexdump,ionice,hwclock,ionice,look,renice,rtcwake,su} + +%clean +[ "%{buildroot}" != / ] && rm -rf "%{buildroot}" + +%files +%defattr(-,root,root) +%{_sysconfdir}/profile.d/bash_completion.sh +#%dir %{_sysconfdir}/bash_completion.d +%dir %{_datadir}/bash-completion +%{_datadir}/bash-completion/bash_completion +%dir %{_datadir}/bash-completion/completions +%{_datadir}/bash-completion/completions/* +%dir %{_datadir}/bash-completion/helpers +%{_datadir}/bash-completion/helpers/perl +%{_datadir}/pkgconfig/bash-completion.pc +%doc AUTHORS COPYING +#%doc CHANGES README + +%changelog +* Mon May 05 2014 Silvan Calarco 2.1-4mamba +- patch against bash 4.3 (see https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=741479) + +* Mon Apr 29 2013 Silvan Calarco 2.1-3mamba +- remove completion files conflicting with util-linux since 2.23 + +* Mon Apr 15 2013 Silvan Calarco 2.1-2mamba +- remove nmcli completion already provided by NetworkManager + +* Sun Apr 14 2013 Automatic Build System 2.1-1mamba +- update to 2.1 + +* Sun Mar 17 2013 Silvan Calarco 2.0-2mamba +- remove udevadm completion file provided by udev >= 198 + +* Wed Aug 15 2012 Automatic Build System 2.0-1mamba +- update to 2.0 + +* Thu May 10 2012 Silvan Calarco 1.99-1mamba +- update to 1.99 + +* Thu Aug 25 2011 Silvan Calarco 1.3-1mamba +- update to 1.3 + +* Wed Feb 02 2011 Davide Madrisan 1.2-1mamba +- update url +- remove files not applicable to openmamba +- add upstream patch for rpm + +* Tue Feb 01 2011 Silvan Calarco 20060301-3mamba +- remove unuseful %dir to fix a self installation loop + +* Fri Sep 26 2008 Silvan Calarco 20060301-2mamba +- fix installation of /etc/bash_completion +- add bash_completion.sh in /etc/profile.d +- install contrib file in /etc/bash_completion.d + +* Tue Sep 23 2008 Ercole 'ercolinux' Carpanetto 20060301-1mamba +- package created by autospec