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:
parent
74050a766c
commit
af257ac118
|
@ -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'
|
||||||
|
|
Loading…
Reference in New Issue