File tree Expand file tree Collapse file tree 2 files changed +19
-1
lines changed
Expand file tree Collapse file tree 2 files changed +19
-1
lines changed Original file line number Diff line number Diff line change @@ -106,6 +106,7 @@ alias ssht="ssh_multi"
106106alias flat=" cat_flat"
107107alias ll=" ls_ext"
108108alias l=" ls_ext"
109+ alias kn=" k8s_namespace"
109110
110111# Traps
111112alias git=" git_trap"
@@ -414,6 +415,11 @@ function go_clone() {
414415}
415416
416417function create_backup() {
418+ if [[ $# -eq 0 ]] ; then
419+ echo " Usage: bkp {file}"
420+ return 0
421+ fi
422+
417423 if ! cp -rp " $1 " " $1 .bak" ; then
418424 return 1
419425 fi
@@ -453,13 +459,24 @@ function ssh_multi() {
453459
454460function cat_flat() {
455461 if [[ $# -lt 2 ]] ; then
456- echo " Usage: flat file"
462+ echo " Usage: flat { file} "
457463 return 0
458464 fi
459465
460466 cat $1 | tr ' \n' ' ' ; echo " "
461467}
462468
469+ function k8s_namespace() {
470+ if [[ $# -eq 0 ]] ; then
471+ kubectl get ns -o ' jsonpath={.items[*].metadata.name}' | tr ' ' ' \n' | grep -vE ' (kube-.*|yandex-.*)'
472+ return $?
473+ fi
474+
475+ kubectl config set-context --current --namespace=" $1 "
476+
477+ return $?
478+ }
479+
463480function tmux_win_to_path() {
464481 if [[ -z " $TMUX " ]] ; then
465482 return 1
Original file line number Diff line number Diff line change @@ -26,6 +26,7 @@ bash <(curl -fsSL https://andy.one/dotfiles/install.sh)
2626| ` dr … ` | Docker ` run ` shortcut |
2727| ` de … ` | Docker ` exec ` shortcut |
2828| ` k … ` | ` kubectl ` shortcut |
29+ | ` kn {namespace} ` | Set k8s namespace |
2930| ` lll … ` | List files and directories using [ ` eza ` ] ( https://github.com/eza-community/eza ) |
3031| ` llg … ` | List files and directories using [ ` eza ` ] ( https://github.com/eza-community/eza ) with ` git ` status |
3132| ` hf … ` | ` grep ` over zsh history |
You can’t perform that action at this time.
0 commit comments