Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

install bash-completion in dev container #5232

Merged
merged 2 commits into from
Jul 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,16 @@ mod-outdated: ## check outdated dependencies
authors: ## generate AUTHORS file from git history
scripts/docs/generate-authors.sh

.PHONY: completion
completion: binary
completion: /etc/bash_completion.d/docker
completion: ## generate and install the completion scripts

.PHONY: /etc/bash_completion.d/docker
/etc/bash_completion.d/docker: ## generate and install the bash-completion script
mkdir -p /etc/bash_completion.d
docker completion bash > /etc/bash_completion.d/docker
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should also make sure that the directory exists:

Suggested change
docker completion bash > /etc/bash_completion.d/docker
mkdir -p /etc/bash_completion.d
docker completion bash > /etc/bash_completion.d/docker

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good one; I wrote it with the dev-container in mind (which had it set up already), but doesn't hurt to add

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated 👍


.PHONY: manpages
manpages: ## generate man pages from go source and markdown
scripts/docs/generate-man.sh
Expand Down
4 changes: 3 additions & 1 deletion dockerfiles/Dockerfile.dev
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ RUN --mount=type=cache,target=/root/.cache/go-build \
FROM golang AS dev
RUN apk add --no-cache \
bash \
bash-completion \
build-base \
ca-certificates \
coreutils \
Expand All @@ -44,7 +45,8 @@ RUN apk add --no-cache \
nano

RUN echo -e "\nYou are now in a development container. Run '\e\033[1mmake help\e\033[0m' to learn about\navailable make targets.\n" > /etc/motd \
&& echo -e "cat /etc/motd\nPS1=\"\e[0;32m\u@docker-cli-dev\\$ \e[0m\"" >> /root/.bashrc
&& echo -e "cat /etc/motd\nPS1=\"\e[0;32m\u@docker-cli-dev\\$ \e[0m\"" >> /root/.bashrc \
&& echo -e "source /etc/bash/bash_completion.sh" >> /root/.bashrc
CMD bash
ENV DISABLE_WARN_OUTSIDE_CONTAINER=1
ENV PATH=$PATH:/go/src/github.com/docker/cli/build
Expand Down
Loading