mirror of
https://github.com/robbyrussell/oh-my-zsh.git
synced 2026-07-11 23:46:44 +02:00
Compare commits
22 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| c95203294b | |||
| 7b4ce37547 | |||
| fe11a3ae23 | |||
| 87a9b16b72 | |||
| 857a646516 | |||
| 5ef67beadb | |||
| d633270784 | |||
| 43c68566be | |||
| cb64103161 | |||
| 0eecd2821e | |||
| 2a5313a9d0 | |||
| 24959d5817 | |||
| efd6135bf5 | |||
| c68e752b1b | |||
| 8d0ff417c3 | |||
| 80a6f169c7 | |||
| c4e39ad56b | |||
| 7478f1fd22 | |||
| a07126330b | |||
| 1381fec0bf | |||
| 3604dc23e0 | |||
| 8ab16fa493 |
@@ -30,7 +30,7 @@ dependencies:
|
||||
plugins/kube-ps1:
|
||||
repo: jonmosco/kube-ps1
|
||||
branch: master
|
||||
version: e19c9ee867c5655814c384a6bf543e330e6ef1b7
|
||||
version: 04af46f7fe888ad287abcab6699b9bb10234bc3d
|
||||
precopy: |
|
||||
set -e
|
||||
find . ! -name kube-ps1.sh ! -name LICENSE ! -name README.md -delete
|
||||
|
||||
@@ -16,7 +16,7 @@ jobs:
|
||||
contents: write # this is needed to push commits and branches
|
||||
steps:
|
||||
- name: Harden the runner (Audit all outbound calls)
|
||||
uses: step-security/harden-runner@a5ad31d6a139d249332a2605b85202e8c0b78450 # v2.19.1
|
||||
uses: step-security/harden-runner@9af89fc71515a100421586dfdb3dc9c984fbf411 # v2.19.4
|
||||
with:
|
||||
egress-policy: audit
|
||||
|
||||
@@ -26,7 +26,7 @@ jobs:
|
||||
fetch-depth: 0
|
||||
- name: Authenticate as @ohmyzsh
|
||||
id: generate-token
|
||||
uses: actions/create-github-app-token@1b10c78c7865c340bc4f6099eb2f838309f1e8c3 # v3.1.1
|
||||
uses: actions/create-github-app-token@bcd2ba49218906704ab6c1aa796996da409d3eb1 # v3.2.0
|
||||
with:
|
||||
client-id: ${{ secrets.OHMYZSH_CLIENT_ID }}
|
||||
private-key: ${{ secrets.OHMYZSH_APP_PRIVATE_KEY }}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
certifi==2026.4.22
|
||||
charset-normalizer==3.4.7
|
||||
idna==3.13
|
||||
idna==3.15
|
||||
PyYAML==6.0.3
|
||||
requests==2.33.1
|
||||
requests==2.34.2
|
||||
semver==3.0.4
|
||||
urllib3==2.6.3
|
||||
urllib3==2.7.0
|
||||
|
||||
@@ -26,7 +26,7 @@ jobs:
|
||||
- macos-latest
|
||||
steps:
|
||||
- name: Harden the runner (Audit all outbound calls)
|
||||
uses: step-security/harden-runner@a5ad31d6a139d249332a2605b85202e8c0b78450 # v2.19.1
|
||||
uses: step-security/harden-runner@9af89fc71515a100421586dfdb3dc9c984fbf411 # v2.19.4
|
||||
with:
|
||||
egress-policy: audit
|
||||
|
||||
@@ -47,7 +47,7 @@ jobs:
|
||||
- test
|
||||
steps:
|
||||
- name: Harden the runner (Audit all outbound calls)
|
||||
uses: step-security/harden-runner@a5ad31d6a139d249332a2605b85202e8c0b78450 # v2.19.1
|
||||
uses: step-security/harden-runner@9af89fc71515a100421586dfdb3dc9c984fbf411 # v2.19.4
|
||||
with:
|
||||
egress-policy: audit
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ jobs:
|
||||
if: github.repository == 'ohmyzsh/ohmyzsh'
|
||||
steps:
|
||||
- name: Harden the runner (Audit all outbound calls)
|
||||
uses: step-security/harden-runner@a5ad31d6a139d249332a2605b85202e8c0b78450 # v2.19.1
|
||||
uses: step-security/harden-runner@9af89fc71515a100421586dfdb3dc9c984fbf411 # v2.19.4
|
||||
with:
|
||||
egress-policy: audit
|
||||
|
||||
|
||||
@@ -17,12 +17,12 @@ jobs:
|
||||
if: github.repository == 'ohmyzsh/ohmyzsh'
|
||||
steps:
|
||||
- name: Harden the runner (Audit all outbound calls)
|
||||
uses: step-security/harden-runner@a5ad31d6a139d249332a2605b85202e8c0b78450 # v2.19.1
|
||||
uses: step-security/harden-runner@9af89fc71515a100421586dfdb3dc9c984fbf411 # v2.19.4
|
||||
with:
|
||||
egress-policy: audit
|
||||
- name: Authenticate as @ohmyzsh
|
||||
id: generate-token
|
||||
uses: actions/create-github-app-token@1b10c78c7865c340bc4f6099eb2f838309f1e8c3 # v3.1.1
|
||||
uses: actions/create-github-app-token@bcd2ba49218906704ab6c1aa796996da409d3eb1 # v3.2.0
|
||||
with:
|
||||
client-id: ${{ secrets.OHMYZSH_CLIENT_ID }}
|
||||
private-key: ${{ secrets.OHMYZSH_APP_PRIVATE_KEY }}
|
||||
|
||||
@@ -36,7 +36,7 @@ jobs:
|
||||
|
||||
steps:
|
||||
- name: Harden the runner (Audit all outbound calls)
|
||||
uses: step-security/harden-runner@a5ad31d6a139d249332a2605b85202e8c0b78450 # v2.19.1
|
||||
uses: step-security/harden-runner@9af89fc71515a100421586dfdb3dc9c984fbf411 # v2.19.4
|
||||
with:
|
||||
egress-policy: audit
|
||||
|
||||
@@ -60,6 +60,6 @@ jobs:
|
||||
retention-days: 5
|
||||
|
||||
- name: "Upload to code-scanning"
|
||||
uses: github/codeql-action/upload-sarif@e46ed2cbd01164d986452f91f178727624ae40d7 # v4.35.3
|
||||
uses: github/codeql-action/upload-sarif@7211b7c8077ea37d8641b6271f6a365a22a5fbfa # v4.36.0
|
||||
with:
|
||||
sarif_file: results.sarif
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
alias-finder() {
|
||||
local cmd=" " exact="" longer="" cheaper="" wordEnd="'{0,1}$" finder="" filter=""
|
||||
local cmd=" " exact="" longer="" cheaper="" wordEnd="'?$" finder="" filter=""
|
||||
|
||||
# build command and options
|
||||
for c in "$@"; do
|
||||
@@ -31,7 +31,7 @@ alias-finder() {
|
||||
|
||||
# find with alias and grep, removing last word each time until no more words
|
||||
while [[ $cmd != "" ]]; do
|
||||
finder="'{0,1}$cmd$wordEnd"
|
||||
finder="'?$cmd$wordEnd"
|
||||
|
||||
# make filter to find only shorter results than current cmd
|
||||
if [[ $cheaper == true ]]; then
|
||||
|
||||
@@ -6,7 +6,9 @@ import argparse
|
||||
|
||||
def parse(line):
|
||||
left = line[0:line.find('=')].strip()
|
||||
right = line[line.find('=')+1:].strip('\'"\n ')
|
||||
right = line[line.find('=')+1:].strip('\n ')
|
||||
if len(right) >= 2 and right[0] == right[-1] and right[0] in '\'"':
|
||||
right = right[1:-1]
|
||||
try:
|
||||
cmd = next(part for part in right.split() if len([char for char in '=<>' if char in part])==0)
|
||||
except StopIteration:
|
||||
|
||||
@@ -40,7 +40,7 @@ the `brew` binary before sourcing `oh-my-zsh.sh` and it'll set up the environmen
|
||||
| `bo` | `brew outdated` | List installed formulae that have an updated version available. |
|
||||
| `br` | `brew reinstall` | Reinstall a formula. |
|
||||
| `brewp` | `brew pin` | Pin a specified formula so that it's not upgraded. |
|
||||
| `brews` | `brew list -1` | List installed formulae or the installed files for a given formula. |
|
||||
| `brews` | _function_ | List installed leaf formulae with their dependencies, then casks. |
|
||||
| `brewsp` | `brew list --pinned` | List pinned formulae, or show the version of a given formula. |
|
||||
| `brh` | `brew reinstall --HEAD` | Reinstall a formula with --HEAD |
|
||||
| `bs` | `brew search` | Perform a substring search of cask tokens and formula names for text. |
|
||||
|
||||
@@ -18,7 +18,7 @@ of `dnf5` and uses it as drop-in alternative to the slower `dnf`.
|
||||
| Alias | Command | Description |
|
||||
|-------|-------------------------|--------------------------|
|
||||
| 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 |
|
||||
| dnfmc | `dnf makecache` | Generate metadata cache |
|
||||
| dnfp | `dnf info` | Show package information |
|
||||
|
||||
@@ -5,7 +5,7 @@ local dnfprog="dnf"
|
||||
command -v dnf5 > /dev/null && dnfprog=dnf5
|
||||
|
||||
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 dnfp="${dnfprog} info" # Show package information
|
||||
alias dnfs="${dnfprog} search" # Search package
|
||||
|
||||
@@ -181,6 +181,8 @@ plugins=(... git)
|
||||
| `grst` | `git restore --staged` |
|
||||
| `gunwip` | `git rev-list --max-count=1 --format="%s" HEAD \| grep -q "--wip--" && git reset HEAD~1` |
|
||||
| `grev` | `git revert` |
|
||||
| `greva` | `git revert --abort` |
|
||||
| `grevc` | `git revert --continue` |
|
||||
| `grm` | `git rm` |
|
||||
| `grmc` | `git rm --cached` |
|
||||
| `gcount` | `git shortlog --summary -n` |
|
||||
@@ -215,6 +217,7 @@ plugins=(... git)
|
||||
| `gunignore` | `git update-index --no-assume-unchanged` |
|
||||
| `gwch` | `git log --patch --abbrev-commit --pretty=medium --raw` |
|
||||
| `gwt` | `git worktree` |
|
||||
| `gwta` | `git worktree add` |
|
||||
| `gwtls` | `git worktree list` |
|
||||
| `gwtmv` | `git worktree move` |
|
||||
| `gwtrm` | `git worktree remove` |
|
||||
|
||||
@@ -14,6 +14,7 @@ plugins=(... jj)
|
||||
| ------ | ----------------------------- |
|
||||
| jja | `jj abandon` |
|
||||
| jjb | `jj bookmark` |
|
||||
| jjba | `jj bookmark advance` |
|
||||
| jjbc | `jj bookmark create` |
|
||||
| jjbd | `jj bookmark delete` |
|
||||
| jjbf | `jj bookmark forget` |
|
||||
|
||||
@@ -36,6 +36,7 @@ function jj_prompt_template() {
|
||||
# Aliases (sorted alphabetically)
|
||||
alias jja='jj abandon'
|
||||
alias jjb='jj bookmark'
|
||||
alias jjba='jj bookmark advance'
|
||||
alias jjbc='jj bookmark create'
|
||||
alias jjbd='jj bookmark delete'
|
||||
alias jjbf='jj bookmark forget'
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
# kube-ps1: Kubernetes prompt for bash and zsh
|
||||
# kube-ps1: Kubernetes prompt for bash, zsh, and fish
|
||||
|
||||

|
||||
[](https://github.com/jonmosco/kube-ps1/actions/workflows/ci.yml)
|
||||
|
||||
A script that lets you add the current Kubernetes context and namespace
|
||||
configured on `kubectl` to your Bash/Zsh prompt strings (i.e. the `$PS1`).
|
||||
A script that lets you add the current Kubernetes context and namespace configured on `kubectl` to your Bash, Zsh, or Fish prompt.
|
||||
|
||||
Inspired by several tools used to simplify usage of `kubectl`.
|
||||
|
||||
@@ -77,6 +76,21 @@ source /path/to/kube-ps1.sh
|
||||
PS1='[\u@\h \W $(kube_ps1)]\$ '
|
||||
```
|
||||
|
||||
#### Fish
|
||||
|
||||
Add this to `~/.config/fish/config.fish`:
|
||||
|
||||
```fish
|
||||
source /path/to/kube-ps1.fish
|
||||
|
||||
function fish_prompt
|
||||
echo -n (kube_ps1) ' '
|
||||
# your existing prompt here
|
||||
end
|
||||
```
|
||||
|
||||
> Note: Fish users should source `kube-ps1.fish` instead of `kube-ps1.sh`.
|
||||
|
||||
## Requirements
|
||||
|
||||
The default prompt assumes you have the `kubectl` command line utility installed.
|
||||
@@ -184,8 +198,7 @@ If the font is not properly installed, and the glyph is not available, it will d
|
||||
|
||||
## Customization
|
||||
|
||||
The default settings can be overridden in `~/.bashrc` or `~/.zshrc` by setting
|
||||
the following variables:
|
||||
The default settings can be overridden in `~/.bashrc`, `~/.zshrc`, or `~/.config/fish/config.fish` by setting the following variables:
|
||||
|
||||
| Variable | Default | Meaning |
|
||||
| :------- | :-----: | ------- |
|
||||
|
||||
@@ -49,7 +49,7 @@ _kube_ps1_shell_type() {
|
||||
elif [ "${BASH_VERSION-}" ]; then
|
||||
_KUBE_PS1_SHELL_TYPE="bash"
|
||||
fi
|
||||
echo $_KUBE_PS1_SHELL_TYPE
|
||||
echo "$_KUBE_PS1_SHELL_TYPE"
|
||||
}
|
||||
|
||||
_kube_ps1_init() {
|
||||
@@ -65,6 +65,15 @@ _kube_ps1_init() {
|
||||
_KUBE_PS1_TPUT_AVAILABLE=false
|
||||
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
|
||||
"zsh")
|
||||
_KUBE_PS1_OPEN_ESC="%{"
|
||||
@@ -98,8 +107,8 @@ _kube_ps1_color_fg() {
|
||||
magenta) _KUBE_PS1_FG_CODE=5;;
|
||||
cyan) _KUBE_PS1_FG_CODE=6;;
|
||||
white) _KUBE_PS1_FG_CODE=7;;
|
||||
# 256
|
||||
[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}";;
|
||||
# 256 colors
|
||||
[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
|
||||
esac
|
||||
|
||||
@@ -111,7 +120,7 @@ _kube_ps1_color_fg() {
|
||||
elif [[ "${_KUBE_PS1_SHELL}" == "bash" ]]; then
|
||||
if [[ "${_KUBE_PS1_TPUT_AVAILABLE}" == "true" ]]; then
|
||||
_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"
|
||||
else
|
||||
_KUBE_PS1_FG_CODE="${_KUBE_PS1_DEFAULT_FG}"
|
||||
@@ -131,20 +140,20 @@ _kube_ps1_color_bg() {
|
||||
magenta) _KUBE_PS1_BG_CODE=5;;
|
||||
cyan) _KUBE_PS1_BG_CODE=6;;
|
||||
white) _KUBE_PS1_BG_CODE=7;;
|
||||
# 256
|
||||
[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}";;
|
||||
*) _KUBE_PS1_BG_CODE=$'\033[0m';;
|
||||
# 256 colors
|
||||
[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=default
|
||||
esac
|
||||
|
||||
if [[ "${_KUBE_PS1_BG_CODE}" == "default" ]]; then
|
||||
_KUBE_PS1_FG_CODE="${_KUBE_PS1_DEFAULT_BG}"
|
||||
_KUBE_PS1_BG_CODE="${_KUBE_PS1_DEFAULT_BG}"
|
||||
return
|
||||
elif [[ "${_KUBE_PS1_SHELL}" == "zsh" ]]; then
|
||||
_KUBE_PS1_BG_CODE="%K{$_KUBE_PS1_BG_CODE}"
|
||||
elif [[ "${_KUBE_PS1_SHELL}" == "bash" ]]; then
|
||||
if [[ "${_KUBE_PS1_TPUT_AVAILABLE}" == "true" ]]; then
|
||||
_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"
|
||||
else
|
||||
_KUBE_PS1_BG_CODE="${_KUBE_PS1_DEFAULT_BG}"
|
||||
@@ -154,7 +163,7 @@ _kube_ps1_color_bg() {
|
||||
}
|
||||
|
||||
_kube_ps1_binary_check() {
|
||||
command -v $1 >/dev/null
|
||||
command -v "$1" >/dev/null
|
||||
}
|
||||
|
||||
_kube_ps1_symbol() {
|
||||
@@ -171,6 +180,7 @@ _kube_ps1_symbol() {
|
||||
local oc_glyph=$'\ue7b7'
|
||||
local oc_symbol_color=red
|
||||
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
|
||||
case "${symbol_arg}" in
|
||||
@@ -225,15 +235,27 @@ _kube_ps1_file_newer_than() {
|
||||
if [[ "${_KUBE_PS1_SHELL}" == "zsh" ]]; then
|
||||
# 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}")
|
||||
elif stat -c "%s" /dev/null &> /dev/null; then
|
||||
# GNU stat
|
||||
elif [[ "${_KUBE_PS1_STAT_TYPE}" == "gnu" ]]; then
|
||||
mtime=$(stat -L -c %Y "${file}")
|
||||
else
|
||||
# BSD stat
|
||||
mtime=$(stat -L -f %m "$file")
|
||||
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() {
|
||||
@@ -280,7 +302,6 @@ _kube_ps1_prompt_update() {
|
||||
_kube_ps1_get_context() {
|
||||
if [[ "${KUBE_PS1_CONTEXT_ENABLE}" == true ]]; then
|
||||
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}"
|
||||
|
||||
if [[ -n "${KUBE_PS1_CLUSTER_FUNCTION}" ]]; then
|
||||
@@ -303,7 +324,7 @@ _kube_ps1_get_ns() {
|
||||
_kube_ps1_get_context_ns() {
|
||||
# Set the command time
|
||||
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')
|
||||
else
|
||||
_KUBE_PS1_LAST_TIME=$(date +%s)
|
||||
@@ -312,9 +333,6 @@ _kube_ps1_get_context_ns() {
|
||||
_KUBE_PS1_LAST_TIME=$EPOCHREALTIME
|
||||
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.
|
||||
local conf
|
||||
_KUBE_PS1_CFGFILES_READ_CACHE=
|
||||
@@ -358,12 +376,13 @@ EOF
|
||||
kubeon() {
|
||||
if [[ "${1}" == '-h' || "${1}" == '--help' ]]; then
|
||||
_kubeon_usage
|
||||
return 0
|
||||
elif [[ "${1}" == '-g' || "${1}" == '--global' ]]; then
|
||||
rm -f -- "${_KUBE_PS1_DISABLE_PATH}"
|
||||
elif [[ "$#" -ne 0 ]]; then
|
||||
echo -e "error: unrecognized flag ${1}\\n"
|
||||
echo -e "error: unrecognized flag ${1}\\n" >&2
|
||||
_kubeon_usage
|
||||
return
|
||||
return 1
|
||||
fi
|
||||
|
||||
KUBE_PS1_ENABLED=on
|
||||
@@ -372,13 +391,14 @@ kubeon() {
|
||||
kubeoff() {
|
||||
if [[ "${1}" == '-h' || "${1}" == '--help' ]]; then
|
||||
_kubeoff_usage
|
||||
return 0
|
||||
elif [[ "${1}" == '-g' || "${1}" == '--global' ]]; then
|
||||
mkdir -p -- "$(dirname "${_KUBE_PS1_DISABLE_PATH}")"
|
||||
touch -- "${_KUBE_PS1_DISABLE_PATH}"
|
||||
elif [[ $# -ne 0 ]]; then
|
||||
echo "error: unrecognized flag ${1}" >&2
|
||||
echo -e "error: unrecognized flag ${1}\\n" >&2
|
||||
_kubeoff_usage
|
||||
return
|
||||
return 1
|
||||
fi
|
||||
|
||||
KUBE_PS1_ENABLED=off
|
||||
@@ -390,15 +410,9 @@ kube_ps1() {
|
||||
[[ -z "${KUBE_PS1_CONTEXT}" ]] && [[ "${KUBE_PS1_CONTEXT_ENABLE}" == true ]] && return
|
||||
[[ "${KUBE_PS1_CONTEXT}" == "N/A" ]] && [[ ${KUBE_PS1_HIDE_IF_NOCONTEXT} == true ]] && return
|
||||
|
||||
|
||||
local KUBE_PS1
|
||||
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
|
||||
[[ -n "${KUBE_PS1_BG_COLOR}" ]] && KUBE_PS1+="$(_kube_ps1_color_bg "${KUBE_PS1_BG_COLOR}")"
|
||||
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
# Proton Pass CLI plugin
|
||||
|
||||
This plugin adds completions for [Proton Pass CLI](https://protonpass.github.io/pass-cli/).
|
||||
|
||||
To use it, add `pass-cli` to the plugins array in your zshrc file:
|
||||
|
||||
```zsh
|
||||
plugins=(... pass-cli)
|
||||
```
|
||||
|
||||
This plugin does not add any aliases.
|
||||
@@ -0,0 +1,14 @@
|
||||
# Autocompletion for Proton Pass CLI (pass-cli)
|
||||
if (( ! $+commands[pass-cli] )); then
|
||||
return
|
||||
fi
|
||||
|
||||
# If the completion file doesn't exist yet, we need to autoload it and
|
||||
# bind it to `pass-cli`. Otherwise, compinit will have already done that.
|
||||
if [[ ! -f "$ZSH_CACHE_DIR/completions/_pass-cli" ]]; then
|
||||
typeset -g -A _comps
|
||||
autoload -Uz _pass-cli
|
||||
_comps[pass-cli]=_pass-cli
|
||||
fi
|
||||
|
||||
pass-cli completions zsh >| "$ZSH_CACHE_DIR/completions/_pass-cli" &|
|
||||
@@ -183,7 +183,10 @@ function _tmux_directory_session() {
|
||||
# human friendly unique session name for this directory
|
||||
local session_name="${dir}-${md5:0:6}"
|
||||
# create or attach to the session
|
||||
tmux new -As "$session_name"
|
||||
local -a tmux_cmd
|
||||
tmux_cmd=(command tmux)
|
||||
[[ "$ZSH_TMUX_UNICODE" == "true" ]] && tmux_cmd+=(-u)
|
||||
$tmux_cmd new -As "$session_name"
|
||||
}
|
||||
|
||||
alias tds=_tmux_directory_session
|
||||
|
||||
@@ -60,7 +60,14 @@ ZSH_THEME_GIT_PROMPT_UNMERGED="%{$fg[yellow]%} %{%G═%}"
|
||||
ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$fg[cyan]%} %{%G✭%}"
|
||||
|
||||
# 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_HBAR="─"
|
||||
PR_ULCORNER="┌"
|
||||
|
||||
Reference in New Issue
Block a user