misc updates from work
parent
4fc0c47234
commit
21636b68cb
|
|
@ -14,6 +14,5 @@ fi
|
|||
[[ -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 "$(brew --prefix bash-completion)/etc/bash_completion" ]] || brew install bash-completion
|
||||
|
||||
source "$(brew --prefix bash-completion)/etc/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"
|
||||
|
|
|
|||
|
|
@ -17,12 +17,15 @@ esac
|
|||
|
||||
# History
|
||||
# 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 HISTSIZE=25000;
|
||||
export HISTFILESIZE=10000;
|
||||
export HISTIGNORE="[ ]*:&:bg:fg:exit:clear"; # Don't save these commands in the history
|
||||
export HISTORY_COMMAND="history -a; history -c; history -r;"; # flush each command to history immediately
|
||||
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;"; # flush each command to history immediately
|
||||
# update
|
||||
export PROMPT_COMMAND="$PROMPT_COMMAND $HISTORY_COMMAND";
|
||||
|
||||
stty -ixon;
|
||||
|
||||
# see environ manfile - just setting up my shell environment
|
||||
|
|
|
|||
|
|
@ -10,3 +10,9 @@ fi
|
|||
if [[ -f "$(which helm 2>&1)" ]]; then
|
||||
source <(helm completion bash)
|
||||
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,15 +7,16 @@ if ! [[ -f "$(which kubectl 2>&1)" ]] && [[ -d "${HOME}/.asdf" ]]; then
|
|||
asdf install kubectl ${KUBECTL_VERSION};
|
||||
fi
|
||||
|
||||
if [[ -f "$(which kubectl 2>&1)" ]]; then
|
||||
if [[ -d "/etc/bash_completion.d" ]]; then
|
||||
[[ -f "/etc/bash_completion.d/kubectl" ]] || kubectl completion bash > /etc/bash_completion.d/kubectl;
|
||||
fi
|
||||
fi
|
||||
|
||||
# This command is used a LOT both below and in daily life
|
||||
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
|
||||
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
|
||||
|
||||
scan_timeout = 500
|
||||
command_timeout = 60
|
||||
|
||||
format = "$all"
|
||||
|
||||
|
|
@ -11,8 +12,12 @@ success_symbol = "[➜](bold green)"
|
|||
disabled = true
|
||||
|
||||
[kubernetes]
|
||||
format = '[⛵ $context](dimmed green) '
|
||||
format = '[⛵ $context](green) '
|
||||
disabled = false
|
||||
|
||||
[git_metrics]
|
||||
disabled = false
|
||||
[kubernetes.context_aliases]
|
||||
"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
|
||||
}
|
||||
|
||||
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}/.bash_profile" ]] && starship_install "${HOME}/.bash_profile";
|
||||
[[ -f "${HOME}/.profile" ]] && starship_install "${HOME}/.profile";
|
||||
|
|
|
|||
|
|
@ -385,4 +385,3 @@ if has("autocmd")
|
|||
au GUIEnter * set vb t_vb=
|
||||
endif
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue