utils/bash/bashrc/sources/12_shortcuts

28 lines
570 B
Plaintext
Raw Normal View History

2022-08-09 06:48:36 +00:00
#!/bin/bash
function git-config-as {
local SHA NAME EMAIL
SHA=$1
if [ -z "$1" ]; then
SHA=HEAD
fi
NAME=$( git log $SHA -1 --pretty=format:%aN )
EMAIL=$( git log $SHA -1 --pretty=format:%ae )
git config user.name "$NAME"
git config user.email "$EMAIL"
echo "Configured as \"$NAME <$EMAIL>\""
}
2022-08-10 06:03:51 +00:00
# Kubernetes
function kres {
local _O _D
_O="-ocustom-columns=NAMESPACE:.metadata.namespace,NAME:.metadata.name"
_D="[0-9A-Za-z\-]"
if [ -z "$3" ]; then
kubectl get $1 -A $_O | grep "$2"
else
kubectl get $1 -A $_O | grep "$_D*$2$_D*\s\+$_D*$3$_D*"
fi
}