fix(bash): alias completion
This commit is contained in:
parent
d4d3c1af55
commit
2d8685c8e4
2
.bashrc
2
.bashrc
@ -11,3 +11,5 @@ for f in "$HOME/.config/bash/"*.bash; do
|
||||
# shellcheck disable=SC1090
|
||||
. "$f"
|
||||
done
|
||||
|
||||
stty werase undef
|
||||
|
19
.config/bash/00-compalias.bash
Normal file
19
.config/bash/00-compalias.bash
Normal file
@ -0,0 +1,19 @@
|
||||
function _compalias() {
|
||||
local name val valarr fn
|
||||
name="${COMP_WORDS[0]}"
|
||||
val="${BASH_ALIASES[$name]}"
|
||||
[ -z "$val" ] && return 1
|
||||
|
||||
read -r -a valarr <<< "$val"
|
||||
COMP_WORDS=("${valarr[@]}" "${COMP_WORDS[@]:1}")
|
||||
COMP_LINE="${COMP_LINE//$name/$val}"
|
||||
COMP_CWORD="$((${#COMP_WORDS[@]} - 1))"
|
||||
COMP_POINT="${#COMP_LINE}"
|
||||
fn="$(complete -p "${COMP_WORDS[0]}" | grep -Po -- '-F\s+\K\w+')"
|
||||
"$fn" "${COMP_WORDS[0]}" "${COMP_WORDS[-1]}" "${COMP_WORDS[-2]}"
|
||||
}
|
||||
|
||||
function compalias() {
|
||||
builtin alias "$@"
|
||||
complete -o nospace -F _compalias "${@%%=*}"
|
||||
}
|
@ -4,52 +4,41 @@ function update() {
|
||||
$TERM --hold -e "$SHELL" -ic "config submodule update --remote --recursive && echo -e '\e[32mDONE'" &
|
||||
}
|
||||
|
||||
alias pac='sudo pacman'
|
||||
alias neofetch=fastfetch
|
||||
alias mail=aerc
|
||||
alias rss=newsraft
|
||||
|
||||
alias vi='$EDITOR'
|
||||
|
||||
alias qcp='qcp -o tabsize=4' \
|
||||
qmv='qmv -o tabsize=4'
|
||||
|
||||
alias config='git --git-dir="$HOME/.dotfiles/" --work-tree="$HOME"' \
|
||||
viconf='(cd "$XDG_CONFIG_HOME/nvim" && $EDITOR .)'
|
||||
|
||||
alias ssh='TERM=xterm-256color ssh'
|
||||
|
||||
alias sudo='sudo ' \
|
||||
watch='watch -c ' \
|
||||
xargs='xargs '
|
||||
|
||||
function tmp() {
|
||||
cd "$(mktemp -d --tmpdir "$1"XXX)" || return
|
||||
}
|
||||
|
||||
function bd() {
|
||||
echo - "$@" | base64 -d; echo
|
||||
}
|
||||
|
||||
alias ...='../..' \
|
||||
....='../../..' \
|
||||
.....='../../../..' \
|
||||
......='../../../../..'
|
||||
|
||||
alias cp='cp -vi' \
|
||||
......='../../../../..' \
|
||||
cp='cp -vi' \
|
||||
mv='mv -vi' \
|
||||
rm='rm -vI' \
|
||||
mkdir='mkdir -v' \
|
||||
rsync='rsync -P'
|
||||
|
||||
alias ls='ls --color=auto' \
|
||||
rsync='rsync -P' \
|
||||
ls='ls --color=auto' \
|
||||
ll='ls -lh' \
|
||||
l='ll -a' \
|
||||
la='ll -A'
|
||||
|
||||
alias diff='diff --color' \
|
||||
grep='grep --color --exclude-dir={.cache,.git,.idea,.venv,.vscode,node_modules}'
|
||||
|
||||
alias feh='feh --auto-zoom --scale-down'
|
||||
|
||||
alias xmr='monero-wallet-cli --daemon-address monero.maby.dev:18081 --trusted-daemon --log-file=/tmp/monero-wallet-cli.log --wallet-file /home/ange/.config/monero/ange'
|
||||
|
||||
function bd() {
|
||||
echo - "$@" | base64 -d; echo
|
||||
}
|
||||
la='ll -A' \
|
||||
diff='diff --color' \
|
||||
grep='grep --color --exclude-dir={.cache,.git,.idea,.venv,.vscode,node_modules}' \
|
||||
pac='sudo pacman' \
|
||||
neofetch=fastfetch \
|
||||
mail=aerc \
|
||||
rss=newsraft \
|
||||
vi='$EDITOR' \
|
||||
qcp='qcp -o tabsize=4' \
|
||||
qmv='qmv -o tabsize=4' \
|
||||
config='git --git-dir="$HOME/.dotfiles/" --work-tree="$HOME"' \
|
||||
viconf='(cd "$XDG_CONFIG_HOME/nvim" && $EDITOR .)' \
|
||||
ssh='TERM=xterm-256color ssh' \
|
||||
sudo='sudo ' \
|
||||
watch='watch -c ' \
|
||||
xargs='xargs ' \
|
||||
feh='feh --auto-zoom --scale-down' \
|
||||
xmr='monero-wallet-cli --daemon-address monero.maby.dev:18081 --trusted-daemon --log-file=/tmp/monero-wallet-cli.log --wallet-file /home/ange/.config/monero/ange'
|
69
.config/bash/10-docker.bash
Normal file
69
.config/bash/10-docker.bash
Normal file
@ -0,0 +1,69 @@
|
||||
compalias dk='docker' \
|
||||
dkb='docker build . -t' \
|
||||
dkc='docker container' \
|
||||
dkcc='docker container create' \
|
||||
dkci='docker container inspect' \
|
||||
dkcls='docker container ls' \
|
||||
dkclsa='docker container ls -a' \
|
||||
dkclsaq='docker container ls -a -q' \
|
||||
dkclsq='docker container ls -q' \
|
||||
dkcrm!='docker container rm -f' \
|
||||
dkcrm='docker container rm' \
|
||||
dkcsp='docker container stop' \
|
||||
dkcst='docker container restart' \
|
||||
dkex='docker container exec -i -t' \
|
||||
dki='docker image' \
|
||||
dkic='docker image create' \
|
||||
dkii='docker image inspect' \
|
||||
dkil='docker pull' \
|
||||
dkils='docker image ls' \
|
||||
dkilsa='docker image ls -a' \
|
||||
dkilsaq='docker image ls -a -q' \
|
||||
dkilsq='docker image ls -q' \
|
||||
dkip='docker image push' \
|
||||
dkirm!='docker image rm -f' \
|
||||
dkirm='docker image rm' \
|
||||
dkis='docker image save' \
|
||||
dkit='docker image tag' \
|
||||
dklo='docker logs -f' \
|
||||
dkn='docker network' \
|
||||
dknc='docker network create' \
|
||||
dkni='docker network inspect' \
|
||||
dknls='docker network ls' \
|
||||
dknlsq='docker network ls -q' \
|
||||
dknrm!='docker network rm -f' \
|
||||
dknrm='docker network rm' \
|
||||
dkr='docker run -i -t' \
|
||||
dksys='docker system' \
|
||||
dksysdf='docker system df' \
|
||||
dksysp!='docker system prune -f' \
|
||||
dksysp='docker system prune' \
|
||||
dktop='docker top' \
|
||||
dkv='docker volume' \
|
||||
dkvc='docker volume create' \
|
||||
dkvi='docker volume inspect' \
|
||||
dkvls='docker volume ls' \
|
||||
dkvlsq='docker volume ls -q' \
|
||||
dkvrm!='docker volume rm -f' \
|
||||
dkvrm='docker volume rm'
|
||||
|
||||
compalias dc='docker-compose' \
|
||||
dcb!='docker-compose build --no-cache' \
|
||||
dcb='docker-compose build' \
|
||||
dccls='docker-compose ps' \
|
||||
dcclsq='docker-compose ps -q' \
|
||||
dcd='docker-compose down' \
|
||||
dcex='docker-compose exec' \
|
||||
dcl='docker-compose pull' \
|
||||
dcr='docker-compose run --rm' \
|
||||
dcrd='docker-compose run -d --rm' \
|
||||
dcrm!='docker-compose rm -f' \
|
||||
dcrm='docker-compose rm' \
|
||||
dcrmv!='docker-compose rm -v -f' \
|
||||
dcrmv='docker-compose rm -v' \
|
||||
dcsp='docker-compose stop' \
|
||||
dcst='docker-compose restart' \
|
||||
dcup='docker-compose up' \
|
||||
dcupb='docker-compose up --build' \
|
||||
dcupd='docker-compose up -d' \
|
||||
dcupdb='docker-compose up -d --build'
|
33
.config/bash/10-git.bash
Normal file
33
.config/bash/10-git.bash
Normal file
@ -0,0 +1,33 @@
|
||||
function gi() {
|
||||
local IFS=,
|
||||
|
||||
curl -fL "https://www.toptal.com/developers/gitignore/api/$*"
|
||||
}
|
||||
|
||||
. /usr/share/bash-completion/completions/git
|
||||
compalias g='git' \
|
||||
ga='git add' \
|
||||
gaa='git add --all' \
|
||||
gap='git apply' \
|
||||
gb='git branch' \
|
||||
gbl='git blame -w' \
|
||||
gbs='git bisect' \
|
||||
gc='git commit --verbose' \
|
||||
gca='git commit --verbose --all' \
|
||||
gcl='git clone' \
|
||||
gco='git checkout' \
|
||||
gcp='git cherry-pick' \
|
||||
gd='git diff' \
|
||||
gdup='git diff @{upstream}' \
|
||||
gf='git fetch' \
|
||||
gl='git pull' \
|
||||
glo='git log --oneline --decorate' \
|
||||
gmr='git merge' \
|
||||
gp='git push' \
|
||||
gr='git remote' \
|
||||
grb='git rebase' \
|
||||
grev='git revert' \
|
||||
grh='git reset' \
|
||||
grs='git restore' \
|
||||
gst='git status' \
|
||||
gsta='git stash'
|
162
.config/bash/10-k8s.bash
Normal file
162
.config/bash/10-k8s.bash
Normal file
@ -0,0 +1,162 @@
|
||||
function kns() {
|
||||
local cache="$HOME/.local/state/${FUNCNAME[0]}"
|
||||
|
||||
if [ -n "$1" ]; then
|
||||
if ! kubectl get namespace -o name | grep -q "^namespace/$1\$"; then
|
||||
echo "error: no namespace exists with the name: \"$1\"" >&2
|
||||
return 1
|
||||
fi
|
||||
kubectl config set-context --current --namespace "$1" > /dev/null
|
||||
else
|
||||
if [ "${KUBECONFIG:-"$HOME/.kube/config"}" -nt "$cache" ]; then
|
||||
set -- "$(kubectl config view --minify -o jsonpath='{..namespace}')"
|
||||
else
|
||||
cat "$cache"
|
||||
return
|
||||
fi
|
||||
fi
|
||||
tee "$cache" <<< "$1"
|
||||
}
|
||||
|
||||
function kctx() {
|
||||
local cache="$HOME/.local/state/${FUNCNAME[0]}"
|
||||
|
||||
if [ -n "$1" ]; then
|
||||
kubectl config use-context "$1" > /dev/null || return
|
||||
else
|
||||
if [ "${KUBECONFIG:-"$HOME/.kube/config"}" -nt "$cache" ]; then
|
||||
set -- "$(kubectl config current-context)"
|
||||
else
|
||||
cat "$cache"
|
||||
return
|
||||
fi
|
||||
fi
|
||||
tee "$cache" <<< "$1"
|
||||
}
|
||||
|
||||
alias kga='kubectl get "$(kubectl api-resources --verbs=list --namespaced -oname | grep -v event | paste -sd,)"'
|
||||
|
||||
. /usr/share/bash-completion/completions/kubectl
|
||||
compalias k=kubectl \
|
||||
ka='kubectl apply --recursive -f' \
|
||||
kd='kubectl describe' \
|
||||
kdcj='kubectl describe cronjob' \
|
||||
kdcm='kubectl describe configmap' \
|
||||
kddep='kubectl describe deployment' \
|
||||
kding='kubectl describe ingress' \
|
||||
kdj='kubectl describe job' \
|
||||
kdno='kubectl describe node' \
|
||||
kdns='kubectl describe namespace' \
|
||||
kdpo='kubectl describe pod' \
|
||||
kdpvc='kubectl describe persistentvolumeclaim' \
|
||||
kdsec='kubectl describe secret' \
|
||||
kdsts='kubectl describe statefulset' \
|
||||
kdsvc='kubectl describe service' \
|
||||
kex='kubectl exec -i -t' \
|
||||
kg='kubectl get' \
|
||||
kgall='kubectl get --all-namespaces' \
|
||||
kgalloname='kubectl get --all-namespaces -o name' \
|
||||
kgallowide='kubectl get --all-namespaces -o wide' \
|
||||
kgalloyaml='kubectl get --all-namespaces -o yaml' \
|
||||
kgcj='kubectl get cronjob' \
|
||||
kgcjall='kubectl get cronjob --all-namespaces' \
|
||||
kgcjalloname='kubectl get cronjob --all-namespaces -o name' \
|
||||
kgcjallowide='kubectl get cronjob --all-namespaces -o wide' \
|
||||
kgcjalloyaml='kubectl get cronjob --all-namespaces -o yaml' \
|
||||
kgcjoname='kubectl get cronjob -o name' \
|
||||
kgcjowide='kubectl get cronjob -o wide' \
|
||||
kgcjoyaml='kubectl get cronjob -o yaml' \
|
||||
kgcm='kubectl get configmap' \
|
||||
kgcmall='kubectl get configmap --all-namespaces' \
|
||||
kgcmalloname='kubectl get configmap --all-namespaces -o name' \
|
||||
kgcmallowide='kubectl get configmap --all-namespaces -o wide' \
|
||||
kgcmalloyaml='kubectl get configmap --all-namespaces -o yaml' \
|
||||
kgcmoname='kubectl get configmap -o name' \
|
||||
kgcmowide='kubectl get configmap -o wide' \
|
||||
kgcmoyaml='kubectl get configmap -o yaml' \
|
||||
kgdep='kubectl get deployment' \
|
||||
kgdepall='kubectl get deployment --all-namespaces' \
|
||||
kgdepalloname='kubectl get deployment --all-namespaces -o name' \
|
||||
kgdepallowide='kubectl get deployment --all-namespaces -o wide' \
|
||||
kgdepalloyaml='kubectl get deployment --all-namespaces -o yaml' \
|
||||
kgdeponame='kubectl get deployment -o name' \
|
||||
kgdepowide='kubectl get deployment -o wide' \
|
||||
kgdepoyaml='kubectl get deployment -o yaml' \
|
||||
kging='kubectl get ingress' \
|
||||
kgingall='kubectl get ingress --all-namespaces' \
|
||||
kgingalloname='kubectl get ingress --all-namespaces -o name' \
|
||||
kgingallowide='kubectl get ingress --all-namespaces -o wide' \
|
||||
kgingalloyaml='kubectl get ingress --all-namespaces -o yaml' \
|
||||
kgingoname='kubectl get ingress -o name' \
|
||||
kgingowide='kubectl get ingress -o wide' \
|
||||
kgingoyaml='kubectl get ingress -o yaml' \
|
||||
kgj='kubectl get job' \
|
||||
kgjall='kubectl get job --all-namespaces' \
|
||||
kgjalloname='kubectl get job --all-namespaces -o name' \
|
||||
kgjallowide='kubectl get job --all-namespaces -o wide' \
|
||||
kgjalloyaml='kubectl get job --all-namespaces -o yaml' \
|
||||
kgjoname='kubectl get job -o name' \
|
||||
kgjowide='kubectl get job -o wide' \
|
||||
kgjoyaml='kubectl get job -o yaml' \
|
||||
kgno='kubectl get node' \
|
||||
kgns='kubectl get namespace' \
|
||||
kgnsoname='kubectl get namespace -o name' \
|
||||
kgnsowide='kubectl get namespace -o wide' \
|
||||
kgnsoyaml='kubectl get namespace -o yaml' \
|
||||
kgoname='kubectl get -o name' \
|
||||
kgowide='kubectl get -o wide' \
|
||||
kgoyaml='kubectl get -o yaml' \
|
||||
kgpo='kubectl get pod' \
|
||||
kgpoall='kubectl get pod --all-namespaces' \
|
||||
kgpoalloname='kubectl get pod --all-namespaces -o name' \
|
||||
kgpoallowide='kubectl get pod --all-namespaces -o wide' \
|
||||
kgpoalloyaml='kubectl get pod --all-namespaces -o yaml' \
|
||||
kgpooname='kubectl get pod -o name' \
|
||||
kgpoowide='kubectl get pod -o wide' \
|
||||
kgpooyaml='kubectl get pod -o yaml' \
|
||||
kgpvc='kubectl get persistentvolumeclaim' \
|
||||
kgpvcall='kubectl get persistentvolumeclaim --all-namespaces' \
|
||||
kgpvcalloname='kubectl get persistentvolumeclaim --all-namespaces -o name' \
|
||||
kgpvcallowide='kubectl get persistentvolumeclaim --all-namespaces -o wide' \
|
||||
kgpvcalloyaml='kubectl get persistentvolumeclaim --all-namespaces -o yaml' \
|
||||
kgpvconame='kubectl get persistentvolumeclaim -o name' \
|
||||
kgpvcowide='kubectl get persistentvolumeclaim -o wide' \
|
||||
kgpvcoyaml='kubectl get persistentvolumeclaim -o yaml' \
|
||||
kgsec='kubectl get secret' \
|
||||
kgsecall='kubectl get secret --all-namespaces' \
|
||||
kgsecalloname='kubectl get secret --all-namespaces -o name' \
|
||||
kgsecallowide='kubectl get secret --all-namespaces -o wide' \
|
||||
kgsecalloyaml='kubectl get secret --all-namespaces -o yaml' \
|
||||
kgseconame='kubectl get secret -o name' \
|
||||
kgsecowide='kubectl get secret -o wide' \
|
||||
kgsecoyaml='kubectl get secret -o yaml' \
|
||||
kgsts='kubectl get statefulset' \
|
||||
kgstsall='kubectl get statefulset --all-namespaces' \
|
||||
kgstsalloname='kubectl get statefulset --all-namespaces -o name' \
|
||||
kgstsallowide='kubectl get statefulset --all-namespaces -o wide' \
|
||||
kgstsalloyaml='kubectl get statefulset --all-namespaces -o yaml' \
|
||||
kgstsoname='kubectl get statefulset -o name' \
|
||||
kgstsowide='kubectl get statefulset -o wide' \
|
||||
kgstsoyaml='kubectl get statefulset -o yaml' \
|
||||
kgsvc='kubectl get service' \
|
||||
kgsvcall='kubectl get service --all-namespaces' \
|
||||
kgsvcalloname='kubectl get service --all-namespaces -o name' \
|
||||
kgsvcallowide='kubectl get service --all-namespaces -o wide' \
|
||||
kgsvcalloyaml='kubectl get service --all-namespaces -o yaml' \
|
||||
kgsvconame='kubectl get service -o name' \
|
||||
kgsvcowide='kubectl get service -o wide' \
|
||||
kgsvcoyaml='kubectl get service -o yaml' \
|
||||
klo='kubectl logs' \
|
||||
kpf='kubectl port-forward' \
|
||||
krm='kubectl delete' \
|
||||
krmcj='kubectl delete cronjob' \
|
||||
krmcm='kubectl delete configmap' \
|
||||
krmdep='kubectl delete deployment' \
|
||||
krming='kubectl delete ingress' \
|
||||
krmj='kubectl delete job' \
|
||||
krmns='kubectl delete namespace' \
|
||||
krmpo='kubectl delete pod' \
|
||||
krmpvc='kubectl delete persistentvolumeclaim' \
|
||||
krmsec='kubectl delete secret' \
|
||||
krmsts='kubectl delete statefulset' \
|
||||
krmsvc='kubectl delete service'
|
@ -1,69 +0,0 @@
|
||||
alias dk='docker' \
|
||||
dkb='docker build . -t' \
|
||||
dkc='docker container' \
|
||||
dkcc='docker container create' \
|
||||
dkci='docker container inspect' \
|
||||
dkcls='docker container ls' \
|
||||
dkclsa='docker container ls -a' \
|
||||
dkclsaq='docker container ls -a -q' \
|
||||
dkclsq='docker container ls -q' \
|
||||
dkcrm!='docker container rm -f' \
|
||||
dkcrm='docker container rm' \
|
||||
dkcsp='docker container stop' \
|
||||
dkcst='docker container restart' \
|
||||
dkex='docker container exec -i -t' \
|
||||
dki='docker image' \
|
||||
dkic='docker image create' \
|
||||
dkii='docker image inspect' \
|
||||
dkil='docker pull' \
|
||||
dkils='docker image ls' \
|
||||
dkilsa='docker image ls -a' \
|
||||
dkilsaq='docker image ls -a -q' \
|
||||
dkilsq='docker image ls -q' \
|
||||
dkip='docker image push' \
|
||||
dkirm!='docker image rm -f' \
|
||||
dkirm='docker image rm' \
|
||||
dkis='docker image save' \
|
||||
dkit='docker image tag' \
|
||||
dklo='docker logs -f' \
|
||||
dkn='docker network' \
|
||||
dknc='docker network create' \
|
||||
dkni='docker network inspect' \
|
||||
dknls='docker network ls' \
|
||||
dknlsq='docker network ls -q' \
|
||||
dknrm!='docker network rm -f' \
|
||||
dknrm='docker network rm' \
|
||||
dkr='docker run -i -t' \
|
||||
dksys='docker system' \
|
||||
dksysdf='docker system df' \
|
||||
dksysp!='docker system prune -f' \
|
||||
dksysp='docker system prune' \
|
||||
dktop='docker top' \
|
||||
dkv='docker volume' \
|
||||
dkvc='docker volume create' \
|
||||
dkvi='docker volume inspect' \
|
||||
dkvls='docker volume ls' \
|
||||
dkvlsq='docker volume ls -q' \
|
||||
dkvrm!='docker volume rm -f' \
|
||||
dkvrm='docker volume rm'
|
||||
|
||||
alias dc='docker-compose' \
|
||||
dcb!='docker-compose build --no-cache' \
|
||||
dcb='docker-compose build' \
|
||||
dccls='docker-compose ps' \
|
||||
dcclsq='docker-compose ps -q' \
|
||||
dcd='docker-compose down' \
|
||||
dcex='docker-compose exec' \
|
||||
dcl='docker-compose pull' \
|
||||
dcr='docker-compose run --rm' \
|
||||
dcrd='docker-compose run -d --rm' \
|
||||
dcrm!='docker-compose rm -f' \
|
||||
dcrm='docker-compose rm' \
|
||||
dcrmv!='docker-compose rm -v -f' \
|
||||
dcrmv='docker-compose rm -v' \
|
||||
dcsp='docker-compose stop' \
|
||||
dcst='docker-compose restart' \
|
||||
dcup='docker-compose up' \
|
||||
dcupb='docker-compose up --build' \
|
||||
dcupd='docker-compose up -d' \
|
||||
dcupdb='docker-compose up -d --build'
|
@ -1,32 +0,0 @@
|
||||
function gi() {
|
||||
local IFS=,
|
||||
|
||||
curl -fL "https://www.toptal.com/developers/gitignore/api/$*"
|
||||
}
|
||||
|
||||
alias g='git' \
|
||||
ga='git add' \
|
||||
gaa='git add --all' \
|
||||
gap='git apply' \
|
||||
gb='git branch' \
|
||||
gbl='git blame -w' \
|
||||
gbs='git bisect' \
|
||||
gc='git commit --verbose' \
|
||||
gca='git commit --verbose --all' \
|
||||
gcl='git clone' \
|
||||
gco='git checkout' \
|
||||
gcp='git cherry-pick' \
|
||||
gd='git diff' \
|
||||
gdup='git diff @{upstream}' \
|
||||
gf='git fetch' \
|
||||
gl='git pull' \
|
||||
glo='git log --oneline --decorate' \
|
||||
gmr='git merge' \
|
||||
gp='git push' \
|
||||
gr='git remote' \
|
||||
grb='git rebase' \
|
||||
grev='git revert' \
|
||||
grh='git reset' \
|
||||
grs='git restore' \
|
||||
gst='git status' \
|
||||
gsta='git stash'
|
@ -1,161 +0,0 @@
|
||||
function kns() {
|
||||
local cache="$HOME/.local/state/${FUNCNAME[0]}"
|
||||
|
||||
if [ -n "$1" ]; then
|
||||
if ! kubectl get namespace -o name | grep -q "^namespace/$1\$"; then
|
||||
echo "error: no namespace exists with the name: \"$1\"" >&2
|
||||
return 1
|
||||
fi
|
||||
kubectl config set-context --current --namespace "$1" > /dev/null
|
||||
else
|
||||
if [ "${KUBECONFIG:-"$HOME/.kube/config"}" -nt "$cache" ]; then
|
||||
set -- "$(kubectl config view --minify -o jsonpath='{..namespace}')"
|
||||
else
|
||||
cat "$cache"
|
||||
return
|
||||
fi
|
||||
fi
|
||||
tee "$cache" <<< "$1"
|
||||
}
|
||||
|
||||
function kctx() {
|
||||
local cache="$HOME/.local/state/${FUNCNAME[0]}"
|
||||
|
||||
if [ -n "$1" ]; then
|
||||
kubectl config use-context "$1" > /dev/null || return
|
||||
else
|
||||
if [ "${KUBECONFIG:-"$HOME/.kube/config"}" -nt "$cache" ]; then
|
||||
set -- "$(kubectl config current-context)"
|
||||
else
|
||||
cat "$cache"
|
||||
return
|
||||
fi
|
||||
fi
|
||||
tee "$cache" <<< "$1"
|
||||
}
|
||||
|
||||
alias kga='kubectl get "$(kubectl api-resources --verbs=list --namespaced -oname | grep -v event | paste -sd,)"'
|
||||
|
||||
alias k=kubectl \
|
||||
ka='kubectl apply --recursive -f' \
|
||||
kd='kubectl describe' \
|
||||
kdcj='kubectl describe cronjob' \
|
||||
kdcm='kubectl describe configmap' \
|
||||
kddep='kubectl describe deployment' \
|
||||
kding='kubectl describe ingress' \
|
||||
kdj='kubectl describe job' \
|
||||
kdno='kubectl describe node' \
|
||||
kdns='kubectl describe namespace' \
|
||||
kdpo='kubectl describe pod' \
|
||||
kdpvc='kubectl describe persistentvolumeclaim' \
|
||||
kdsec='kubectl describe secret' \
|
||||
kdsts='kubectl describe statefulset' \
|
||||
kdsvc='kubectl describe service' \
|
||||
kex='kubectl exec -i -t' \
|
||||
kg='kubectl get' \
|
||||
kgall='kubectl get --all-namespaces' \
|
||||
kgalloname='kubectl get --all-namespaces -o name' \
|
||||
kgallowide='kubectl get --all-namespaces -o wide' \
|
||||
kgalloyaml='kubectl get --all-namespaces -o yaml' \
|
||||
kgcj='kubectl get cronjob' \
|
||||
kgcjall='kubectl get cronjob --all-namespaces' \
|
||||
kgcjalloname='kubectl get cronjob --all-namespaces -o name' \
|
||||
kgcjallowide='kubectl get cronjob --all-namespaces -o wide' \
|
||||
kgcjalloyaml='kubectl get cronjob --all-namespaces -o yaml' \
|
||||
kgcjoname='kubectl get cronjob -o name' \
|
||||
kgcjowide='kubectl get cronjob -o wide' \
|
||||
kgcjoyaml='kubectl get cronjob -o yaml' \
|
||||
kgcm='kubectl get configmap' \
|
||||
kgcmall='kubectl get configmap --all-namespaces' \
|
||||
kgcmalloname='kubectl get configmap --all-namespaces -o name' \
|
||||
kgcmallowide='kubectl get configmap --all-namespaces -o wide' \
|
||||
kgcmalloyaml='kubectl get configmap --all-namespaces -o yaml' \
|
||||
kgcmoname='kubectl get configmap -o name' \
|
||||
kgcmowide='kubectl get configmap -o wide' \
|
||||
kgcmoyaml='kubectl get configmap -o yaml' \
|
||||
kgdep='kubectl get deployment' \
|
||||
kgdepall='kubectl get deployment --all-namespaces' \
|
||||
kgdepalloname='kubectl get deployment --all-namespaces -o name' \
|
||||
kgdepallowide='kubectl get deployment --all-namespaces -o wide' \
|
||||
kgdepalloyaml='kubectl get deployment --all-namespaces -o yaml' \
|
||||
kgdeponame='kubectl get deployment -o name' \
|
||||
kgdepowide='kubectl get deployment -o wide' \
|
||||
kgdepoyaml='kubectl get deployment -o yaml' \
|
||||
kging='kubectl get ingress' \
|
||||
kgingall='kubectl get ingress --all-namespaces' \
|
||||
kgingalloname='kubectl get ingress --all-namespaces -o name' \
|
||||
kgingallowide='kubectl get ingress --all-namespaces -o wide' \
|
||||
kgingalloyaml='kubectl get ingress --all-namespaces -o yaml' \
|
||||
kgingoname='kubectl get ingress -o name' \
|
||||
kgingowide='kubectl get ingress -o wide' \
|
||||
kgingoyaml='kubectl get ingress -o yaml' \
|
||||
kgj='kubectl get job' \
|
||||
kgjall='kubectl get job --all-namespaces' \
|
||||
kgjalloname='kubectl get job --all-namespaces -o name' \
|
||||
kgjallowide='kubectl get job --all-namespaces -o wide' \
|
||||
kgjalloyaml='kubectl get job --all-namespaces -o yaml' \
|
||||
kgjoname='kubectl get job -o name' \
|
||||
kgjowide='kubectl get job -o wide' \
|
||||
kgjoyaml='kubectl get job -o yaml' \
|
||||
kgno='kubectl get node' \
|
||||
kgns='kubectl get namespace' \
|
||||
kgnsoname='kubectl get namespace -o name' \
|
||||
kgnsowide='kubectl get namespace -o wide' \
|
||||
kgnsoyaml='kubectl get namespace -o yaml' \
|
||||
kgoname='kubectl get -o name' \
|
||||
kgowide='kubectl get -o wide' \
|
||||
kgoyaml='kubectl get -o yaml' \
|
||||
kgpo='kubectl get pod' \
|
||||
kgpoall='kubectl get pod --all-namespaces' \
|
||||
kgpoalloname='kubectl get pod --all-namespaces -o name' \
|
||||
kgpoallowide='kubectl get pod --all-namespaces -o wide' \
|
||||
kgpoalloyaml='kubectl get pod --all-namespaces -o yaml' \
|
||||
kgpooname='kubectl get pod -o name' \
|
||||
kgpoowide='kubectl get pod -o wide' \
|
||||
kgpooyaml='kubectl get pod -o yaml' \
|
||||
kgpvc='kubectl get persistentvolumeclaim' \
|
||||
kgpvcall='kubectl get persistentvolumeclaim --all-namespaces' \
|
||||
kgpvcalloname='kubectl get persistentvolumeclaim --all-namespaces -o name' \
|
||||
kgpvcallowide='kubectl get persistentvolumeclaim --all-namespaces -o wide' \
|
||||
kgpvcalloyaml='kubectl get persistentvolumeclaim --all-namespaces -o yaml' \
|
||||
kgpvconame='kubectl get persistentvolumeclaim -o name' \
|
||||
kgpvcowide='kubectl get persistentvolumeclaim -o wide' \
|
||||
kgpvcoyaml='kubectl get persistentvolumeclaim -o yaml' \
|
||||
kgsec='kubectl get secret' \
|
||||
kgsecall='kubectl get secret --all-namespaces' \
|
||||
kgsecalloname='kubectl get secret --all-namespaces -o name' \
|
||||
kgsecallowide='kubectl get secret --all-namespaces -o wide' \
|
||||
kgsecalloyaml='kubectl get secret --all-namespaces -o yaml' \
|
||||
kgseconame='kubectl get secret -o name' \
|
||||
kgsecowide='kubectl get secret -o wide' \
|
||||
kgsecoyaml='kubectl get secret -o yaml' \
|
||||
kgsts='kubectl get statefulset' \
|
||||
kgstsall='kubectl get statefulset --all-namespaces' \
|
||||
kgstsalloname='kubectl get statefulset --all-namespaces -o name' \
|
||||
kgstsallowide='kubectl get statefulset --all-namespaces -o wide' \
|
||||
kgstsalloyaml='kubectl get statefulset --all-namespaces -o yaml' \
|
||||
kgstsoname='kubectl get statefulset -o name' \
|
||||
kgstsowide='kubectl get statefulset -o wide' \
|
||||
kgstsoyaml='kubectl get statefulset -o yaml' \
|
||||
kgsvc='kubectl get service' \
|
||||
kgsvcall='kubectl get service --all-namespaces' \
|
||||
kgsvcalloname='kubectl get service --all-namespaces -o name' \
|
||||
kgsvcallowide='kubectl get service --all-namespaces -o wide' \
|
||||
kgsvcalloyaml='kubectl get service --all-namespaces -o yaml' \
|
||||
kgsvconame='kubectl get service -o name' \
|
||||
kgsvcowide='kubectl get service -o wide' \
|
||||
kgsvcoyaml='kubectl get service -o yaml' \
|
||||
klo='kubectl logs' \
|
||||
kpf='kubectl port-forward' \
|
||||
krm='kubectl delete' \
|
||||
krmcj='kubectl delete cronjob' \
|
||||
krmcm='kubectl delete configmap' \
|
||||
krmdep='kubectl delete deployment' \
|
||||
krming='kubectl delete ingress' \
|
||||
krmj='kubectl delete job' \
|
||||
krmns='kubectl delete namespace' \
|
||||
krmpo='kubectl delete pod' \
|
||||
krmpvc='kubectl delete persistentvolumeclaim' \
|
||||
krmsec='kubectl delete secret' \
|
||||
krmsts='kubectl delete statefulset' \
|
||||
krmsvc='kubectl delete service'
|
@ -1,8 +1,9 @@
|
||||
@ Global [60] {100}
|
||||
|
||||
@ Entertainment
|
||||
https://www.youtube.com/feeds/videos.xml?channel_id=UCI4W-ck8ZLA_YljxMhlpg2g "ChessSimp"
|
||||
https://www.youtube.com/feeds/videos.xml?channel_id=UCto7D1L-MiRoOziCXK9uT5Q "LetsGameItOut"
|
||||
https://www.youtube.com/feeds/videos.xml?channel_id=UCI4W-ck8ZLA_YljxMhlpg2g "Chess Simp"
|
||||
https://www.youtube.com/feeds/videos.xml?channel_id=UCto7D1L-MiRoOziCXK9uT5Q "Let's Game It Out"
|
||||
https://www.youtube.com/feeds/videos.xml?channel_id=UCf-vV5woXPFpkvZKwooWoyw "WirtualTV"
|
||||
|
||||
@ News
|
||||
https://archlinux.org/feeds/news/ "ArchLinux"
|
||||
@ -24,6 +25,7 @@ https://www.getmonero.org/feed.xml "Monero"
|
||||
https://github.com/nextcloud/server/releases.atom "Nextcloud"
|
||||
https://github.com/searxng/searxng/commits/master.atom "SearXNG"
|
||||
https://github.com/element-hq/synapse/releases.atom "Synapse"
|
||||
https://github.com/matrix-org/dendrite/releases.atom "Dendrite"
|
||||
https://github.com/qbittorrent/qBittorrent/tags.atom "qBittorrent"
|
||||
https://github.com/ventoy/Ventoy/releases.atom "Ventoy"
|
||||
|
||||
|
@ -1 +1 @@
|
||||
Subproject commit 61a4a615366c470a4e9ca8f8b45718b6b92af73f
|
||||
Subproject commit bfcc7d5c6f12209139f175e6123a7b7de6d9c18a
|
@ -1 +1 @@
|
||||
Subproject commit 53b32a6aa3e1de224e82f88cbdc08584c753adb7
|
||||
Subproject commit ffd7725102f47e7391d7a5e7621d178689602a52
|
11
.inputrc
11
.inputrc
@ -1,6 +1,13 @@
|
||||
set colored-stats on
|
||||
set show-all-if-unmodified on
|
||||
set menu-complete-display-prefix on
|
||||
set show-all-if-ambiguous on
|
||||
|
||||
"\e[A":history-search-backward
|
||||
"\e[B":history-search-forward
|
||||
|
||||
Control-l: clear-screen
|
||||
"\C-l": clear-screen
|
||||
|
||||
"\C-w": backward-kill-word
|
||||
|
||||
TAB:menu-complete
|
||||
"\e[Z":menu-complete-backward
|
||||
|
@ -1 +0,0 @@
|
||||
complete -F _command doas
|
@ -1,2 +0,0 @@
|
||||
. /usr/share/bash-completion/completions/kubectl
|
||||
complete -F __start_kubectl k
|
@ -1,6 +1,7 @@
|
||||
function _kctx() {
|
||||
[ "$COMP_CWORD" -ne 1 ] && return
|
||||
mapfile -t COMPREPLY < <(compgen -W \
|
||||
"$(kubectl config get-contexts -o name)" \
|
||||
-- "${COMP_WORDS[1]}")
|
||||
}
|
||||
complete -F _kctx kctx
|
||||
complete -o nospace -F _kctx kctx
|
||||
|
@ -1,6 +1,7 @@
|
||||
function _kns() {
|
||||
[ "$COMP_CWORD" -ne 1 ] && return
|
||||
mapfile -t COMPREPLY < <(compgen -W \
|
||||
"$(kubectl get namespace -o jsonpath='{..metadata.name}')" \
|
||||
-- "${COMP_WORDS[1]}")
|
||||
}
|
||||
complete -F _kns kns
|
||||
complete -o nospace -F _kns kns
|
||||
|
2
.local/share/bash-completion/completions/pac
Normal file
2
.local/share/bash-completion/completions/pac
Normal file
@ -0,0 +1,2 @@
|
||||
. /usr/share/bash-completion/completions/pacman
|
||||
complete -F _pacman pac
|
Loading…
Reference in New Issue
Block a user