chore: switch to asdf
parent
e657e1340f
commit
3e98cc9b5b
|
|
@ -1,28 +1,19 @@
|
|||
#!/bin/env bash
|
||||
|
||||
# Find where asdf should be installed
|
||||
ASDF_DIR="${ASDF_DIR:-$HOME/.asdf}"
|
||||
ASDF_COMPLETIONS="$ASDF_DIR/completions"
|
||||
ASDF_VERSION="${ASDF_VERSION:-"0.8.1"}";
|
||||
ASDF_DIR="${ASDF_DIR:-$HOME/.asdf}";
|
||||
ASDF_COMPLETIONS="$ASDF_DIR/completions";
|
||||
|
||||
# If not found, check for Homebrew package
|
||||
if [[ ! -f "$ASDF_DIR/asdf.sh" || ! -f "$ASDF_COMPLETIONS/asdf.bash" ]] && [[ -f $(which brew 2>&1) ]]; then
|
||||
ASDF_DIR="$(brew --prefix asdf)"
|
||||
ASDF_COMPLETIONS="$ASDF_DIR/etc/bash_completion.d"
|
||||
|
||||
if [[ ! -f "$ASDF_DIR/asdf.sh" ]]; then
|
||||
echo "[asdf] Installing asdf to ${ASDF_DIR}...";
|
||||
git clone https://github.com/asdf-vm/asdf.git ${HOME}/.asdf --branch v${ASDF_VERSION};
|
||||
fi
|
||||
|
||||
if ! [[ -f "${ASDF_DIR}/asdf.sh" ]] && [[ -f $(which brew 2>&1) ]]; then
|
||||
echo "[asdf] Installing asdf via brew";
|
||||
brew install asdf;
|
||||
fi
|
||||
|
||||
|
||||
# Load command
|
||||
if [[ -f "$ASDF_DIR/asdf.sh" ]]; then
|
||||
. "$ASDF_DIR/asdf.sh"
|
||||
|
||||
# Load completions
|
||||
if [[ -f "$ASDF_COMPLETIONS/asdf.bash" ]]; then
|
||||
. "$ASDF_COMPLETIONS/asdf.bash"
|
||||
fi
|
||||
fi
|
||||
[[ -f "$ASDF_DIR/asdf.sh" ]] && . "$ASDF_DIR/asdf.sh"
|
||||
[[ -f "${ASDF_COMPLETIONS}/asdf.bash" ]] && . ${ASDF_COMPLETIONS}/asdf.bash;
|
||||
|
||||
alias asdf_list_all='asdf plugin list all';
|
||||
alias asdf_add='asdf plugin add';
|
||||
alias asdf_list_versions='asdf list all';
|
||||
|
|
|
|||
|
|
@ -1,4 +1,11 @@
|
|||
#!/bin/env bash
|
||||
HELM_VERSION=${HELM_VERSION:-"latest"};
|
||||
|
||||
if ! [[ -f "$(which helm 2>&1)" ]] && [[ -d "${HOME}/.asdf" ]]; then
|
||||
asdf plugin add helm;
|
||||
asdf install helm ${HELM_VERSION};
|
||||
fi
|
||||
|
||||
if [[ -f "$(which helm 2>&1)" ]]; then
|
||||
source <(helm completion bash)
|
||||
fi
|
||||
|
|
|
|||
|
|
@ -1,7 +1,14 @@
|
|||
#!/bin/env bash
|
||||
|
||||
if [[ -f "$(which kubectl)" ]]; then
|
||||
[[ -f "$(brew --prefix bash-completion)/etc/bash_completion.d/kubectl" ]] || kubectl completion bash > $(brew --prefix bash-completion)/etc/bash_completion.d/kubectl;
|
||||
KUBECTL_VERSION=${KUBECTL_VERSION:-"latest"};
|
||||
|
||||
if ! [[ -f "$(which kubectl 2>&1)" ]] && [[ -d "${HOME}/.asdf" ]]; then
|
||||
asdf plugin add kubectl;
|
||||
asdf install kubectl ${KUBECTL_VERSION};
|
||||
fi
|
||||
|
||||
if [[ -f "$(which kubectl 2>&1)" ]]; then
|
||||
[[ -f "/etc/bash_completion.d/kubectl" ]] || kubectl completion bash > /etc/bash_completion.d/kubectl;
|
||||
fi
|
||||
|
||||
# This command is used a LOT both below and in daily life
|
||||
|
|
|
|||
|
|
@ -1,7 +1,10 @@
|
|||
#!/bin/env bash
|
||||
|
||||
if ! [[ -f "$(which starship 2>&1)" ]] && [[ -f "$(which brew 2>&1)" ]]; then
|
||||
brew install starship;
|
||||
STARSHIP_VERSION=${STARSHIP_VERSION:-"latest"};
|
||||
|
||||
if ! [[ -f "$(which starship 2>&1)" ]] && [[ -d "${HOME}/.asdf" ]]; then
|
||||
asdf plugin add starship;
|
||||
asdf install startship ${STARSHIP_VERSION};
|
||||
fi
|
||||
|
||||
if [[ -f "$(which starship 2>&1)" ]]; then
|
||||
|
|
|
|||
Loading…
Reference in New Issue