Trim the fat from .profile

Still have so much to do though
This commit is contained in:
Salt 2022-06-06 23:50:11 -05:00
parent 9211b18f23
commit cbd575b7b1

View File

@ -1,15 +1,13 @@
#!/bin/sh #!/bin/sh
#
# Copyright (c) 2017 rehashedsalt/vintagesalt # My shell profile
#
# Copyright (c) 2017-2022 Jacob Babor
# Licensed under the terms of the MIT license # Licensed under the terms of the MIT license
#
## POSIX NOTICE
# This script, or at least the parts expected to be run by a standard sh
# implementation, should be fully POSIX-compliant. If it is not, open a bug
# report at git.9iron.club/salt/home and I'll take care of it.
## SHELLCHECK ## SHELLCHECK
# Not finding these sources is none of my concern; they're out of scope # Yeah whatever I don't care that you can't find these
# shellcheck disable=1091 # shellcheck disable=1091
# shellcheck disable=1090 # shellcheck disable=1090
# I'm well aware of when functions are defined vs used # I'm well aware of when functions are defined vs used
@ -55,11 +53,6 @@ has() {
command -v "$1" > /dev/null 2>&1 command -v "$1" > /dev/null 2>&1
} }
# Doot
if ! has doot; then
alias doot="echo Doot doot."
fi
# Grab pip completion, if it exists # Grab pip completion, if it exists
if has pip; then if has pip; then
case "$_baseshell" in case "$_baseshell" in
@ -81,34 +74,6 @@ if has pip; then
;; ;;
esac esac
fi fi
if has kubectl; then
case "$_baseshell" in
*bash)
if ! [ -f "$HOME/.kubectl-completion-bash" ]; then
kubectl completion bash > "$HOME/.kubectl-completion-bash"
echo ".profile: Created kubectl completion for bash"
fi
. "$HOME/.kubectl-completion-bash"
;;
*)
;;
esac
fi
if has terraform; then
case "$_baseshell" in
*bash)
complete -C "$(which terraform)" terraform
;;
*)
;;
esac
fi
# Set up go, if we have it
if has go; then
export GOPATH="$HOME/.local/go"
[ "${PATH#*$GOPATH}" = "$PATH" ] && export PATH="$PATH:$GOPATH/bin"
fi
# Grab dircolors, if it exists # Grab dircolors, if it exists
if has dircolors; then if has dircolors; then
@ -127,35 +92,11 @@ for editor in vim vi nano; do
break break
fi fi
done done
alias e='$EDITOR'
# Now for a shitton of aliases # Now for a shitton of aliases
if ! has define; then
if has mate-dictionary; then
alias define='mate-dictionary -n --look-up'
fi
fi
if ! has helpme; then
# https://breanneboland.com/blog/2020/02/28/you-can-put-what-in-dns-txt-records-a-blog-post-for-con-west-2020/
alias helpme='dig +short txt "$(( RANDOM % 50 )).maybethiscould.work"'
fi
if has emerge; then
alias e-depclean='sudo emerge -a --depclean'
alias e-inst='sudo emerge -a --jobs --tree --quiet-build y'
alias e-upgrade='sudo emerge -DNUua --jobs --tree --quiet-build y --with-bdeps=y --keep-going --backtrack=1000 @world'
alias e-newuse='sudo emerge -Uva --jobs --tree --quiet-build y @world'
alias e-search='emerge -s'
alias e-sync='sudo emerge --sync'
if has eclean; then
alias e-cleanup='sudo eclean -d distfiles && sudo eclean -d packages'
fi
fi
if has firestarter and ! has fs; then if has firestarter and ! has fs; then
alias fs="firestarter" alias fs="firestarter"
fi fi
if has fork; then
alias dup="fork $TERMINAL $PWD"
fi
if has git; then if has git; then
# Thanks Bash-it! # Thanks Bash-it!
alias g='git' alias g='git'
@ -243,22 +184,6 @@ if has git; then
# Show untracked files # Show untracked files
alias gu='git ls-files . --exclude-standard --others' alias gu='git ls-files . --exclude-standard --others'
fi fi
if has kubectl; then
alias k='kubectl'
fi
if has nc; then
# I'm not sorry
alias blinkenlights='nc -v towel.blinkenlights.nl 23'
fi
if has ptgdp; then
song() {
if [ -z "$*" ]; then
echo "song: Requires an argument"
return 1
fi
echo "$*" | ptgdp -p
}
fi
if has sed && has find; then if has sed && has find; then
replace() { replace() {
if [ $# -ne 2 ]; then if [ $# -ne 2 ]; then
@ -286,11 +211,6 @@ if has tree; then
alias ts="tree $treeargs -hL 2" alias ts="tree $treeargs -hL 2"
unset treeargs unset treeargs
fi fi
if has vault; then
alias vlogin="vault login -method=ldap username=$(whoami)"
alias vls="vault list"
alias vr="vault read"
fi
# Aliases for common utilities # Aliases for common utilities
if [ "$(uname)" = "Linux" ] || has brew; then if [ "$(uname)" = "Linux" ] || has brew; then
@ -395,7 +315,6 @@ case "$_baseshell" in
esac esac
# Clean up # Clean up
unset gnubin
unset -v _baseshell unset -v _baseshell
unset -f has unset -f has