diff --git a/plugins/docker/README.md b/plugins/docker/README.md index 2b721c770..606690f14 100644 --- a/plugins/docker/README.md +++ b/plugins/docker/README.md @@ -57,7 +57,7 @@ the lines below to your zshrc file**, but be aware of the side effects: | dib | `docker image build` | Build an image from a Dockerfile (same as docker build) | | dii | `docker image inspect` | Display detailed information on one or more images | | dils | `docker image ls` | List docker images | -| dip | `docker image push` | Push an image or repository to a remote registry | +| dipu | `docker image push` | Push an image or repository to a remote registry | | dirm | `docker image rm` | Remove one or more images | | dit | `docker image tag` | Add a name and tag to a particular image | | | | **Docker Network** | diff --git a/plugins/docker/docker.plugin.zsh b/plugins/docker/docker.plugin.zsh index 843c8e241..9c8ad8a28 100644 --- a/plugins/docker/docker.plugin.zsh +++ b/plugins/docker/docker.plugin.zsh @@ -21,7 +21,7 @@ alias dxcit='docker container exec -it' alias dib='docker image build' alias dii='docker image inspect' alias dils='docker image ls' -alias dip='docker image push' +alias dipu='docker image push' alias dirm='docker image rm' alias dit='docker image tag' diff --git a/plugins/github/README.md b/plugins/github/README.md index af2b8a4e7..5d8b62501 100644 --- a/plugins/github/README.md +++ b/plugins/github/README.md @@ -11,7 +11,6 @@ This plugin supports working with GitHub from the command line. It provides a fe * `empty_gh` - Creates a new empty repo (with a `README.md`) and pushes it to GitHub * `new_gh` - Initializes an existing directory as a repo and pushes it to GitHub * `exist_gh` - Takes an existing repo and pushes it to GitHub -* `git.io` - Shortens a URL using [git.io](https://git.io) ## Installation diff --git a/plugins/github/github.plugin.zsh b/plugins/github/github.plugin.zsh index 8e4b97352..79114ff69 100644 --- a/plugins/github/github.plugin.zsh +++ b/plugins/github/github.plugin.zsh @@ -68,8 +68,9 @@ exist_gh() { # [DIRECTORY] # documentation: https://github.com/blog/985-git-io-github-url-shortener # git.io() { - emulate -L zsh - curl -i -s https://git.io -F "url=$1" | grep "Location" | cut -f 2 -d " " + # emulate -L zsh + # curl -i -s https://git.io -F "url=$1" | grep "Location" | cut -f 2 -d " " + print -u2 ${(%):-"%F{yellow}%BThe \`git.io\` is deprecated.%b\nView the announcement made by GitHub: https://github.blog/changelog/2022-01-11-git-io-no-longer-accepts-new-urls/%f"} } # End Functions ############################################################# diff --git a/plugins/kube-ps1/README.md b/plugins/kube-ps1/README.md index b08997b0f..1ed3e4438 100644 --- a/plugins/kube-ps1/README.md +++ b/plugins/kube-ps1/README.md @@ -128,6 +128,7 @@ the following environment variables: | `KUBE_PS1_NS_ENABLE` | `true` | Display the namespace. If set to `false`, this will also disable `KUBE_PS1_DIVIDER` | | `KUBE_PS1_PREFIX` | `(` | Prompt opening character | | `KUBE_PS1_SYMBOL_ENABLE` | `true ` | Display the prompt Symbol. If set to `false`, this will also disable `KUBE_PS1_SEPARATOR` | +| `KUBE_PS1_SYMBOL_PADDING` | `false` | Adds a space (padding) after the symbol to prevent clobbering prompt characters | | `KUBE_PS1_SYMBOL_DEFAULT` | `⎈ ` | Default prompt symbol. Unicode `\u2388` | | `KUBE_PS1_SYMBOL_USE_IMG` | `false` | ☸️ , Unicode `\u2638` as the prompt symbol | | `KUBE_PS1_SEPARATOR` | | | Separator between symbol and context name | @@ -151,8 +152,10 @@ The default colors are set with the following environment variables: | Variable | Default | Meaning | | :------- | :-----: | ------- | +| `KUBE_PS1_PREFIX_COLOR` | `null` | Set default color of the prompt prefix | | `KUBE_PS1_SYMBOL_COLOR` | `blue` | Set default color of the Kubernetes symbol | | `KUBE_PS1_CTX_COLOR` | `red` | Set default color of the context | +| `KUBE_PS1_SUFFIX_COLOR` | `null` | Set default color of the prompt suffix | | `KUBE_PS1_NS_COLOR` | `cyan` | Set default color of the namespace | | `KUBE_PS1_BG_COLOR` | `null` | Set default color of the prompt background | diff --git a/plugins/kube-ps1/kube-ps1.plugin.zsh b/plugins/kube-ps1/kube-ps1.plugin.zsh index 9e77cbc19..894e0f7f0 100644 --- a/plugins/kube-ps1/kube-ps1.plugin.zsh +++ b/plugins/kube-ps1/kube-ps1.plugin.zsh @@ -1,9 +1,9 @@ -#!/bin/bash +#!/usr/bin/env bash # Kubernetes prompt helper for bash/zsh # Displays current context and namespace -# Copyright 2019 Jon Mosco +# Copyright 2021 Jon Mosco # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -24,7 +24,8 @@ # Override these values in ~/.zshrc or ~/.bashrc KUBE_PS1_BINARY="${KUBE_PS1_BINARY:-kubectl}" KUBE_PS1_SYMBOL_ENABLE="${KUBE_PS1_SYMBOL_ENABLE:-true}" -KUBE_PS1_SYMBOL_DEFAULT=${KUBE_PS1_SYMBOL_DEFAULT:-$'\u2388 '} +KUBE_PS1_SYMBOL_DEFAULT=${KUBE_PS1_SYMBOL_DEFAULT:-$'\u2388'} +KUBE_PS1_SYMBOL_PADDING="${KUBE_PS1_SYMBOL_PADDING:-false}" KUBE_PS1_SYMBOL_USE_IMG="${KUBE_PS1_SYMBOL_USE_IMG:-false}" KUBE_PS1_NS_ENABLE="${KUBE_PS1_NS_ENABLE:-true}" KUBE_PS1_CONTEXT_ENABLE="${KUBE_PS1_CONTEXT_ENABLE:-true}" @@ -32,10 +33,12 @@ KUBE_PS1_PREFIX="${KUBE_PS1_PREFIX-(}" KUBE_PS1_SEPARATOR="${KUBE_PS1_SEPARATOR-|}" KUBE_PS1_DIVIDER="${KUBE_PS1_DIVIDER-:}" KUBE_PS1_SUFFIX="${KUBE_PS1_SUFFIX-)}" + KUBE_PS1_SYMBOL_COLOR="${KUBE_PS1_SYMBOL_COLOR-blue}" KUBE_PS1_CTX_COLOR="${KUBE_PS1_CTX_COLOR-red}" KUBE_PS1_NS_COLOR="${KUBE_PS1_NS_COLOR-cyan}" KUBE_PS1_BG_COLOR="${KUBE_PS1_BG_COLOR}" + KUBE_PS1_KUBECONFIG_CACHE="${KUBECONFIG}" KUBE_PS1_DISABLE_PATH="${HOME}/.kube/kube-ps1/disabled" KUBE_PS1_LAST_TIME=0 @@ -149,18 +152,17 @@ _kube_ps1_symbol() { case "${KUBE_PS1_SHELL}" in bash) - if ((BASH_VERSINFO[0] >= 4)) && [[ $'\u2388 ' != "\\u2388 " ]]; then + if ((BASH_VERSINFO[0] >= 4)) && [[ $'\u2388' != "\\u2388" ]]; then KUBE_PS1_SYMBOL="${KUBE_PS1_SYMBOL_DEFAULT}" - # KUBE_PS1_SYMBOL=$'\u2388 ' - KUBE_PS1_SYMBOL_IMG=$'\u2638 ' + KUBE_PS1_SYMBOL_IMG=$'\u2638\ufe0f' else - KUBE_PS1_SYMBOL=$'\xE2\x8E\x88 ' - KUBE_PS1_SYMBOL_IMG=$'\xE2\x98\xB8 ' + KUBE_PS1_SYMBOL=$'\xE2\x8E\x88' + KUBE_PS1_SYMBOL_IMG=$'\xE2\x98\xB8' fi ;; zsh) KUBE_PS1_SYMBOL="${KUBE_PS1_SYMBOL_DEFAULT}" - KUBE_PS1_SYMBOL_IMG="\u2638 ";; + KUBE_PS1_SYMBOL_IMG="\u2638";; *) KUBE_PS1_SYMBOL="k8s" esac @@ -169,7 +171,12 @@ _kube_ps1_symbol() { KUBE_PS1_SYMBOL="${KUBE_PS1_SYMBOL_IMG}" fi - echo "${KUBE_PS1_SYMBOL}" + if [[ "${KUBE_PS1_SYMBOL_PADDING}" == true ]]; then + echo "${KUBE_PS1_SYMBOL} " + else + echo "${KUBE_PS1_SYMBOL}" + fi + } _kube_ps1_split() { @@ -339,7 +346,11 @@ kube_ps1() { [[ -n "${KUBE_PS1_BG_COLOR}" ]] && KUBE_PS1+="$(_kube_ps1_color_bg ${KUBE_PS1_BG_COLOR})" # Prefix - [[ -n "${KUBE_PS1_PREFIX}" ]] && KUBE_PS1+="${KUBE_PS1_PREFIX}" + if [[ -z "${KUBE_PS1_PREFIX_COLOR:-}" ]] && [[ -n "${KUBE_PS1_PREFIX}" ]]; then + KUBE_PS1+="${KUBE_PS1_PREFIX}" + else + KUBE_PS1+="$(_kube_ps1_color_fg $KUBE_PS1_PREFIX_COLOR)${KUBE_PS1_PREFIX}${KUBE_PS1_RESET_COLOR}" + fi # Symbol KUBE_PS1+="$(_kube_ps1_color_fg $KUBE_PS1_SYMBOL_COLOR)$(_kube_ps1_symbol)${KUBE_PS1_RESET_COLOR}" @@ -362,7 +373,11 @@ kube_ps1() { fi # Suffix - [[ -n "${KUBE_PS1_SUFFIX}" ]] && KUBE_PS1+="${KUBE_PS1_SUFFIX}" + if [[ -z "${KUBE_PS1_SUFFIX_COLOR:-}" ]] && [[ -n "${KUBE_PS1_SUFFIX}" ]]; then + KUBE_PS1+="${KUBE_PS1_SUFFIX}" + else + KUBE_PS1+="$(_kube_ps1_color_fg $KUBE_PS1_SUFFIX_COLOR)${KUBE_PS1_SUFFIX}${KUBE_PS1_RESET_COLOR}" + fi # Close Background color if defined [[ -n "${KUBE_PS1_BG_COLOR}" ]] && KUBE_PS1+="${_KUBE_PS1_OPEN_ESC}${_KUBE_PS1_DEFAULT_BG}${_KUBE_PS1_CLOSE_ESC}" diff --git a/plugins/oc/oc.plugin.zsh b/plugins/oc/oc.plugin.zsh index b968c4bd4..f0e2fc3bc 100644 --- a/plugins/oc/oc.plugin.zsh +++ b/plugins/oc/oc.plugin.zsh @@ -4,4 +4,5 @@ if [ $commands[oc] ]; then source <(oc completion zsh) + compdef _oc oc fi