Skip to content

Commit 24c3ba2

Browse files
committed
Switch to automatically-generated completions
Get out of business of manually crafting and updating shell completion helper functions. Signed-off-by: Nalin Dahyabhai <[email protected]>
1 parent 2d32c9a commit 24c3ba2

File tree

3 files changed

+27
-1260
lines changed

3 files changed

+27
-1260
lines changed

Makefile

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ BUILDTAGS += $(TAGS)
1212
PREFIX := /usr/local
1313
BINDIR := $(PREFIX)/bin
1414
BASHINSTALLDIR = $(PREFIX)/share/bash-completion/completions
15+
ZSHINSTALLDIR=$(PREFIX)/share/zsh/site-functions
16+
FISHINSTALLDIR=$(PREFIX)/share/fish/vendor_completions.d
1517
BUILDFLAGS := -tags "$(BUILDTAGS)"
1618
BUILDAH := buildah
1719
SELINUXOPT ?= $(shell test -x /usr/sbin/selinuxenabled && selinuxenabled && echo -Z)
@@ -59,7 +61,7 @@ export GOLANGCI_LINT_VERSION := 2.1.0
5961
# Note: Uses the -N -l go compiler options to disable compiler optimizations
6062
# and inlining. Using these build options allows you to subsequently
6163
# use source debugging tools like delve.
62-
all: bin/buildah bin/imgtype bin/copy bin/inet bin/tutorial bin/dumpspec docs
64+
all: bin/buildah bin/imgtype bin/copy bin/inet bin/tutorial bin/dumpspec docs contrib/completions/bash/buildah contrib/completions/fish/buildah.fish contrib/completions/zsh/_buildah
6365

6466
bin/buildah: $(SOURCES) internal/mkcw/embed/entrypoint_amd64.gz
6567
$(GO_BUILD) $(BUILDAH_LDFLAGS) $(GO_GCFLAGS) "$(GOGCFLAGS)" -o $@ $(BUILDFLAGS) ./cmd/buildah
@@ -108,7 +110,7 @@ bin/inet: tests/inet/inet.go
108110

109111
.PHONY: clean
110112
clean:
111-
$(RM) -r bin tests/testreport/testreport
113+
$(RM) -r bin contrib/completions/bash contrib/completions/fish contrib/completions/zsh tests/testreport/testreport
112114
$(MAKE) -C docs clean
113115

114116
.PHONY: docs
@@ -139,11 +141,27 @@ uninstall:
139141
rm -f $(DESTDIR)/$(BINDIR)/buildah
140142
rm -f $(PREFIX)/share/man/man1/buildah*.1
141143
rm -f $(DESTDIR)/$(BASHINSTALLDIR)/buildah
144+
rm -f $(DESTDIR)/$(FISHINSTALLDIR)/buildah.fish
145+
rm -f $(DESTDIR)/$(ZSHINSTALLDIR)/_buildah
146+
147+
contrib/completions/bash/buildah: ./bin/buildah
148+
mkdir -p contrib/completions/bash
149+
./bin/buildah completion bash > $@
150+
contrib/completions/fish/buildah.fish: ./bin/buildah
151+
mkdir -p contrib/completions/fish
152+
./bin/buildah completion fish > $@
153+
contrib/completions/zsh/_buildah: ./bin/buildah
154+
mkdir -p contrib/completions/zsh
155+
./bin/buildah completion zsh > $@
142156

143157
.PHONY: install.completions
144-
install.completions:
158+
install.completions: contrib/completions/bash/buildah contrib/completions/fish/buildah.fish contrib/completions/zsh/_buildah
145159
install -m 755 -d $(DESTDIR)/$(BASHINSTALLDIR)
146160
install -m 644 contrib/completions/bash/buildah $(DESTDIR)/$(BASHINSTALLDIR)/buildah
161+
install -m 755 -d $(DESTDIR)/$(FISHINSTALLDIR)
162+
install -m 644 contrib/completions/fish/buildah.fish $(DESTDIR)/$(FISHINSTALLDIR)/buildah.fish
163+
install -m 755 -d $(DESTDIR)/$(ZSHINSTALLDIR)
164+
install -m 644 contrib/completions/zsh/_buildah $(DESTDIR)/$(ZSHINSTALLDIR)/_buildah
147165

148166
.PHONY: test-conformance
149167
test-conformance:

0 commit comments

Comments
 (0)