Skip to content

Commit

Permalink
Use bash-completion package for bash completions
Browse files Browse the repository at this point in the history
All bash-completions located in /usr/share/bash-completion/completions/ are now
enabled by default.

oc and git completions were already being stored in /usr/share/bash-completion/completions/
which is why they are no longer being explicitly sourced in the .bashrc.

Signed-off-by: Andrew Obuchowicz <aobuchow@redhat.com>
  • Loading branch information
AObuchow committed Oct 13, 2023
1 parent 4f70e6d commit 48da97d
Showing 1 changed file with 12 additions and 11 deletions.
23 changes: 12 additions & 11 deletions universal/ubi8/Dockerfile
Expand Up @@ -170,17 +170,12 @@ ENV KAMEL_VERSION 1.11.0
RUN curl -L https://github.com/apache/camel-k/releases/download/v${KAMEL_VERSION}/camel-k-client-${KAMEL_VERSION}-linux-64bit.tar.gz | tar -C /usr/local/bin -xz \
&& chmod +x /usr/local/bin/kamel

# git completion
RUN echo "source /usr/share/bash-completion/completions/git" >> /home/user/.bashrc

# Cloud

# oc client and completion
# oc client
ENV OC_VERSION=4.6
RUN curl -L https://mirror.openshift.com/pub/openshift-v4/clients/oc/${OC_VERSION}/linux/oc.tar.gz | tar -C /usr/local/bin -xz \
&& chmod +x /usr/local/bin/oc \
&& oc completion bash > /usr/share/bash-completion/completions/oc \
&& echo "source /usr/share/bash-completion/completions/oc" >> /home/user/.bashrc
&& chmod +x /usr/local/bin/oc

## podman buildah skopeo
RUN dnf -y module enable container-tools:rhel8 && \
Expand Down Expand Up @@ -238,10 +233,6 @@ curl -sSL -o ~/.kubectl_aliases https://raw.githubusercontent.com/ahmetb/kubectl
echo '[ -f ~/.kubectl_aliases ] && source ~/.kubectl_aliases' >> /home/user/.bashrc
EOF

# kubectl completion
RUN kubectl completion bash > /usr/share/bash-completion/completions/kubectl \
&& echo "source /usr/share/bash-completion/completions/kubectl" >> /home/user/.bashrc

## shellcheck
RUN <<EOF
dnf install -y xz
Expand Down Expand Up @@ -414,6 +405,16 @@ cd -
rm -rf "${TEMP_DIR}"
EOF

# Bash completions
RUN dnf -y install bash-completion \
&& dnf clean all \
&& rm -rf /var/cache/yum

RUN <<EOF
echo "source /etc/profile.d/bash_completion.sh" >> /home/user/.bashrc
oc completion bash > /usr/share/bash-completion/completions/oc
kubectl completion bash > /usr/share/bash-completion/completions/kubectl
EOF

# Add sdkman's init script launcher to the end of the .bashrc since we are not adding it on sdkman install
# NOTE: all modifications to the .bashrc must happen BEFORE this step in order for sdkman to function correctly
Expand Down

0 comments on commit 48da97d

Please sign in to comment.