Merge 1dc2b42729 into 2c3227c417
commit
4023731a9f
|
|
@ -33,3 +33,21 @@ asdf_use() {
|
||||||
asdf install ${plugin} ${version};
|
asdf install ${plugin} ${version};
|
||||||
asdf local ${plugin} ${version};
|
asdf local ${plugin} ${version};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
asdf_local_use() {
|
||||||
|
local TOOL_VERSIONS_PATH='.tool-versions';
|
||||||
|
if [ -z "${1}" ]; then
|
||||||
|
TOOL_VERSIONS_PATH="${1}";
|
||||||
|
fi
|
||||||
|
|
||||||
|
cat ${TOOL_VERSIONS_PATH} | xargs -I {} asdf local {};
|
||||||
|
}
|
||||||
|
|
||||||
|
asdf_add_plugins() {
|
||||||
|
local TOOL_VERSIONS_PATH='.tool-versions';
|
||||||
|
if [ -z "${1}" ]; then
|
||||||
|
TOOL_VERSIONS_PATH="${1}";
|
||||||
|
fi
|
||||||
|
|
||||||
|
awk '{print $1}' ${TOOL_VERSIONS_PATH} | xargs -I {} asdf plugin add {};
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,5 @@ fi
|
||||||
[[ -f "${LINUX_BREW_PATH}/bin/brew" ]] && eval "$(${LINUX_BREW_PATH}/bin/brew shellenv)";
|
[[ -f "${LINUX_BREW_PATH}/bin/brew" ]] && eval "$(${LINUX_BREW_PATH}/bin/brew shellenv)";
|
||||||
[[ -f "${MAC_BREW_PATH}/bin/brew" ]] && eval "$(${MAC_BREW_PATH}/bin/brew shellenv)";
|
[[ -f "${MAC_BREW_PATH}/bin/brew" ]] && eval "$(${MAC_BREW_PATH}/bin/brew shellenv)";
|
||||||
|
|
||||||
[[ -f "$(brew --prefix bash-completion)/etc/bash_completion" ]] || brew install bash-completion
|
[[ -d "$(brew --prefix)/etc/bash_completion.d" ]] || brew install bash-completion@2
|
||||||
|
[[ -r "/usr/local/etc/profile.d/bash_completion.sh" ]] && . "/usr/local/etc/profile.d/bash_completion.sh"
|
||||||
source "$(brew --prefix bash-completion)/etc/bash_completion";
|
|
||||||
|
|
|
||||||
|
|
@ -17,12 +17,15 @@ esac
|
||||||
|
|
||||||
# History
|
# History
|
||||||
# https://www.digitalocean.com/community/tutorials/how-to-use-bash-history-commands-and-expansions-on-a-linux-vps
|
# https://www.digitalocean.com/community/tutorials/how-to-use-bash-history-commands-and-expansions-on-a-linux-vps
|
||||||
shopt -s histappend; # Append to the history file, not overwrite
|
shopt -s histappend; # Append to the history file, not overwrite
|
||||||
export HISTCONTROL="ignoreboth:erasedups"; # No duplicate commands in history
|
export HISTCONTROL="ignoreboth:erasedups"; # No duplicate commands in history
|
||||||
export HISTSIZE=25000;
|
export HISTSIZE=25000;
|
||||||
export HISTFILESIZE=10000;
|
export HISTFILESIZE=10000;
|
||||||
export HISTIGNORE="[ ]*:&:bg:fg:exit:clear"; # Don't save these commands in the history
|
export HISTIGNORE="[ ]*:&:bg:fg:exit:clear:ls:history:gs:code:git:reset:cd:echo:cat"; # Don't save these commands in the history
|
||||||
export HISTORY_COMMAND="history -a; history -c; history -r;"; # flush each command to history immediately
|
export HISTORY_COMMAND="history -a;"; # flush each command to history immediately
|
||||||
|
# update
|
||||||
|
export PROMPT_COMMAND="$PROMPT_COMMAND $HISTORY_COMMAND";
|
||||||
|
|
||||||
stty -ixon;
|
stty -ixon;
|
||||||
|
|
||||||
# see environ manfile - just setting up my shell environment
|
# see environ manfile - just setting up my shell environment
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
[alias]
|
[alias]
|
||||||
# View abbreviated SHA, description, and history graph
|
# View abbreviated SHA, description, and history graph
|
||||||
ls = log --pretty=format:'%Cblue%h -%d %Cgreen%an %Creset%s - %Cred%GS' --abbrev-commit --date=relative --branches --graph -n 45
|
ls = log --pretty=format:'%Cblue%h -%d %Cgreen%an %Creset%s - %Cred%GS' --abbrev-commit --date=relative --branches --graph -n 45
|
||||||
|
|
||||||
# View the current working tree status using the short format
|
# View the current working tree status using the short format
|
||||||
s = status -s
|
s = status -s
|
||||||
|
|
@ -148,7 +148,7 @@
|
||||||
|
|
||||||
[pull]
|
[pull]
|
||||||
default = current
|
default = current
|
||||||
ff = only
|
ff = only
|
||||||
|
|
||||||
[user]
|
[user]
|
||||||
email = adamveld12@gmail.com
|
email = adamveld12@gmail.com
|
||||||
|
|
|
||||||
|
|
@ -10,3 +10,9 @@ fi
|
||||||
if [[ -f "$(which helm 2>&1)" ]]; then
|
if [[ -f "$(which helm 2>&1)" ]]; then
|
||||||
source <(helm completion bash)
|
source <(helm completion bash)
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
helm-setup-plugins() {
|
||||||
|
helm plugin install https://github.com/databus23/helm-diff
|
||||||
|
helm plugin install https://github.com/jkroepke/helm-secrets --version v3.12.0
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -7,13 +7,16 @@ if ! [[ -f "$(which kubectl 2>&1)" ]] && [[ -d "${HOME}/.asdf" ]]; then
|
||||||
asdf install kubectl ${KUBECTL_VERSION};
|
asdf install kubectl ${KUBECTL_VERSION};
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ -f "$(which kubectl 2>&1)" ]] && [[ -d "${BASH_COMPLETION_DIR}" ]]; then
|
|
||||||
[[ -f "${BASH_COMPLETION_DIR}/kubectl" ]] || kubectl completion bash > "${BASH_COMPLETION_DIR}/kubectl";
|
|
||||||
fi
|
|
||||||
|
|
||||||
# This command is used a LOT both below and in daily life
|
# This command is used a LOT both below and in daily life
|
||||||
alias k=kubectl
|
alias k=kubectl
|
||||||
|
|
||||||
|
if [[ -f "$(which kubectl 2>&1)" ]]; then
|
||||||
|
source <(kubectl completion bash);
|
||||||
|
complete -F __start_kubectl k;
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
# Execute a kubectl command against all namespaces
|
# Execute a kubectl command against all namespaces
|
||||||
alias kca='_kca(){ kubectl "$@" --all-namespaces; unset -f _kca; }; _kca'
|
alias kca='_kca(){ kubectl "$@" --all-namespaces; unset -f _kca; }; _kca'
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,78 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
# Exit on first error and verify variables have been set/passed via CLI
|
||||||
|
set -eu
|
||||||
|
|
||||||
|
# Rename our variables to friendlier equivalents
|
||||||
|
# https://git-scm.com/docs/gitattributes#_defining_a_custom_merge_driver
|
||||||
|
base="$1"; local_="$2"; remote="$3"; merged="$4"
|
||||||
|
|
||||||
|
# Resolve our default mergetool
|
||||||
|
# https://github.com/git/git/blob/v2.8.2/git-mergetool--lib.sh#L3
|
||||||
|
mergetool="$(git config --get merge.tool)"
|
||||||
|
GIT_DIR="$(git --exec-path)"
|
||||||
|
if test "$mergetool" = ""; then
|
||||||
|
echo "No default \`merge.tool\` was set for \`git\`. Please set one via \`git config --set merge.tool <tool>\`" 1>&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Create file names for our decrypted contents
|
||||||
|
# example_LOCAL_2823.yaml -> example_LOCAL_2823.decrypted.yaml
|
||||||
|
extension=".${base##*.}"
|
||||||
|
base_decrypted="${base/$extension/.decrypted$extension}"
|
||||||
|
local_decrypted="${local_/$extension/.decrypted$extension}"
|
||||||
|
remote_decrypted="${remote/$extension/.decrypted$extension}"
|
||||||
|
merged_decrypted="${base_decrypted/_BASE_/_MERGED_}"
|
||||||
|
backup_decrypted="${base_decrypted/_BASE_/_BACKUP_}"
|
||||||
|
|
||||||
|
# If anything goes wrong, then delete our decrypted files
|
||||||
|
handle_trap_exit () {
|
||||||
|
rm $base_decrypted || true
|
||||||
|
rm $local_decrypted || true
|
||||||
|
rm $remote_decrypted || true
|
||||||
|
rm $merged_decrypted || true
|
||||||
|
rm $backup_decrypted || true
|
||||||
|
}
|
||||||
|
trap handle_trap_exit EXIT
|
||||||
|
|
||||||
|
# Decrypt our file contents
|
||||||
|
sops --decrypt --show_master_keys "$base" > "$base_decrypted"
|
||||||
|
sops --decrypt --show_master_keys "$local_" > "$local_decrypted"
|
||||||
|
sops --decrypt --show_master_keys "$remote" > "$remote_decrypted"
|
||||||
|
|
||||||
|
# Create a merge-diff to compare against
|
||||||
|
set +e
|
||||||
|
git merge-file -p "$local_decrypted" "$base_decrypted" "$remote_decrypted" > "$merged_decrypted"
|
||||||
|
set -e
|
||||||
|
cp "$merged_decrypted" "$backup_decrypted"
|
||||||
|
|
||||||
|
# Set up variables for our mergetool
|
||||||
|
# https://github.com/git/git/blob/v2.8.2/mergetools/meld
|
||||||
|
# https://github.com/git/git/blob/v2.8.2/git-mergetool--lib.sh#L95-L111
|
||||||
|
export LOCAL="$local_decrypted"
|
||||||
|
export BASE="$base_decrypted"
|
||||||
|
export REMOTE="$remote_decrypted"
|
||||||
|
export MERGED="$merged_decrypted"
|
||||||
|
export BACKUP="$backup_decrypted"
|
||||||
|
|
||||||
|
# Load our mergetool scripts
|
||||||
|
source "$GIT_DIR/git-mergetool--lib"
|
||||||
|
source "$GIT_DIR/mergetools/$mergetool"
|
||||||
|
|
||||||
|
# Override `check_unchanged` with a custom script
|
||||||
|
check_unchanged () {
|
||||||
|
# If the contents haven't changed, then fail
|
||||||
|
if test "$MERGED" -nt "$BACKUP"; then
|
||||||
|
return 0
|
||||||
|
else
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# Run our mergetool
|
||||||
|
set +eu
|
||||||
|
export merge_tool_path="$(get_merge_tool_path "$mergetool")"
|
||||||
|
merge_cmd
|
||||||
|
set -eu
|
||||||
|
|
||||||
|
# Re-encrypt content
|
||||||
|
sops --encrypt "$merged_decrypted" > "$merged"
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
add_newline = true
|
add_newline = true
|
||||||
|
|
||||||
scan_timeout = 50
|
scan_timeout = 500
|
||||||
|
command_timeout = 60
|
||||||
|
|
||||||
format = "$all"
|
format = "$all"
|
||||||
|
|
||||||
|
|
@ -10,9 +11,16 @@ success_symbol = "[➜](bold green)"
|
||||||
[package]
|
[package]
|
||||||
disabled = true
|
disabled = true
|
||||||
|
|
||||||
|
[python]
|
||||||
|
disabled = true
|
||||||
|
|
||||||
[kubernetes]
|
[kubernetes]
|
||||||
format = '[⛵ $context](dimmed green) '
|
format = '[⛵ $context](green) '
|
||||||
disabled = false
|
disabled = false
|
||||||
|
|
||||||
[git_metrics]
|
[kubernetes.context_aliases]
|
||||||
disabled = false
|
"cluster.prd.ax.int" = "⚠️ cluster.prd.ax.int ⚠️ "
|
||||||
|
|
||||||
|
[[battery.display]]
|
||||||
|
threshold = 25
|
||||||
|
style = "bold red"
|
||||||
|
|
|
||||||
|
|
@ -31,6 +31,12 @@ if [[ -f "$(which starship 2>&1)" ]]; then
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
starship_set_window_title(){
|
||||||
|
echo -ne "\033]0; $(basename "$PWD") \007"
|
||||||
|
}
|
||||||
|
|
||||||
|
starship_precmd_user_func="starship_set_window_title"
|
||||||
|
|
||||||
[[ -f "${HOME}/.bashrc" ]] && starship_install "${HOME}/.bashrc";
|
[[ -f "${HOME}/.bashrc" ]] && starship_install "${HOME}/.bashrc";
|
||||||
[[ -f "${HOME}/.bash_profile" ]] && starship_install "${HOME}/.bash_profile";
|
[[ -f "${HOME}/.bash_profile" ]] && starship_install "${HOME}/.bash_profile";
|
||||||
[[ -f "${HOME}/.profile" ]] && starship_install "${HOME}/.profile";
|
[[ -f "${HOME}/.profile" ]] && starship_install "${HOME}/.profile";
|
||||||
|
|
|
||||||
|
|
@ -385,4 +385,3 @@ if has("autocmd")
|
||||||
au GUIEnter * set vb t_vb=
|
au GUIEnter * set vb t_vb=
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -10,31 +10,29 @@ if [[ -d "${FILES_USER_CONFIG}/vim" ]]; then
|
||||||
local PATHOGEN_TMP="${VIM_SOURCE}/vim-pathogen";
|
local PATHOGEN_TMP="${VIM_SOURCE}/vim-pathogen";
|
||||||
|
|
||||||
if ! [[ -f "${VIMRUNTIME}/autoload/pathogen.vim" ]]; then
|
if ! [[ -f "${VIMRUNTIME}/autoload/pathogen.vim" ]]; then
|
||||||
|
|
||||||
files_debug_log "[vim_install_plugins] installing pathogen.vim";
|
files_debug_log "[vim_install_plugins] installing pathogen.vim";
|
||||||
if ! [[ -d "${PATHOGEN_TMP}" ]]; then
|
# if ! [[ -d "${PATHOGEN_TMP}" ]]; then
|
||||||
git clone git://github.com/tpope/vim-pathogen.git ${PATHOGEN_TMP};
|
# git clone git://github.com/tpope/vim-pathogen.git ${PATHOGEN_TMP};
|
||||||
fi
|
# fi
|
||||||
|
|
||||||
|
curl -LSso ${VIMRUNTIME}/autoload/pathogen.vim https://tpo.pe/pathogen.vim
|
||||||
mkdir -p ${VIMRUNTIME}/autoload/;
|
mkdir -p ${VIMRUNTIME}/autoload/;
|
||||||
cp -r ${PATHOGEN_TMP}/autoload/* ${VIMRUNTIME}/autoload/;
|
cp -r ${PATHOGEN_TMP}/autoload/* ${VIMRUNTIME}/autoload/;
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
if ! [[ -d ${VIM_BUNDLE} ]]; then
|
if ! [[ -d "${VIM_BUNDLE}" ]]; then
|
||||||
files_debug_log "[vim_install_plugins] installing vim plugins...";
|
files_debug_log "[vim_install_plugins] installing vim plugins...";
|
||||||
|
|
||||||
mkdir -p ${VIM_BUNDLE};
|
mkdir -p ${VIM_BUNDLE};
|
||||||
|
|
||||||
pushd ${VIM_BUNDLE};
|
pushd ${VIM_BUNDLE};
|
||||||
local PLUGINS=$(cat ${VIM}/plugins.txt);
|
local PLUGINS=$(cat ${VIM}/plugins.txt);
|
||||||
for plugin in ${PLUGINS}; do
|
for plugin in ${PLUGINS}; do
|
||||||
if [[ "${plugin:0:3}" = "git" ]]; then
|
if [[ "${plugin:0:5}" = "https" ]]; then
|
||||||
echo "Installing $plugin...";
|
echo "Installing $plugin...";
|
||||||
git clone -q $plugin > /dev/null &
|
git clone -q $plugin 2>&1 /dev/null &
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
time wait;
|
time wait;
|
||||||
popd;
|
popd;
|
||||||
fi
|
fi
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue