feat: kx instead of kn for simplicity
This commit is contained in:
parent
6ccce87f1a
commit
8ff07de964
7 changed files with 14 additions and 22 deletions
|
@ -12,25 +12,17 @@
|
|||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
function kn() {
|
||||
(set -e
|
||||
local ctx="${1%/*}"
|
||||
local ns="$2"
|
||||
function kx() {
|
||||
1="$(echo - "$1" | tr -c '[:alnum:]-_' '[ *]')"
|
||||
local ctx="$(echo - "$1" | awk '{print $1}')"
|
||||
local ns="${2-$(echo - "$1" | awk '{print $2}')}"
|
||||
|
||||
if [ -z "$ns" ] && [ "$ctx" != "$1" ]; then
|
||||
ns="${1#*/}"
|
||||
fi
|
||||
if [ -n "$ns" ]; then
|
||||
kubectx "${ctx:l}"
|
||||
else
|
||||
ns="$ctx"
|
||||
fi
|
||||
kubens "${ns:l}"
|
||||
)
|
||||
kubectx ${ctx:l}
|
||||
[ -n "$ns" ] && kubens "${ns:l}"
|
||||
}
|
||||
compdef -e _kubens.zsh kn
|
||||
compdef -e _kubectx.zsh kx
|
||||
|
||||
alias kx='kubectx'
|
||||
alias kn='kubens'
|
||||
alias k='kubectl'
|
||||
alias ksys='kubectl --namespace=kube-system'
|
||||
alias ka='kubectl apply --recursive -f'
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit 5ab517361a4215d2f777023fc1e772fe79496713
|
||||
Subproject commit 1aa58d42a52b8fa39f16ad169fc405f276c36ae5
|
Loading…
Add table
Add a link
Reference in a new issue