From ff86d61df923ca214e559780d6848a16df26d715 Mon Sep 17 00:00:00 2001 From: Tony Blyler Date: Thu, 31 Dec 2020 12:04:07 -0500 Subject: [PATCH] remove Go app "updater", I do not use them anymore. Also cleanup .zshrc a little bit --- home/.zshrc | 96 +++++++++---------- home/.zshrc.d/00_go.sh | 10 -- home/.zshrc.d/01_update_go_apps.sh | 26 ----- ...02_upgrade_system.sh => upgrade_system.sh} | 4 - 4 files changed, 44 insertions(+), 92 deletions(-) delete mode 100755 home/.zshrc.d/00_go.sh delete mode 100755 home/.zshrc.d/01_update_go_apps.sh rename home/.zshrc.d/{02_upgrade_system.sh => upgrade_system.sh} (93%) diff --git a/home/.zshrc b/home/.zshrc index 48bb2d6..4c6fe0e 100644 --- a/home/.zshrc +++ b/home/.zshrc @@ -1,6 +1,5 @@ -if [ -f "${HOME}/.zshrc.d/sway_enabled" ] && command -v tty &> /dev/null && command -v sway &> /dev/null && [ "$(tty)" = '/dev/tty1' ]; then - exec sway - exit $? +if [ -f "${HOME}/.zshrc.d/init" ]; then + source "${HOME}/.zshrc.d/init" fi export PATH="/usr/local/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:${PATH}" @@ -8,6 +7,14 @@ if [ -d "${HOME}/bin" ]; then export PATH="${HOME}/bin:${PATH}" fi +if command -v go &> /dev/null; then + GOPATH="$(go env GOPATH)" + if [ -d "${GOPATH}" ]; then + export GOPATH + export PATH="${GOPATH}/bin:${PATH}" + fi +fi + # oh-my-zsh { export ZSH="${HOME}/.oh-my-zsh" @@ -17,6 +24,7 @@ export UPDATE_ZSH_DAYS=7 DISABLE_UPDATE_PROMPT="true" HIST_STAMPS="mm/dd/yyyy" plugins=( + aws autojump battery brew @@ -91,64 +99,44 @@ if 2>&1 cp --help | grep -q reflink; then else alias cp='cp -i' fi -alias mv='mv -i' -alias dco='docker-compose' -alias mk='minikube' -alias k='kubectl' -alias kctx='kubectx' -alias kns='kubens' -REPOS="${HOME}/repos" +alias mv='mv -i' + +if command -v docker-compose &> /dev/null; then + alias dco='docker-compose' +fi + +if command -v minikube &> /dev/null; then + alias mk='minikube' +fi + +if command -v kubectl &> /dev/null; then + alias k='kubectl' +fi + +if command -v kubectx &> /dev/null; then + alias kctx='kubectx' +fi + +if command -v kubens &> /dev/null; then + alias kns='kubens' +fi CARGO_ENV="${HOME}/.cargo/env" if [ -f "${CARGO_ENV}" ]; then source "${CARGO_ENV}" fi -if [ -x "${REPOS}/termpdf/termpdf" ]; then - alias termpdf="${REPOS}/termpdf/termpdf" -fi - # add awless autocompletion if available if command -v awless &> /dev/null; then source <(awless completion zsh) fi -# add kubectl autocompletion if available -if command -v kubectl &> /dev/null; then - source <(kubectl completion zsh) -fi - -# add helm autocompletion if available -if command -v helm &> /dev/null; then - source <(helm completion zsh) -fi - -# add aws autocompletion if available -if command -v aws &> /dev/null; then - complete -C aws_completer aws -fi - if command -v fzf &> /dev/null; then export FZF_DEFAULT_COMMAND='ag --skip-vcs-ignores --nocolor -g "" -l' export FZF_CTRL_T_COMMAND="${FZF_DEFAULT_COMMAND}" fi -NIX_SH="${HOME}/.nix-profile/etc/profile.d/nix.sh" -if [ -f "${NIX_SH}" ]; then - source "${NIX_SH}" -fi - -export GOAPPS=( - 'github.com/dgraph-io/badger/...' - 'github.com/golang/protobuf/protoc-gen-go' - 'github.com/google/huproxy/huproxyclient' - 'github.com/jedisct1/piknik' - 'github.com/junegunn/fzf' - 'github.com/tomnomnom/gron' - 'github.com/wallix/awless' - 'google.golang.org/grpc' -) export GO111MODULE=on case "$(uname)" in @@ -162,6 +150,10 @@ case "$(uname)" in if command -v gtar &> /dev/null; then alias tar='gtar' fi + + if command -v gsed &> /dev/null; then + alias sed='gsed' + fi ;; "Linux") alias open="xdg-open" @@ -169,7 +161,14 @@ case "$(uname)" in esac # } -# load any file that ends with .zsh or .sh +source "${HOME}/.homesick/repos/homeshick/homeshick.sh" +homeshick refresh 5 -q + +export NVM_DIR="$HOME/.nvm" +[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm +[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion + +# load any file that ends with .zsh or .sh and is executable for SCRIPT in "${HOME}/.zshrc.d"/**/(.|?)*(.zsh|.sh); do if ! [ -x "${SCRIPT}" ]; then continue @@ -177,10 +176,3 @@ for SCRIPT in "${HOME}/.zshrc.d"/**/(.|?)*(.zsh|.sh); do source "${SCRIPT}" done - -source "${HOME}/.homesick/repos/homeshick/homeshick.sh" -homeshick refresh 5 -q - -export NVM_DIR="$HOME/.nvm" -[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm -[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion diff --git a/home/.zshrc.d/00_go.sh b/home/.zshrc.d/00_go.sh deleted file mode 100755 index 29366d5..0000000 --- a/home/.zshrc.d/00_go.sh +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/bash -if command -v go &> /dev/null; then - GOPATH="$(go env GOPATH)" - if [ -n "${GOPATH}" ]; then - export GOPATH - export PATH="${GOPATH}/bin:${PATH}" - fi -else - >&2 echo '"go" is missing from the PATH' -fi diff --git a/home/.zshrc.d/01_update_go_apps.sh b/home/.zshrc.d/01_update_go_apps.sh deleted file mode 100755 index cd269c1..0000000 --- a/home/.zshrc.d/01_update_go_apps.sh +++ /dev/null @@ -1,26 +0,0 @@ -#!/bin/bash -# updates go binary installs that you care about. - -# if the GOAPPS environment variable is set, it is expected to be -# an array -update_go_apps() { - ( - cd || exit $? - - local APPS=("${@}") - - if [ -z "${APPS[0]}" ]; then - if [ -z "${GOAPPS}" ]; then - exit 0 - fi - - APPS=("${GOAPPS[@]}") - fi - - local APP - for APP in "${APPS[@]}"; do - echo "Updating ${APP}" - go get -u "${APP}" || exit $? - done - ) || return $? -} diff --git a/home/.zshrc.d/02_upgrade_system.sh b/home/.zshrc.d/upgrade_system.sh similarity index 93% rename from home/.zshrc.d/02_upgrade_system.sh rename to home/.zshrc.d/upgrade_system.sh index 81f6afe..8a78a02 100755 --- a/home/.zshrc.d/02_upgrade_system.sh +++ b/home/.zshrc.d/upgrade_system.sh @@ -29,10 +29,6 @@ upgrade_system() { ;; esac - if command -v update_go_apps &> /dev/null; then - update_go_apps || return $? - fi - if command -v vim &> /dev/null; then vim -c 'PlugUpgrade | q' || return $? vim -c 'PlugUpdate | sleep 3 | qa' || return $?