mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2026-06-03 08:28:26 +00:00
Compare commits
8 Commits
cb64103161
...
copilot/fi
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c95203294b | ||
|
|
7b4ce37547 | ||
|
|
fe11a3ae23 | ||
|
|
87a9b16b72 | ||
|
|
857a646516 | ||
|
|
5ef67beadb | ||
|
|
d633270784 | ||
|
|
43c68566be |
2
.github/dependencies.yml
vendored
2
.github/dependencies.yml
vendored
@@ -30,7 +30,7 @@ dependencies:
|
|||||||
plugins/kube-ps1:
|
plugins/kube-ps1:
|
||||||
repo: jonmosco/kube-ps1
|
repo: jonmosco/kube-ps1
|
||||||
branch: master
|
branch: master
|
||||||
version: 7d575c6d53f60130159a3db28e33d2967201cd64
|
version: 04af46f7fe888ad287abcab6699b9bb10234bc3d
|
||||||
precopy: |
|
precopy: |
|
||||||
set -e
|
set -e
|
||||||
find . ! -name kube-ps1.sh ! -name LICENSE ! -name README.md -delete
|
find . ! -name kube-ps1.sh ! -name LICENSE ! -name README.md -delete
|
||||||
|
|||||||
2
.github/workflows/dependencies.yml
vendored
2
.github/workflows/dependencies.yml
vendored
@@ -16,7 +16,7 @@ jobs:
|
|||||||
contents: write # this is needed to push commits and branches
|
contents: write # this is needed to push commits and branches
|
||||||
steps:
|
steps:
|
||||||
- name: Harden the runner (Audit all outbound calls)
|
- name: Harden the runner (Audit all outbound calls)
|
||||||
uses: step-security/harden-runner@ab7a9404c0f3da075243ca237b5fac12c98deaa5 # v2.19.3
|
uses: step-security/harden-runner@9af89fc71515a100421586dfdb3dc9c984fbf411 # v2.19.4
|
||||||
with:
|
with:
|
||||||
egress-policy: audit
|
egress-policy: audit
|
||||||
|
|
||||||
|
|||||||
4
.github/workflows/installer.yml
vendored
4
.github/workflows/installer.yml
vendored
@@ -26,7 +26,7 @@ jobs:
|
|||||||
- macos-latest
|
- macos-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Harden the runner (Audit all outbound calls)
|
- name: Harden the runner (Audit all outbound calls)
|
||||||
uses: step-security/harden-runner@ab7a9404c0f3da075243ca237b5fac12c98deaa5 # v2.19.3
|
uses: step-security/harden-runner@9af89fc71515a100421586dfdb3dc9c984fbf411 # v2.19.4
|
||||||
with:
|
with:
|
||||||
egress-policy: audit
|
egress-policy: audit
|
||||||
|
|
||||||
@@ -47,7 +47,7 @@ jobs:
|
|||||||
- test
|
- test
|
||||||
steps:
|
steps:
|
||||||
- name: Harden the runner (Audit all outbound calls)
|
- name: Harden the runner (Audit all outbound calls)
|
||||||
uses: step-security/harden-runner@ab7a9404c0f3da075243ca237b5fac12c98deaa5 # v2.19.3
|
uses: step-security/harden-runner@9af89fc71515a100421586dfdb3dc9c984fbf411 # v2.19.4
|
||||||
with:
|
with:
|
||||||
egress-policy: audit
|
egress-policy: audit
|
||||||
|
|
||||||
|
|||||||
2
.github/workflows/main.yml
vendored
2
.github/workflows/main.yml
vendored
@@ -24,7 +24,7 @@ jobs:
|
|||||||
if: github.repository == 'ohmyzsh/ohmyzsh'
|
if: github.repository == 'ohmyzsh/ohmyzsh'
|
||||||
steps:
|
steps:
|
||||||
- name: Harden the runner (Audit all outbound calls)
|
- name: Harden the runner (Audit all outbound calls)
|
||||||
uses: step-security/harden-runner@ab7a9404c0f3da075243ca237b5fac12c98deaa5 # v2.19.3
|
uses: step-security/harden-runner@9af89fc71515a100421586dfdb3dc9c984fbf411 # v2.19.4
|
||||||
with:
|
with:
|
||||||
egress-policy: audit
|
egress-policy: audit
|
||||||
|
|
||||||
|
|||||||
2
.github/workflows/project.yml
vendored
2
.github/workflows/project.yml
vendored
@@ -17,7 +17,7 @@ jobs:
|
|||||||
if: github.repository == 'ohmyzsh/ohmyzsh'
|
if: github.repository == 'ohmyzsh/ohmyzsh'
|
||||||
steps:
|
steps:
|
||||||
- name: Harden the runner (Audit all outbound calls)
|
- name: Harden the runner (Audit all outbound calls)
|
||||||
uses: step-security/harden-runner@ab7a9404c0f3da075243ca237b5fac12c98deaa5 # v2.19.3
|
uses: step-security/harden-runner@9af89fc71515a100421586dfdb3dc9c984fbf411 # v2.19.4
|
||||||
with:
|
with:
|
||||||
egress-policy: audit
|
egress-policy: audit
|
||||||
- name: Authenticate as @ohmyzsh
|
- name: Authenticate as @ohmyzsh
|
||||||
|
|||||||
4
.github/workflows/scorecard.yml
vendored
4
.github/workflows/scorecard.yml
vendored
@@ -36,7 +36,7 @@ jobs:
|
|||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Harden the runner (Audit all outbound calls)
|
- name: Harden the runner (Audit all outbound calls)
|
||||||
uses: step-security/harden-runner@ab7a9404c0f3da075243ca237b5fac12c98deaa5 # v2.19.3
|
uses: step-security/harden-runner@9af89fc71515a100421586dfdb3dc9c984fbf411 # v2.19.4
|
||||||
with:
|
with:
|
||||||
egress-policy: audit
|
egress-policy: audit
|
||||||
|
|
||||||
@@ -60,6 +60,6 @@ jobs:
|
|||||||
retention-days: 5
|
retention-days: 5
|
||||||
|
|
||||||
- name: "Upload to code-scanning"
|
- name: "Upload to code-scanning"
|
||||||
uses: github/codeql-action/upload-sarif@9e0d7b8d25671d64c341c19c0152d693099fb5ba # v4.35.5
|
uses: github/codeql-action/upload-sarif@7211b7c8077ea37d8641b6271f6a365a22a5fbfa # v4.36.0
|
||||||
with:
|
with:
|
||||||
sarif_file: results.sarif
|
sarif_file: results.sarif
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
alias-finder() {
|
alias-finder() {
|
||||||
local cmd=" " exact="" longer="" cheaper="" wordEnd="'{0,1}$" finder="" filter=""
|
local cmd=" " exact="" longer="" cheaper="" wordEnd="'?$" finder="" filter=""
|
||||||
|
|
||||||
# build command and options
|
# build command and options
|
||||||
for c in "$@"; do
|
for c in "$@"; do
|
||||||
@@ -31,7 +31,7 @@ alias-finder() {
|
|||||||
|
|
||||||
# find with alias and grep, removing last word each time until no more words
|
# find with alias and grep, removing last word each time until no more words
|
||||||
while [[ $cmd != "" ]]; do
|
while [[ $cmd != "" ]]; do
|
||||||
finder="'{0,1}$cmd$wordEnd"
|
finder="'?$cmd$wordEnd"
|
||||||
|
|
||||||
# make filter to find only shorter results than current cmd
|
# make filter to find only shorter results than current cmd
|
||||||
if [[ $cheaper == true ]]; then
|
if [[ $cheaper == true ]]; then
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ of `dnf5` and uses it as drop-in alternative to the slower `dnf`.
|
|||||||
| Alias | Command | Description |
|
| Alias | Command | Description |
|
||||||
|-------|-------------------------|--------------------------|
|
|-------|-------------------------|--------------------------|
|
||||||
| dnfl | `dnf list` | List packages |
|
| dnfl | `dnf list` | List packages |
|
||||||
| dnfli | `dnf list installed` | List installed packages |
|
| dnfli | `dnf list --installed` | List installed packages |
|
||||||
| dnfgl | `dnf grouplist` | List package groups |
|
| dnfgl | `dnf grouplist` | List package groups |
|
||||||
| dnfmc | `dnf makecache` | Generate metadata cache |
|
| dnfmc | `dnf makecache` | Generate metadata cache |
|
||||||
| dnfp | `dnf info` | Show package information |
|
| dnfp | `dnf info` | Show package information |
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ local dnfprog="dnf"
|
|||||||
command -v dnf5 > /dev/null && dnfprog=dnf5
|
command -v dnf5 > /dev/null && dnfprog=dnf5
|
||||||
|
|
||||||
alias dnfl="${dnfprog} list" # List packages
|
alias dnfl="${dnfprog} list" # List packages
|
||||||
alias dnfli="${dnfprog} list installed" # List installed packages
|
alias dnfli="${dnfprog} list --installed" # List installed packages
|
||||||
alias dnfmc="${dnfprog} makecache" # Generate metadata cache
|
alias dnfmc="${dnfprog} makecache" # Generate metadata cache
|
||||||
alias dnfp="${dnfprog} info" # Show package information
|
alias dnfp="${dnfprog} info" # Show package information
|
||||||
alias dnfs="${dnfprog} search" # Search package
|
alias dnfs="${dnfprog} search" # Search package
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ _kube_ps1_shell_type() {
|
|||||||
elif [ "${BASH_VERSION-}" ]; then
|
elif [ "${BASH_VERSION-}" ]; then
|
||||||
_KUBE_PS1_SHELL_TYPE="bash"
|
_KUBE_PS1_SHELL_TYPE="bash"
|
||||||
fi
|
fi
|
||||||
echo $_KUBE_PS1_SHELL_TYPE
|
echo "$_KUBE_PS1_SHELL_TYPE"
|
||||||
}
|
}
|
||||||
|
|
||||||
_kube_ps1_init() {
|
_kube_ps1_init() {
|
||||||
@@ -65,6 +65,15 @@ _kube_ps1_init() {
|
|||||||
_KUBE_PS1_TPUT_AVAILABLE=false
|
_KUBE_PS1_TPUT_AVAILABLE=false
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Detect stat type once (not needed for zsh which uses zstat builtin)
|
||||||
|
if [[ "${_KUBE_PS1_SHELL}" != "zsh" ]]; then
|
||||||
|
if stat -c "%s" /dev/null &> /dev/null; then
|
||||||
|
_KUBE_PS1_STAT_TYPE="gnu"
|
||||||
|
else
|
||||||
|
_KUBE_PS1_STAT_TYPE="bsd"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
case "${_KUBE_PS1_SHELL}" in
|
case "${_KUBE_PS1_SHELL}" in
|
||||||
"zsh")
|
"zsh")
|
||||||
_KUBE_PS1_OPEN_ESC="%{"
|
_KUBE_PS1_OPEN_ESC="%{"
|
||||||
@@ -98,8 +107,8 @@ _kube_ps1_color_fg() {
|
|||||||
magenta) _KUBE_PS1_FG_CODE=5;;
|
magenta) _KUBE_PS1_FG_CODE=5;;
|
||||||
cyan) _KUBE_PS1_FG_CODE=6;;
|
cyan) _KUBE_PS1_FG_CODE=6;;
|
||||||
white) _KUBE_PS1_FG_CODE=7;;
|
white) _KUBE_PS1_FG_CODE=7;;
|
||||||
# 256
|
# 256 colors
|
||||||
[0-9]|[1-9][0-9]|[1][0-9][0-9]|[2][0-4][0-9]|[2][5][0-6]) _KUBE_PS1_FG_CODE="${1}";;
|
[0-9]|[1-9][0-9]|[1][0-9][0-9]|[2][0-4][0-9]|[2][5][0-5]) _KUBE_PS1_FG_CODE="${1}";;
|
||||||
*) _KUBE_PS1_FG_CODE=default
|
*) _KUBE_PS1_FG_CODE=default
|
||||||
esac
|
esac
|
||||||
|
|
||||||
@@ -111,7 +120,7 @@ _kube_ps1_color_fg() {
|
|||||||
elif [[ "${_KUBE_PS1_SHELL}" == "bash" ]]; then
|
elif [[ "${_KUBE_PS1_SHELL}" == "bash" ]]; then
|
||||||
if [[ "${_KUBE_PS1_TPUT_AVAILABLE}" == "true" ]]; then
|
if [[ "${_KUBE_PS1_TPUT_AVAILABLE}" == "true" ]]; then
|
||||||
_KUBE_PS1_FG_CODE="$(tput setaf "${_KUBE_PS1_FG_CODE}")"
|
_KUBE_PS1_FG_CODE="$(tput setaf "${_KUBE_PS1_FG_CODE}")"
|
||||||
elif [[ $_KUBE_PS1_FG_CODE -ge 0 ]] && [[ $_KUBE_PS1_FG_CODE -le 256 ]]; then
|
elif [[ $_KUBE_PS1_FG_CODE -ge 0 ]] && [[ $_KUBE_PS1_FG_CODE -le 255 ]]; then
|
||||||
_KUBE_PS1_FG_CODE="\033[38;5;${_KUBE_PS1_FG_CODE}m"
|
_KUBE_PS1_FG_CODE="\033[38;5;${_KUBE_PS1_FG_CODE}m"
|
||||||
else
|
else
|
||||||
_KUBE_PS1_FG_CODE="${_KUBE_PS1_DEFAULT_FG}"
|
_KUBE_PS1_FG_CODE="${_KUBE_PS1_DEFAULT_FG}"
|
||||||
@@ -131,20 +140,20 @@ _kube_ps1_color_bg() {
|
|||||||
magenta) _KUBE_PS1_BG_CODE=5;;
|
magenta) _KUBE_PS1_BG_CODE=5;;
|
||||||
cyan) _KUBE_PS1_BG_CODE=6;;
|
cyan) _KUBE_PS1_BG_CODE=6;;
|
||||||
white) _KUBE_PS1_BG_CODE=7;;
|
white) _KUBE_PS1_BG_CODE=7;;
|
||||||
# 256
|
# 256 colors
|
||||||
[0-9]|[1-9][0-9]|[1][0-9][0-9]|[2][0-4][0-9]|[2][5][0-6]) _KUBE_PS1_BG_CODE="${1}";;
|
[0-9]|[1-9][0-9]|[1][0-9][0-9]|[2][0-4][0-9]|[2][5][0-5]) _KUBE_PS1_BG_CODE="${1}";;
|
||||||
*) _KUBE_PS1_BG_CODE=$'\033[0m';;
|
*) _KUBE_PS1_BG_CODE=default
|
||||||
esac
|
esac
|
||||||
|
|
||||||
if [[ "${_KUBE_PS1_BG_CODE}" == "default" ]]; then
|
if [[ "${_KUBE_PS1_BG_CODE}" == "default" ]]; then
|
||||||
_KUBE_PS1_FG_CODE="${_KUBE_PS1_DEFAULT_BG}"
|
_KUBE_PS1_BG_CODE="${_KUBE_PS1_DEFAULT_BG}"
|
||||||
return
|
return
|
||||||
elif [[ "${_KUBE_PS1_SHELL}" == "zsh" ]]; then
|
elif [[ "${_KUBE_PS1_SHELL}" == "zsh" ]]; then
|
||||||
_KUBE_PS1_BG_CODE="%K{$_KUBE_PS1_BG_CODE}"
|
_KUBE_PS1_BG_CODE="%K{$_KUBE_PS1_BG_CODE}"
|
||||||
elif [[ "${_KUBE_PS1_SHELL}" == "bash" ]]; then
|
elif [[ "${_KUBE_PS1_SHELL}" == "bash" ]]; then
|
||||||
if [[ "${_KUBE_PS1_TPUT_AVAILABLE}" == "true" ]]; then
|
if [[ "${_KUBE_PS1_TPUT_AVAILABLE}" == "true" ]]; then
|
||||||
_KUBE_PS1_BG_CODE="$(tput setab "${_KUBE_PS1_BG_CODE}")"
|
_KUBE_PS1_BG_CODE="$(tput setab "${_KUBE_PS1_BG_CODE}")"
|
||||||
elif [[ $_KUBE_PS1_BG_CODE -ge 0 ]] && [[ $_KUBE_PS1_BG_CODE -le 256 ]]; then
|
elif [[ $_KUBE_PS1_BG_CODE -ge 0 ]] && [[ $_KUBE_PS1_BG_CODE -le 255 ]]; then
|
||||||
_KUBE_PS1_BG_CODE="\033[48;5;${_KUBE_PS1_BG_CODE}m"
|
_KUBE_PS1_BG_CODE="\033[48;5;${_KUBE_PS1_BG_CODE}m"
|
||||||
else
|
else
|
||||||
_KUBE_PS1_BG_CODE="${_KUBE_PS1_DEFAULT_BG}"
|
_KUBE_PS1_BG_CODE="${_KUBE_PS1_DEFAULT_BG}"
|
||||||
@@ -154,7 +163,7 @@ _kube_ps1_color_bg() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
_kube_ps1_binary_check() {
|
_kube_ps1_binary_check() {
|
||||||
command -v $1 >/dev/null
|
command -v "$1" >/dev/null
|
||||||
}
|
}
|
||||||
|
|
||||||
_kube_ps1_symbol() {
|
_kube_ps1_symbol() {
|
||||||
@@ -171,6 +180,7 @@ _kube_ps1_symbol() {
|
|||||||
local oc_glyph=$'\ue7b7'
|
local oc_glyph=$'\ue7b7'
|
||||||
local oc_symbol_color=red
|
local oc_symbol_color=red
|
||||||
local custom_symbol_color="${KUBE_PS1_SYMBOL_COLOR:-$k8s_symbol_color}"
|
local custom_symbol_color="${KUBE_PS1_SYMBOL_COLOR:-$k8s_symbol_color}"
|
||||||
|
local KUBE_PS1_RESET_COLOR="${_KUBE_PS1_OPEN_ESC}${_KUBE_PS1_DEFAULT_FG}${_KUBE_PS1_CLOSE_ESC}"
|
||||||
|
|
||||||
# Choose the symbol based on the provided argument or environment variable
|
# Choose the symbol based on the provided argument or environment variable
|
||||||
case "${symbol_arg}" in
|
case "${symbol_arg}" in
|
||||||
@@ -225,15 +235,27 @@ _kube_ps1_file_newer_than() {
|
|||||||
if [[ "${_KUBE_PS1_SHELL}" == "zsh" ]]; then
|
if [[ "${_KUBE_PS1_SHELL}" == "zsh" ]]; then
|
||||||
# Use zstat '-F %s.%s' to make it compatible with low zsh version (eg: 5.0.2)
|
# Use zstat '-F %s.%s' to make it compatible with low zsh version (eg: 5.0.2)
|
||||||
mtime=$(zstat -L +mtime -F %s.%s "${file}")
|
mtime=$(zstat -L +mtime -F %s.%s "${file}")
|
||||||
elif stat -c "%s" /dev/null &> /dev/null; then
|
elif [[ "${_KUBE_PS1_STAT_TYPE}" == "gnu" ]]; then
|
||||||
# GNU stat
|
|
||||||
mtime=$(stat -L -c %Y "${file}")
|
mtime=$(stat -L -c %Y "${file}")
|
||||||
else
|
else
|
||||||
# BSD stat
|
|
||||||
mtime=$(stat -L -f %m "$file")
|
mtime=$(stat -L -f %m "$file")
|
||||||
fi
|
fi
|
||||||
|
|
||||||
[[ "${mtime}" -gt "${check_time}" ]]
|
[[ "${mtime}" -gt "${check_time}" ]] && return 0
|
||||||
|
|
||||||
|
# If the path is a symlink, also check the symlink's own mtime
|
||||||
|
if [[ -L "${file}" ]]; then
|
||||||
|
if [[ "${_KUBE_PS1_SHELL}" == "zsh" ]]; then
|
||||||
|
mtime=$(zstat +mtime -F %s.%s "${file}")
|
||||||
|
elif [[ "${_KUBE_PS1_STAT_TYPE}" == "gnu" ]]; then
|
||||||
|
mtime=$(stat -c %Y "${file}")
|
||||||
|
else
|
||||||
|
mtime=$(stat -f %m "$file")
|
||||||
|
fi
|
||||||
|
[[ "${mtime}" -gt "${check_time}" ]] && return 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
return 1
|
||||||
}
|
}
|
||||||
|
|
||||||
_kube_ps1_prompt_update() {
|
_kube_ps1_prompt_update() {
|
||||||
@@ -280,7 +302,6 @@ _kube_ps1_prompt_update() {
|
|||||||
_kube_ps1_get_context() {
|
_kube_ps1_get_context() {
|
||||||
if [[ "${KUBE_PS1_CONTEXT_ENABLE}" == true ]]; then
|
if [[ "${KUBE_PS1_CONTEXT_ENABLE}" == true ]]; then
|
||||||
KUBE_PS1_CONTEXT="$(${KUBE_PS1_BINARY} config current-context 2>/dev/null)"
|
KUBE_PS1_CONTEXT="$(${KUBE_PS1_BINARY} config current-context 2>/dev/null)"
|
||||||
# Set namespace to 'N/A' if it is not defined
|
|
||||||
KUBE_PS1_CONTEXT="${KUBE_PS1_CONTEXT:-N/A}"
|
KUBE_PS1_CONTEXT="${KUBE_PS1_CONTEXT:-N/A}"
|
||||||
|
|
||||||
if [[ -n "${KUBE_PS1_CLUSTER_FUNCTION}" ]]; then
|
if [[ -n "${KUBE_PS1_CLUSTER_FUNCTION}" ]]; then
|
||||||
@@ -303,7 +324,7 @@ _kube_ps1_get_ns() {
|
|||||||
_kube_ps1_get_context_ns() {
|
_kube_ps1_get_context_ns() {
|
||||||
# Set the command time
|
# Set the command time
|
||||||
if [[ "${_KUBE_PS1_SHELL}" == "bash" ]]; then
|
if [[ "${_KUBE_PS1_SHELL}" == "bash" ]]; then
|
||||||
if ((BASH_VERSINFO[0] >= 4 && BASH_VERSINFO[1] >= 2)); then
|
if ((BASH_VERSINFO[0] > 4 || (BASH_VERSINFO[0] == 4 && BASH_VERSINFO[1] >= 2))); then
|
||||||
_KUBE_PS1_LAST_TIME=$(printf '%(%s)T')
|
_KUBE_PS1_LAST_TIME=$(printf '%(%s)T')
|
||||||
else
|
else
|
||||||
_KUBE_PS1_LAST_TIME=$(date +%s)
|
_KUBE_PS1_LAST_TIME=$(date +%s)
|
||||||
@@ -312,9 +333,6 @@ _kube_ps1_get_context_ns() {
|
|||||||
_KUBE_PS1_LAST_TIME=$EPOCHREALTIME
|
_KUBE_PS1_LAST_TIME=$EPOCHREALTIME
|
||||||
fi
|
fi
|
||||||
|
|
||||||
KUBE_PS1_CONTEXT="${KUBE_PS1_CONTEXT:-N/A}"
|
|
||||||
KUBE_PS1_NAMESPACE="${KUBE_PS1_NAMESPACE:-N/A}"
|
|
||||||
|
|
||||||
# Cache which cfgfiles we can read in case they change.
|
# Cache which cfgfiles we can read in case they change.
|
||||||
local conf
|
local conf
|
||||||
_KUBE_PS1_CFGFILES_READ_CACHE=
|
_KUBE_PS1_CFGFILES_READ_CACHE=
|
||||||
@@ -358,12 +376,13 @@ EOF
|
|||||||
kubeon() {
|
kubeon() {
|
||||||
if [[ "${1}" == '-h' || "${1}" == '--help' ]]; then
|
if [[ "${1}" == '-h' || "${1}" == '--help' ]]; then
|
||||||
_kubeon_usage
|
_kubeon_usage
|
||||||
|
return 0
|
||||||
elif [[ "${1}" == '-g' || "${1}" == '--global' ]]; then
|
elif [[ "${1}" == '-g' || "${1}" == '--global' ]]; then
|
||||||
rm -f -- "${_KUBE_PS1_DISABLE_PATH}"
|
rm -f -- "${_KUBE_PS1_DISABLE_PATH}"
|
||||||
elif [[ "$#" -ne 0 ]]; then
|
elif [[ "$#" -ne 0 ]]; then
|
||||||
echo -e "error: unrecognized flag ${1}\\n"
|
echo -e "error: unrecognized flag ${1}\\n" >&2
|
||||||
_kubeon_usage
|
_kubeon_usage
|
||||||
return
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
KUBE_PS1_ENABLED=on
|
KUBE_PS1_ENABLED=on
|
||||||
@@ -372,13 +391,14 @@ kubeon() {
|
|||||||
kubeoff() {
|
kubeoff() {
|
||||||
if [[ "${1}" == '-h' || "${1}" == '--help' ]]; then
|
if [[ "${1}" == '-h' || "${1}" == '--help' ]]; then
|
||||||
_kubeoff_usage
|
_kubeoff_usage
|
||||||
|
return 0
|
||||||
elif [[ "${1}" == '-g' || "${1}" == '--global' ]]; then
|
elif [[ "${1}" == '-g' || "${1}" == '--global' ]]; then
|
||||||
mkdir -p -- "$(dirname "${_KUBE_PS1_DISABLE_PATH}")"
|
mkdir -p -- "$(dirname "${_KUBE_PS1_DISABLE_PATH}")"
|
||||||
touch -- "${_KUBE_PS1_DISABLE_PATH}"
|
touch -- "${_KUBE_PS1_DISABLE_PATH}"
|
||||||
elif [[ $# -ne 0 ]]; then
|
elif [[ $# -ne 0 ]]; then
|
||||||
echo "error: unrecognized flag ${1}" >&2
|
echo -e "error: unrecognized flag ${1}\\n" >&2
|
||||||
_kubeoff_usage
|
_kubeoff_usage
|
||||||
return
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
KUBE_PS1_ENABLED=off
|
KUBE_PS1_ENABLED=off
|
||||||
@@ -390,15 +410,9 @@ kube_ps1() {
|
|||||||
[[ -z "${KUBE_PS1_CONTEXT}" ]] && [[ "${KUBE_PS1_CONTEXT_ENABLE}" == true ]] && return
|
[[ -z "${KUBE_PS1_CONTEXT}" ]] && [[ "${KUBE_PS1_CONTEXT_ENABLE}" == true ]] && return
|
||||||
[[ "${KUBE_PS1_CONTEXT}" == "N/A" ]] && [[ ${KUBE_PS1_HIDE_IF_NOCONTEXT} == true ]] && return
|
[[ "${KUBE_PS1_CONTEXT}" == "N/A" ]] && [[ ${KUBE_PS1_HIDE_IF_NOCONTEXT} == true ]] && return
|
||||||
|
|
||||||
|
|
||||||
local KUBE_PS1
|
local KUBE_PS1
|
||||||
local KUBE_PS1_RESET_COLOR="${_KUBE_PS1_OPEN_ESC}${_KUBE_PS1_DEFAULT_FG}${_KUBE_PS1_CLOSE_ESC}"
|
local KUBE_PS1_RESET_COLOR="${_KUBE_PS1_OPEN_ESC}${_KUBE_PS1_DEFAULT_FG}${_KUBE_PS1_CLOSE_ESC}"
|
||||||
|
|
||||||
# If background color is set, reset color should also reset the background
|
|
||||||
# if [[ -n "${KUBE_PS1_BG_COLOR}" ]]; then
|
|
||||||
# KUBE_PS1_RESET_COLOR="${_KUBE_PS1_OPEN_ESC}${_KUBE_PS1_DEFAULT_FG}${_KUBE_PS1_DEFAULT_BG}${_KUBE_PS1_CLOSE_ESC}"
|
|
||||||
# fi
|
|
||||||
|
|
||||||
# Background Color
|
# Background Color
|
||||||
[[ -n "${KUBE_PS1_BG_COLOR}" ]] && KUBE_PS1+="$(_kube_ps1_color_bg "${KUBE_PS1_BG_COLOR}")"
|
[[ -n "${KUBE_PS1_BG_COLOR}" ]] && KUBE_PS1+="$(_kube_ps1_color_bg "${KUBE_PS1_BG_COLOR}")"
|
||||||
|
|
||||||
|
|||||||
@@ -60,7 +60,14 @@ ZSH_THEME_GIT_PROMPT_UNMERGED="%{$fg[yellow]%} %{%G═%}"
|
|||||||
ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$fg[cyan]%} %{%G✭%}"
|
ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$fg[cyan]%} %{%G✭%}"
|
||||||
|
|
||||||
# Use extended characters to look nicer if supported.
|
# Use extended characters to look nicer if supported.
|
||||||
if [[ "${langinfo[CODESET]}" = UTF-8 ]]; then
|
if [[ "${TERM_PROGRAM:-}" = ghostty ]]; then
|
||||||
|
PR_SET_CHARSET=""
|
||||||
|
PR_HBAR="-"
|
||||||
|
PR_ULCORNER="-"
|
||||||
|
PR_LLCORNER="-"
|
||||||
|
PR_LRCORNER="-"
|
||||||
|
PR_URCORNER="-"
|
||||||
|
elif [[ "${langinfo[CODESET]}" = UTF-8 ]]; then
|
||||||
PR_SET_CHARSET=""
|
PR_SET_CHARSET=""
|
||||||
PR_HBAR="─"
|
PR_HBAR="─"
|
||||||
PR_ULCORNER="┌"
|
PR_ULCORNER="┌"
|
||||||
|
|||||||
Reference in New Issue
Block a user