Skip to content

Commit

Permalink
feat: Enable bash-completion (#37)
Browse files Browse the repository at this point in the history
  • Loading branch information
MAHDTech authored Jul 17, 2023
1 parent c46deaa commit 488eeb4
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions nix/oci/tanzu/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ in
"/sbin"
"/usr"
"/usr/local"
"/usr/share/"
"/var"
"/var/run"
];
Expand Down Expand Up @@ -207,9 +208,41 @@ in
cat << 'EOF' > /home/${containerUser}/.bashrc
#!/usr/bin/env bash
# Enable bash-completion
if shopt -q progcomp &>/dev/null;
then
BASH_COMPLETION_ENABLED="TRUE"
. "${pkgs.bash-completion}/etc/profile.d/bash_completion.sh"
fi
# shellcheck disable=SC1090
source <(/bin/starship init bash --print-full-init)
# Binaries with bash completions
declare -r BINS=(
clusterctl
helm
imgpkg
kapp
kctrl
kubectl
kustomize
tanzu
ytt
)
if [[ "''${BASH_COMPLETION_ENABLED:-FALSE}" == "TRUE" ]];
then
echo "Loading bash completions into current shell..."
for BIN in "''${BINS[@]}";
do
echo "Loading bash completion for ''${BIN}"
source <(''${BIN} completion bash) || {
echo "Failed to source bash completion for ''${BIN}, skipping."
}
done
fi
# Initialise the Tanzu CLI
if [[ -f "''${HOME}/.config/tanzu/config.yaml" ]];
then
Expand Down

0 comments on commit 488eeb4

Please sign in to comment.