cblrpm bash completion

This commit is contained in:
Jens Petersen 2020-08-13 13:01:21 +08:00
parent 275bc3c1f0
commit d77d944b27
2 changed files with 22 additions and 2 deletions

14
bash_completion Normal file
View File

@ -0,0 +1,14 @@
_cabal-rpm()
{
local CMDLINE
local IFS=$'\n'
CMDLINE=(--bash-completion-index $COMP_CWORD)
for arg in ${COMP_WORDS[@]}; do
CMDLINE=(${CMDLINE[@]} --bash-completion-word $arg)
done
COMPREPLY=( $(cabal-rpm "${CMDLINE[@]}") )
}
complete -o filenames -F _cabal-rpm cabal-rpm cblrpm

View File

@ -5,7 +5,7 @@
Name: cabal-rpm
Version: 2.0.6
Release: 3%{?dist}
Release: 4%{?dist}
Summary: RPM packaging tool for Haskell Cabal-based packages
License: GPLv3+
@ -14,6 +14,7 @@ Url: https://hackage.haskell.org/package/%{name}
Source0: https://hackage.haskell.org/package/%{name}-%{version}/%{name}-%{version}.tar.gz
# End cabal-rpm sources
Source1: cblrpm.1
Source2: bash_completion
# Begin cabal-rpm deps:
BuildRequires: ghc-rpm-macros
@ -86,7 +87,8 @@ pandoc -s -t man man/cabal-rpm.1.md > man/cabal-rpm.1
# End cabal-rpm install
mkdir -p %{buildroot}%{_datadir}/bash-completion/completions/
dist/build/%{name}/%{name} --bash-completion-script %{name} > %{buildroot}%{_datadir}/bash-completion/completions/%{name}
install -p -m 0644 -D %{SOURCE2} %{buildroot}%{_datadir}/bash-completion/completions/%{name}
ln -s %{name} %{buildroot}%{_datadir}/bash-completion/completions/cblrpm
%if %{with manpage}
install -p -m 0644 -D man/%{name}.1 %{buildroot}%{_mandir}/man1/%{name}.1
@ -104,11 +106,15 @@ ln -s %{name} %{buildroot}%{_bindir}/cblrpm
# End cabal-rpm files
%{_datadir}/bash-completion/completions/%{name}
%{_bindir}/cblrpm
%{_datadir}/bash-completion/completions/cblrpm
%{_mandir}/man1/%{name}.1*
%{_mandir}/man1/cblrpm.1*
%changelog
* Thu Aug 13 2020 Jens Petersen <petersen@redhat.com> - 2.0.6-4
- also bash completion for cblrpm alias
* Mon Aug 10 2020 Jens Petersen <petersen@redhat.com> - 2.0.6-3
- setup bash completion