Skip to content

Commit 1f5813f

Browse files
renner0ecgwalters
authored andcommitted
Makefile/rpm: Add shell completions
Signed-off-by: renner <renner0@posteo.de>
1 parent 1d8cf09 commit 1f5813f

2 files changed

Lines changed: 18 additions & 1 deletion

File tree

Makefile

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,15 @@ bin: manpages
4343
manpages:
4444
cargo run --release --package xtask -- manpages
4545

46+
.PHONY: completion
47+
completion:
48+
mkdir -p target/completion
49+
for shell in bash elvish fish powershell zsh; do \
50+
target/release/bootc completion $$shell > target/completion/bootc.$$shell; \
51+
done
52+
4653
STORAGE_RELATIVE_PATH ?= $(shell realpath -m -s --relative-to="$(prefix)/lib/bootc/storage" /sysroot/ostree/bootc/storage)
47-
install:
54+
install: completion
4855
install -D -m 0755 -t $(DESTDIR)$(prefix)/bin target/release/bootc
4956
install -D -m 0755 -t $(DESTDIR)$(prefix)/bin target/release/system-reinstall-bootc
5057
install -d -m 0755 $(DESTDIR)$(prefix)/lib/bootc/bound-images.d
@@ -54,6 +61,9 @@ install:
5461
install -d $(DESTDIR)$(prefix)/lib/bootc/install
5562
install -D -m 0644 -t $(DESTDIR)$(prefix)/share/man/man5 target/man/*.5; \
5663
install -D -m 0644 -t $(DESTDIR)$(prefix)/share/man/man8 target/man/*.8; \
64+
install -D -m 0644 target/completion/bootc.bash $(DESTDIR)$(prefix)/share/bash-completion/completions/bootc
65+
install -D -m 0644 target/completion/bootc.zsh $(DESTDIR)$(prefix)/share/zsh/site-functions/_bootc
66+
install -D -m 0644 target/completion/bootc.fish $(DESTDIR)$(prefix)/share/fish/vendor_completions.d/bootc.fish
5767
install -D -m 0644 -t $(DESTDIR)/$(prefix)/lib/systemd/system systemd/*.service systemd/*.timer systemd/*.path systemd/*.target
5868
install -D -m 0644 -t $(DESTDIR)/$(prefix)/share/doc/bootc/baseimage/base/usr/lib/ostree/ baseimage/base/usr/lib/ostree/prepare-root.conf
5969
install -d -m 755 $(DESTDIR)/$(prefix)/share/doc/bootc/baseimage/base/sysroot

contrib/packaging/bootc.spec

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,10 @@ chmod +x %{?buildroot}/%{system_reinstall_bootc_install_podman_path}
164164
touch %{?buildroot}/%{_docdir}/bootc/baseimage/base/sysroot/.keepdir
165165
find %{?buildroot}/%{_docdir} ! -type d -printf '%{_docdir}/%%P\n' | sort > bootcdoclist.txt
166166

167+
install -Dpm 0644 target/completion/bootc.bash %{buildroot}%{bash_completions_dir}/bootc
168+
install -Dpm 0644 target/completion/bootc.zsh %{buildroot}%{zsh_completions_dir}/_bootc
169+
install -Dpm 0644 target/completion/bootc.fish %{buildroot}%{fish_completions_dir}/bootc.fish
170+
167171
%if %{with check}
168172
%check
169173
if grep -qEe 'Seccomp:.*0$' /proc/self/status; then
@@ -190,6 +194,9 @@ fi
190194
%endif
191195
%{_unitdir}/*
192196
%{_mandir}/man*/*bootc*
197+
%{bash_completions_dir}/bootc
198+
%{zsh_completions_dir}/_bootc
199+
%{fish_completions_dir}/bootc.fish
193200

194201
%files -n system-reinstall-bootc
195202
%{_bindir}/system-reinstall-bootc

0 commit comments

Comments
 (0)