Add integrate and kubelog shell functions

integrate for quickly making additions to dotfiles
kubelog for logging kube pods by name
This commit is contained in:
Sage Vaillancourt 2024-01-22 11:18:27 -05:00
parent 74050a766c
commit af257ac118
1 changed files with 26 additions and 0 deletions

View File

@ -8,6 +8,22 @@ else
alias pacman="sudo pacman" alias pacman="sudo pacman"
fi fi
function integrate {
local from="$(realpath $1)"
if [[ "$from" == "$f"* ]]; then
echo "File is already in $f"
return 1
fi
local to="${from/${HOME}/${f}}"
local sec=3
echo "mv '$from' '$to' in $sec seconds"
sleep $sec
mv -n "$from" "$to" || return 1
cd $DOT_DIR || return 1
./copy.sh
cd -
}
function ishelp { function ishelp {
[[ "$1" == "help" ]] || [[ "$1" == "-h" ]] || [[ "$1" == "--help" ]] [[ "$1" == "help" ]] || [[ "$1" == "-h" ]] || [[ "$1" == "--help" ]]
} }
@ -30,6 +46,16 @@ function hearch {
history 0 | sed 's/[0-9 ]*//' | grep "$@" history 0 | sed 's/[0-9 ]*//' | grep "$@"
} }
function kubelog {
local pods="$(kubectl get pods | grep "$1")"
local selection="1"
if [[ "$2" != "" ]]; then
selection="$2"
fi
local pod="$(echo "$pods" | awk '{print $1}' | head -n $selection | tail -n 1)"
kubectl logs -f "$pod"
}
alias j='journalctl -xefu' alias j='journalctl -xefu'
alias hsearch='hearch' alias hsearch='hearch'
alias d='docker' alias d='docker'