From af257ac1186db3a5da812e1847d2ee24244f7459 Mon Sep 17 00:00:00 2001 From: Sage Vaillancourt Date: Mon, 22 Jan 2024 11:18:27 -0500 Subject: [PATCH] Add integrate and kubelog shell functions integrate for quickly making additions to dotfiles kubelog for logging kube pods by name --- fake_home/.shell_aliases | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/fake_home/.shell_aliases b/fake_home/.shell_aliases index ca39bf3..aa44544 100755 --- a/fake_home/.shell_aliases +++ b/fake_home/.shell_aliases @@ -8,6 +8,22 @@ else alias pacman="sudo pacman" 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 { [[ "$1" == "help" ]] || [[ "$1" == "-h" ]] || [[ "$1" == "--help" ]] } @@ -30,6 +46,16 @@ function hearch { 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 hsearch='hearch' alias d='docker'