Compare commits

..
Author SHA1 Message Date
Robby Russell b20d95c390 fix(gh): preserve valid completion cache on failure 2026-09-26 19:00:22 -05:00
91 changed files with 261 additions and 668 deletions

No files matched your search

+4 -4
View File
@@ -12,7 +12,7 @@ dependencies:
plugins/gradle: plugins/gradle:
repo: gradle/gradle-completion repo: gradle/gradle-completion
branch: master branch: master
version: 05693a01fcb246bc4e8fc32a8d561dc537aaedf2 version: e7c881dbef7462bc35ad05328397e1582fe25cb8
precopy: | precopy: |
set -e set -e
find . ! -name _gradle ! -name LICENSE -delete find . ! -name _gradle ! -name LICENSE -delete
@@ -30,7 +30,7 @@ dependencies:
plugins/kube-ps1: plugins/kube-ps1:
repo: jonmosco/kube-ps1 repo: jonmosco/kube-ps1
branch: master branch: master
version: 7aaaeee5eaa29f920acd850ea63839d9f87b8ac5 version: b4cd09ec8d4dc007173e28da40aeebf8eff8c87f
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
@@ -46,7 +46,7 @@ dependencies:
plugins/z: plugins/z:
branch: master branch: master
repo: agkozak/zsh-z repo: agkozak/zsh-z
version: 7f8ff4df11b50a14e3666c7cd212baa399c9b92a version: 102fb78036ed76feedf623907483691777a1d510
precopy: | precopy: |
set -e set -e
rm -r tests rm -r tests
@@ -75,7 +75,7 @@ dependencies:
plugins/zsh-syntax-highlighting: plugins/zsh-syntax-highlighting:
repo: zsh-users/zsh-syntax-highlighting repo: zsh-users/zsh-syntax-highlighting
branch: master branch: master
version: e6683f20e5c38d3e5447f45845d04ddda75d0f23 version: 2fc57d63067c18b1100ecdbf684fa5baf49459d1
precopy: | precopy: |
set -e set -e
version=$(<.version) version=$(<.version)
@@ -1,6 +1,6 @@
certifi==2026.7.22 certifi==2026.7.22
charset-normalizer==3.5.2 charset-normalizer==3.5.1
idna==3.20 idna==3.19
PyYAML==6.0.3 PyYAML==6.0.3
requests==2.34.2 requests==2.34.2
semver==3.1.0 semver==3.1.0
+1 -1
View File
@@ -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@2892aa5e19bbd11bc0cff5427e3b750a04d9e3c2 # v4.38.2 uses: github/codeql-action/upload-sarif@b96794f015dfd88f77b49b1c93e0fa7110f94c63 # v4.38.0
with: with:
sarif_file: results.sarif sarif_file: results.sarif
+1 -2
View File
@@ -178,8 +178,7 @@ function omz_urlencode() {
setopt norematchpcre setopt norematchpcre
local -a opts local -a opts
# Quote the specs so global aliases (e.g. common-aliases' P) don't expand here zparseopts -D -E -a opts r m P
zparseopts -D -E -a opts 'r' 'm' 'P'
local in_str="$@" local in_str="$@"
local url_str="" local url_str=""
+2 -2
View File
@@ -11,8 +11,8 @@ fi
zmodload -F zsh/files b:zf_mv zmodload -F zsh/files b:zf_mv
() { () {
local TMPPREFIX="$ZSH_CACHE_DIR/completions/._op" local TMPPREFIX="$ZSH_CACHE_DIR/completions/_op"
zf_mv -f -- =( op completion zsh ) "$ZSH_CACHE_DIR/completions/_op" zf_mv -f -- =( op completion zsh ) "$TMPPREFIX"
} &| } &|
# Load opswd function # Load opswd function
+2 -2
View File
@@ -13,6 +13,6 @@ fi
# Generate and load arduino-cli completion # Generate and load arduino-cli completion
zmodload -F zsh/files b:zf_mv zmodload -F zsh/files b:zf_mv
() { () {
local TMPPREFIX="$ZSH_CACHE_DIR/completions/._arduino-cli" local TMPPREFIX="$ZSH_CACHE_DIR/completions/_arduino-cli"
zf_mv -f -- =( arduino-cli completion zsh ) "$ZSH_CACHE_DIR/completions/_arduino-cli" zf_mv -f -- =( arduino-cli completion zsh ) "$TMPPREFIX"
} &| } &|
+2 -2
View File
@@ -13,6 +13,6 @@ fi
zmodload -F zsh/files b:zf_mv zmodload -F zsh/files b:zf_mv
() { () {
local TMPPREFIX="$ZSH_CACHE_DIR/completions/._argocd" local TMPPREFIX="$ZSH_CACHE_DIR/completions/_argocd"
zf_mv -f -- =( argocd completion zsh ) "$ZSH_CACHE_DIR/completions/_argocd" zf_mv -f -- =( argocd completion zsh ) "$TMPPREFIX"
} &| } &|
+2 -2
View File
@@ -14,6 +14,6 @@ if [[ ! -f "$ZSH_CACHE_DIR/completions/_asdf" ]]; then
fi fi
zmodload -F zsh/files b:zf_mv zmodload -F zsh/files b:zf_mv
() { () {
local TMPPREFIX="$ZSH_CACHE_DIR/completions/._asdf" local TMPPREFIX="$ZSH_CACHE_DIR/completions/_asdf"
zf_mv -f -- =( asdf completion zsh ) "$ZSH_CACHE_DIR/completions/_asdf" zf_mv -f -- =( asdf completion zsh ) "$TMPPREFIX"
} &| } &|
+5 -5
View File
@@ -25,10 +25,10 @@ if [[ "$OSTYPE" = darwin* ]]; then
echo "$(ioreg -rc AppleSmartBattery | grep -o '"Watts"=[0-9]\+' | head -1 | grep -o '[0-9]\+')W " echo "$(ioreg -rc AppleSmartBattery | grep -o '"Watts"=[0-9]\+' | head -1 | grep -o '[0-9]\+')W "
} }
function battery_is_charging() { function battery_is_charging() {
ioreg -rc AppleSmartBattery | command grep -q '^.*"ExternalConnected" = Yes' ioreg -rc AppleSmartBattery | command grep -q '^.*"ExternalConnected"\ =\ Yes'
} }
function battery_pct() { function battery_pct() {
pmset -g batt | grep -Eo "[0-9]+%" | cut -d% -f1 pmset -g batt | grep -Eo "\d+%" | cut -d% -f1
} }
function battery_pct_remaining() { function battery_pct_remaining() {
if battery_is_charging; then if battery_is_charging; then
@@ -39,8 +39,8 @@ if [[ "$OSTYPE" = darwin* ]]; then
} }
function battery_time_remaining() { function battery_time_remaining() {
local smart_battery_status="$(ioreg -rc "AppleSmartBattery")" local smart_battery_status="$(ioreg -rc "AppleSmartBattery")"
if [[ $(echo $smart_battery_status | command grep -c '^.*"ExternalConnected" = No') -eq 1 ]]; then if [[ $(echo $smart_battery_status | command grep -c '^.*"ExternalConnected"\ =\ No') -eq 1 ]]; then
timeremaining=$(echo $smart_battery_status | command grep '^.*"AvgTimeToEmpty" = ' | sed -e 's/^.*"AvgTimeToEmpty" = //') timeremaining=$(echo $smart_battery_status | command grep '^.*"AvgTimeToEmpty"\ =\ ' | sed -e 's/^.*"AvgTimeToEmpty"\ =\ //')
if [ $timeremaining -gt 720 ]; then if [ $timeremaining -gt 720 ]; then
echo "::" echo "::"
else else
@@ -52,7 +52,7 @@ if [[ "$OSTYPE" = darwin* ]]; then
} }
function battery_pct_prompt () { function battery_pct_prompt () {
local battery_pct color local battery_pct color
if ioreg -rc AppleSmartBattery | command grep -q '^.*"ExternalConnected" = No'; then if ioreg -rc AppleSmartBattery | command grep -q '^.*"ExternalConnected"\ =\ No'; then
battery_pct=$(battery_pct_remaining) battery_pct=$(battery_pct_remaining)
if [[ $battery_pct -gt 50 ]]; then if [[ $battery_pct -gt 50 ]]; then
color='green' color='green'
+2 -2
View File
@@ -13,6 +13,6 @@ fi
# Generate and load buf completion # Generate and load buf completion
zmodload -F zsh/files b:zf_mv zmodload -F zsh/files b:zf_mv
() { () {
local TMPPREFIX="$ZSH_CACHE_DIR/completions/._buf" local TMPPREFIX="$ZSH_CACHE_DIR/completions/_buf"
zf_mv -f -- =( buf completion zsh ) "$ZSH_CACHE_DIR/completions/_buf" zf_mv -f -- =( buf completion zsh ) "$TMPPREFIX"
} &| } &|
+2 -2
View File
@@ -13,6 +13,6 @@ fi
zmodload -F zsh/files b:zf_mv zmodload -F zsh/files b:zf_mv
() { () {
local TMPPREFIX="$ZSH_CACHE_DIR/completions/._bun" local TMPPREFIX="$ZSH_CACHE_DIR/completions/_bun"
zf_mv -f -- =( SHELL=zsh bun completions ) "$ZSH_CACHE_DIR/completions/_bun" zf_mv -f -- =( SHELL=zsh bun completions ) "$TMPPREFIX"
} &| } &|
+2 -2
View File
@@ -13,6 +13,6 @@ fi
zmodload -F zsh/files b:zf_mv zmodload -F zsh/files b:zf_mv
() { () {
local TMPPREFIX="$ZSH_CACHE_DIR/completions/._charm" local TMPPREFIX="$ZSH_CACHE_DIR/completions/_charm"
zf_mv -f -- =( charm completion zsh ) "$ZSH_CACHE_DIR/completions/_charm" zf_mv -f -- =( charm completion zsh ) "$TMPPREFIX"
} &| } &|
+2 -2
View File
@@ -13,6 +13,6 @@ fi
zmodload -F zsh/files b:zf_mv zmodload -F zsh/files b:zf_mv
() { () {
local TMPPREFIX="$ZSH_CACHE_DIR/completions/._chezmoi" local TMPPREFIX="$ZSH_CACHE_DIR/completions/_chezmoi"
zf_mv -f -- =( chezmoi completion zsh ) "$ZSH_CACHE_DIR/completions/_chezmoi" zf_mv -f -- =( chezmoi completion zsh ) "$TMPPREFIX"
} &| } &|
+2 -2
View File
@@ -13,6 +13,6 @@ fi
zmodload -F zsh/files b:zf_mv zmodload -F zsh/files b:zf_mv
() { () {
local TMPPREFIX="$ZSH_CACHE_DIR/completions/._codex" local TMPPREFIX="$ZSH_CACHE_DIR/completions/_codex"
zf_mv -f -- =( codex completion zsh < /dev/null 2> /dev/null ) "$ZSH_CACHE_DIR/completions/_codex" zf_mv -f -- =( codex completion zsh < /dev/null 2> /dev/null ) "$TMPPREFIX"
} &| } &|
+1 -1
View File
@@ -14,6 +14,6 @@ function copyfile {
return 1 return 1
fi fi
clipcopy $1 || return 1 clipcopy $1
echo ${(%):-"%B$1%b copied to clipboard."} echo ${(%):-"%B$1%b copied to clipboard."}
} }
-74
View File
@@ -1,74 +0,0 @@
#!/usr/bin/env zsh
emulate -LR zsh
source "${1:-${0:A:h:h}/copyfile.plugin.zsh}"
test_dir=$(mktemp -d) || exit 1
trap 'command rm -rf -- "$test_dir"' EXIT
typeset -i clipboard_status=0 failures=0 tests=0
typeset output expected_output
clipcopy() {
print -r -- "$#" "$1" >| "$test_dir/call"
if (( clipboard_status )); then
print -u2 -r -- "clipboard backend failed"
return $clipboard_status
fi
command cat -- "$1" >| "$test_dir/clipboard"
}
check_copyfile() {
local description="$1" expected_status="$2" expected_stdout="$3" expected_stderr="$4"
shift 4
output=$(copyfile "$@" 2> "$test_dir/stderr")
local actual_status=$?
(( tests++ ))
if [[ $actual_status == $expected_status && $output == "$expected_stdout" && $(<"$test_dir/stderr") == "$expected_stderr" ]]; then
print -r -- "PASS: $description"
else
print -u2 -r -- "FAIL: $description"
print -u2 -r -- " status: $actual_status (expected $expected_status)"
print -u2 -r -- " stdout: ${(qqq)output} (expected ${(qqq)expected_stdout})"
print -u2 -r -- " stderr: $(<"$test_dir/stderr") (expected $expected_stderr)"
(( failures++ ))
fi
}
for filename in plain.txt 'file with spaces.txt' 'unicode-ą.txt' empty.txt; do
if [[ $filename == empty.txt ]]; then
: >| "$test_dir/$filename"
else
print -r -- "contents of $filename" >| "$test_dir/$filename"
fi
expected_output=${(%):-"%B$test_dir/$filename%b copied to clipboard."}
clipboard_status=0
check_copyfile "successful copy of $filename" 0 "$expected_output" '' "$test_dir/$filename"
if [[ $(<"$test_dir/call") != "1 $test_dir/$filename" ]] || ! command cmp -s -- "$test_dir/$filename" "$test_dir/clipboard"; then
print -u2 -r -- "FAIL: clipboard received a different argument or contents for $filename"
(( failures++ ))
fi
for clipboard_status in 1 42 127; do
check_copyfile "clipboard exit $clipboard_status for $filename" 1 '' 'clipboard backend failed' "$test_dir/$filename"
done
done
command rm -f -- "$test_dir/call"
check_copyfile 'missing argument' 1 'Usage: copyfile <file>' ''
check_copyfile 'empty argument' 1 'Usage: copyfile <file>' '' ''
check_copyfile 'nonexistent file' 1 "Error: '$test_dir/missing.txt' is not a valid file." '' "$test_dir/missing.txt"
check_copyfile 'directory argument' 1 "Error: '$test_dir' is not a valid file." '' "$test_dir"
if [[ -e "$test_dir/call" ]]; then
print -u2 -r -- 'FAIL: invalid input invoked the clipboard backend'
(( failures++ ))
fi
print -r -- "$tests tests, $failures failures"
(( failures == 0 ))
+2 -2
View File
@@ -27,6 +27,6 @@ fi
zmodload -F zsh/files b:zf_mv zmodload -F zsh/files b:zf_mv
() { () {
local TMPPREFIX="$ZSH_CACHE_DIR/completions/._deno" local TMPPREFIX="$ZSH_CACHE_DIR/completions/_deno"
zf_mv -f -- =( deno completions zsh ) "$ZSH_CACHE_DIR/completions/_deno" zf_mv -f -- =( deno completions zsh ) "$TMPPREFIX"
} &| } &|
+2 -2
View File
@@ -68,7 +68,7 @@ zmodload -F zsh/files b:zf_mv
! is-at-least 23.0.0 ${${(s:,:z)"$(command docker --version)"}[3]}; then ! is-at-least 23.0.0 ${${(s:,:z)"$(command docker --version)"}[3]}; then
command cp "${plugin_dir}/completions/_docker" "$ZSH_CACHE_DIR/completions/_docker" command cp "${plugin_dir}/completions/_docker" "$ZSH_CACHE_DIR/completions/_docker"
else else
local TMPPREFIX="$ZSH_CACHE_DIR/completions/._docker" local TMPPREFIX="$ZSH_CACHE_DIR/completions/_docker"
zf_mv -f -- =( command docker completion zsh ) "$ZSH_CACHE_DIR/completions/_docker" zf_mv -f -- =( command docker completion zsh ) "$TMPPREFIX"
fi fi
} "${0:A:h}" &| } "${0:A:h}" &|
+2 -2
View File
@@ -16,6 +16,6 @@ fi
zmodload -F zsh/files b:zf_mv zmodload -F zsh/files b:zf_mv
() { () {
local TMPPREFIX="$ZSH_CACHE_DIR/completions/._doctl" local TMPPREFIX="$ZSH_CACHE_DIR/completions/_doctl"
zf_mv -f -- =( doctl completion zsh ) "$ZSH_CACHE_DIR/completions/_doctl" zf_mv -f -- =( doctl completion zsh ) "$TMPPREFIX"
} &| } &|
+1 -3
View File
@@ -35,9 +35,7 @@ alias eeval="$EMACS_PLUGIN_LAUNCHER --eval"
alias eframe='emacsclient --alternate-editor="" --create-frame' alias eframe='emacsclient --alternate-editor="" --create-frame'
# Emacs ANSI Term tracking # Emacs ANSI Term tracking
local excluded_terms=(vterm ghostel) if [[ -n "$INSIDE_EMACS" ]] && [[ "$INSIDE_EMACS" != "vterm" ]]; then
local current_term="${INSIDE_EMACS%%,*}"
if [[ -n "$INSIDE_EMACS" ]] && (( ! ${excluded_terms[(Ie)$current_term]} )); then
chpwd_emacs() { print -P "\033AnSiTc %d"; } chpwd_emacs() { print -P "\033AnSiTc %d"; }
print -P "\033AnSiTc %d" # Track current working directory print -P "\033AnSiTc %d" # Track current working directory
print -P "\033AnSiTu %n" # Track username print -P "\033AnSiTu %n" # Track username
+2 -3
View File
@@ -32,9 +32,8 @@ emacsfun() {
# Check if there are suitable frames # Check if there are suitable frames
frames="$(emacsclient -a '' -n -e "$cmd" 2>/dev/null |sed 's/.*\x07//g' )" frames="$(emacsclient -a '' -n -e "$cmd" 2>/dev/null |sed 's/.*\x07//g' )"
# A bare emacs/e passes only --no-wait, so it still needs --create-frame. # Only create another X frame if there isn't one present
if [ -z "$frames" ] || [ "$frames" = nil ] || [ "$#" -eq 0 ] \ if [ -z "$frames" -o "$frames" = nil ]; then
|| { [ "$#" -eq 1 ] && [ "$1" = --no-wait ]; }; then
emacsclient --alternate-editor="" --create-frame "$@" emacsclient --alternate-editor="" --create-frame "$@"
return $? return $?
fi fi
+2 -14
View File
@@ -101,9 +101,7 @@ EOF
(*.tar.lz4) lz4 -c -d "$full_path" | tar xvf - ;; (*.tar.lz4) lz4 -c -d "$full_path" | tar xvf - ;;
(*.tar.lrz) (( $+commands[lrzuntar] )) && lrzuntar "$full_path" ;; (*.tar.lrz) (( $+commands[lrzuntar] )) && lrzuntar "$full_path" ;;
(*.gz) (( $+commands[pigz] )) && pigz -cdk "$full_path" > "${file:t:r}" || gunzip -ck "$full_path" > "${file:t:r}" ;; (*.gz) (( $+commands[pigz] )) && pigz -cdk "$full_path" > "${file:t:r}" || gunzip -ck "$full_path" > "${file:t:r}" ;;
(*.bz2) (*.bz2) (( $+commands[pbzip2] )) && pbzip2 -d "$full_path" || bunzip2 "$full_path" ;;
(( $+commands[pbzip2] )) && pbzip2 -cd "$full_path" > "${file:t:r}" \
|| bunzip2 -c "$full_path" > "${file:t:r}" ;;
(*.xz) xzcat "$full_path" > "${file:t:r}" ;; (*.xz) xzcat "$full_path" > "${file:t:r}" ;;
(*.lrz) (( $+commands[lrunzip] )) && lrunzip "$full_path" ;; (*.lrz) (( $+commands[lrunzip] )) && lrunzip "$full_path" ;;
(*.lz4) lz4 -d "$full_path" ;; (*.lz4) lz4 -d "$full_path" ;;
@@ -121,17 +119,7 @@ EOF
fi ;; fi ;;
(*.rpm) (*.rpm)
rpm2cpio "$full_path" | cpio --quiet -id ;; rpm2cpio "$full_path" | cpio --quiet -id ;;
(*.7z | *.7z.[0-9]* | *.pk7) (*.7z | *.7z.[0-9]* | *.pk7) 7za x "$full_path" ;;
if (( $+commands[7zz] )); then
7zz x "$full_path"
elif (( $+commands[7z] )); then
7z x "$full_path"
elif (( $+commands[7za] )); then
7za x "$full_path"
else
echo "extract: cannot extract 7z files: install 7zz, 7z or 7za" >&2
success=1
fi ;;
(*.deb) (*.deb)
command mkdir -p "control" "data" command mkdir -p "control" "data"
ar vx "$full_path" > /dev/null ar vx "$full_path" > /dev/null
+2 -2
View File
@@ -32,6 +32,6 @@ fi
zmodload -F zsh/files b:zf_mv zmodload -F zsh/files b:zf_mv
() { () {
local TMPPREFIX="$ZSH_CACHE_DIR/completions/._flutter" local TMPPREFIX="$ZSH_CACHE_DIR/completions/_flutter"
zf_mv -f -- =( flutter zsh-completion < /dev/null ) "$ZSH_CACHE_DIR/completions/_flutter" zf_mv -f -- =( flutter zsh-completion < /dev/null ) "$TMPPREFIX"
} &| } &|
+2 -2
View File
@@ -13,6 +13,6 @@ fi
zmodload -F zsh/files b:zf_mv zmodload -F zsh/files b:zf_mv
() { () {
local TMPPREFIX="$ZSH_CACHE_DIR/completions/._flux" local TMPPREFIX="$ZSH_CACHE_DIR/completions/_flux"
zf_mv -f -- =( flux completion zsh ) "$ZSH_CACHE_DIR/completions/_flux" zf_mv -f -- =( flux completion zsh ) "$TMPPREFIX"
} &| } &|
+2 -2
View File
@@ -12,8 +12,8 @@ fi
zmodload -F zsh/files b:zf_mv zmodload -F zsh/files b:zf_mv
() { () {
local TMPPREFIX="$ZSH_CACHE_DIR/completions/._fnm" local TMPPREFIX="$ZSH_CACHE_DIR/completions/_fnm"
zf_mv -f -- =( fnm completions --shell=zsh ) "$ZSH_CACHE_DIR/completions/_fnm" zf_mv -f -- =( fnm completions --shell=zsh ) "$TMPPREFIX"
} &| } &|
if zstyle -t ':omz:plugins:fnm' autostart; then if zstyle -t ':omz:plugins:fnm' autostart; then
+2 -2
View File
@@ -13,6 +13,6 @@ fi
zmodload -F zsh/files b:zf_mv zmodload -F zsh/files b:zf_mv
() { () {
local TMPPREFIX="$ZSH_CACHE_DIR/completions/._gcx" local TMPPREFIX="$ZSH_CACHE_DIR/completions/_gcx"
zf_mv -f -- =( gcx completion zsh ) "$ZSH_CACHE_DIR/completions/_gcx" zf_mv -f -- =( gcx completion zsh ) "$TMPPREFIX"
} &| } &|
+2
View File
@@ -18,3 +18,5 @@ plugin is loaded, which is usually when you start up a new terminal emulator.
The cache is stored at: The cache is stored at:
- `$ZSH_CACHE_DIR/completions/_gh` completions script - `$ZSH_CACHE_DIR/completions/_gh` completions script
If an update fails, the last successfully generated completion script is kept.
+8 -2
View File
@@ -13,6 +13,12 @@ fi
zmodload -F zsh/files b:zf_mv zmodload -F zsh/files b:zf_mv
() { () {
local TMPPREFIX="$ZSH_CACHE_DIR/completions/._gh" local completion_file="$ZSH_CACHE_DIR/completions/_gh"
zf_mv -f -- =( gh completion --shell zsh ) "$ZSH_CACHE_DIR/completions/_gh" local completion_tmp="${completion_file}.$$.${RANDOM}"
if gh completion --shell zsh >| "$completion_tmp" && [[ -s "$completion_tmp" ]]; then
zf_mv -f -- "$completion_tmp" "$completion_file"
fi
command rm -f -- "$completion_tmp"
} &| } &|
-6
View File
@@ -108,7 +108,6 @@ plugins=(... git)
| `glo` | `git log --oneline --decorate` | | `glo` | `git log --oneline --decorate` |
| `glog` | `git log --oneline --decorate --graph` | | `glog` | `git log --oneline --decorate --graph` |
| `gloga` | `git log --oneline --decorate --graph --all` | | `gloga` | `git log --oneline --decorate --graph --all` |
| `glom` | `git log --oneline --decorate --color $(git_main_branch)..` |
| `glp` | `git log --pretty=<format>` | | `glp` | `git log --pretty=<format>` |
| `glg` | `git log --stat` | | `glg` | `git log --stat` |
| `glgp` | `git log --stat --patch` | | `glgp` | `git log --stat --patch` |
@@ -156,8 +155,6 @@ plugins=(... git)
| `grba` | `git rebase --abort` | | `grba` | `git rebase --abort` |
| `grbc` | `git rebase --continue` | | `grbc` | `git rebase --continue` |
| `grbi` | `git rebase --interactive` | | `grbi` | `git rebase --interactive` |
| `grbmi` | `git rebase $(git_main_branch) --interactive` |
| `grbmia` | `git rebase $(git_main_branch) --interactive --autosquash` |
| `grbo` | `git rebase --onto` | | `grbo` | `git rebase --onto` |
| `grbs` | `git rebase --skip` | | `grbs` | `git rebase --skip` |
| `grbd` | `git rebase $(git_develop_branch)` | | `grbd` | `git rebase $(git_develop_branch)` |
@@ -191,7 +188,6 @@ plugins=(... git)
| `grmc` | `git rm --cached` | | `grmc` | `git rm --cached` |
| `gcount` | `git shortlog --summary -n` | | `gcount` | `git shortlog --summary -n` |
| `gsh` | `git show` | | `gsh` | `git show` |
| `gshs` | `git show --stat` |
| `gsps` | `git show --pretty=short --show-signature` | | `gsps` | `git show --pretty=short --show-signature` |
| `gstall` | `git stash --all` | | `gstall` | `git stash --all` |
| `gstu` | `git stash --include-untracked` | | `gstu` | `git stash --include-untracked` |
@@ -206,10 +202,8 @@ plugins=(... git)
| `gst` | `git status` | | `gst` | `git status` |
| `gss` | `git status --short` | | `gss` | `git status --short` |
| `gsb` | `git status --short -b` | | `gsb` | `git status --short -b` |
| `gsnut` | `git status --untracked-files=no` |
| `gsi` | `git submodule init` | | `gsi` | `git submodule init` |
| `gsu` | `git submodule update` | | `gsu` | `git submodule update` |
| `gsuri` | `git submodule update --recursive --init` |
| `gsd` | `git svn dcommit` | | `gsd` | `git svn dcommit` |
| `git-svn-dcommit-push` | `git svn dcommit && git push github $(git_main_branch):svntrunk` | | `git-svn-dcommit-push` | `git svn dcommit && git push github $(git_main_branch):svntrunk` |
| `gsr` | `git svn rebase` | | `gsr` | `git svn rebase` |
-6
View File
@@ -253,7 +253,6 @@ alias glolm='git log $(git_main_branch) --graph --pretty="%Cred%h%Creset -%C(aut
alias glo='git log --oneline --decorate' alias glo='git log --oneline --decorate'
alias glog='git log --oneline --decorate --graph' alias glog='git log --oneline --decorate --graph'
alias gloga='git log --oneline --decorate --graph --all' alias gloga='git log --oneline --decorate --graph --all'
alias glom='git log --oneline --decorate --color $(git_main_branch)..'
# Pretty log messages # Pretty log messages
function _git_log_prettily(){ function _git_log_prettily(){
@@ -363,8 +362,6 @@ alias grbd='git rebase $(git_develop_branch)'
alias grbm='git rebase $(git_main_branch)' alias grbm='git rebase $(git_main_branch)'
alias grbom='git rebase origin/$(git_main_branch)' alias grbom='git rebase origin/$(git_main_branch)'
alias grbum='git rebase upstream/$(git_main_branch)' alias grbum='git rebase upstream/$(git_main_branch)'
alias grbmi='git rebase $(git_main_branch) --interactive'
alias grbmia='git rebase $(git_main_branch) --interactive --autosquash'
alias grf='git reflog' alias grf='git reflog'
alias gr='git remote' alias gr='git remote'
alias grv='git remote --verbose' alias grv='git remote --verbose'
@@ -392,7 +389,6 @@ alias grm='git rm'
alias grmc='git rm --cached' alias grmc='git rm --cached'
alias gcount='git shortlog --summary --numbered' alias gcount='git shortlog --summary --numbered'
alias gsh='git show' alias gsh='git show'
alias gshs='git show --stat'
alias gsps='git show --pretty=short --show-signature' alias gsps='git show --pretty=short --show-signature'
alias gstall='git stash --all' alias gstall='git stash --all'
alias gstaa='git stash apply' alias gstaa='git stash apply'
@@ -408,10 +404,8 @@ alias gsts='git stash show --patch'
alias gst='git status' alias gst='git status'
alias gss='git status --short' alias gss='git status --short'
alias gsb='git status --short --branch' alias gsb='git status --short --branch'
alias gsnut='git status --untracked-files=no'
alias gsi='git submodule init' alias gsi='git submodule init'
alias gsu='git submodule update' alias gsu='git submodule update'
alias gsuri='git submodule update --recursive --init'
alias gsd='git svn dcommit' alias gsd='git svn dcommit'
alias git-svn-dcommit-push='git svn dcommit && git push github $(git_main_branch):svntrunk' alias git-svn-dcommit-push='git svn dcommit && git push github $(git_main_branch):svntrunk'
alias gsr='git svn rebase' alias gsr='git svn rebase'
+36 -34
View File
@@ -1,43 +1,45 @@
# github plugin # github plugin
> [!WARNING] This plugin supports working with GitHub from the command line. It provides a few things:
> This plugin is deprecated and will be removed in a future release. It supports
> the legacy [`hub`](https://github.com/mislav/hub) CLI, not the current GitHub
> CLI. For `gh` completion, use the [`gh` plugin](../gh) instead.
The plugin provides compatibility for existing `hub` users by: * Sets up the `hub` wrapper and completions for the `git` command if you have [`hub`](https://github.com/github/hub) installed.
* Completion for the [`github` Ruby gem](https://github.com/defunkt/github-gem).
* Convenience functions for working with repos and URLs.
- aliasing `git` to `hub` when `hub` is installed; ### Functions
- adding completion for `hub`; and
- defining convenience functions for creating repositories.
## Migrating to GitHub CLI * `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
Install [GitHub CLI](https://cli.github.com/), replace `github` with `gh` in
your plugin list, and restart your shell: ## Installation
[Hub](https://github.com/github/hub) needs to be installed if you want to use it. On OS X with Homebrew, this can be done with `brew install hub`. The `hub` completion definition needs to be added to your `$FPATH` before initializing OMZ.
The [`github` Ruby gem](https://github.com/defunkt/github-gem) needs to be installed if you want to use it.
### Configuration
These settings affect `github`'s behavior.
#### Environment variables
* `$GITHUB_USER`
* `$GITHUB_PASSWORD`
#### Git configuration options
* `github.user` - GitHub username for repo operations
See `man hub` for more details.
### Homebrew installation note
If you have installed `hub` using Homebrew, its completions may not be on your `$FPATH` if you are using the system `zsh`. Homebrew installs `zsh` completion definitions to `/usr/local/share/zsh/site-functions`, which will be on `$FPATH` for the Homebrew-installed `zsh`, but not for the system `zsh`. If you want it to work with the system `zsh`, add this to your `~/.zshrc` before it sources `oh-my-zsh.sh`.
```zsh ```zsh
plugins=(... gh) if (( ! ${fpath[(I)/usr/local/share/zsh/site-functions]} )); then
FPATH=/usr/local/share/zsh/site-functions:$FPATH
fi
``` ```
The `gh` plugin supplies completion for the installed GitHub CLI. It does not
alias `git`, because `gh` is not a Git wrapper.
The closest replacement for creating a GitHub repository from an existing
local repository is:
```zsh
gh repo create --source=. --push
```
## Deprecated functions
- `empty_gh` - creates a new repository with a `README.md` and pushes it to GitHub
- `new_gh` - initializes an existing directory and pushes it to GitHub
- `exist_gh` - pushes an existing Git repository to GitHub
These functions remain available during the deprecation period and require
`hub`. They will be removed with the plugin.
If you continue using `hub`, see its documentation for authentication and
configuration details.
+7 -10
View File
@@ -1,6 +1,3 @@
print -Pru2 -- '%F{yellow}[oh-my-zsh] The %Bgithub%b plugin is deprecated and will be removed in a future release.'
print -Pru2 -- 'It supports the legacy %Bhub%b CLI. Use the %Bgh%b plugin for GitHub CLI completion.%f'
# Set up hub wrapper for git, if it is available; https://github.com/github/hub # Set up hub wrapper for git, if it is available; https://github.com/github/hub
if (( $+commands[hub] )); then if (( $+commands[hub] )); then
alias git=hub alias git=hub
@@ -29,7 +26,7 @@ empty_gh() { # [NAME_OF_REPO]
# This function will add all non-hidden files to git. # This function will add all non-hidden files to git.
new_gh() { # [DIRECTORY] new_gh() { # [DIRECTORY]
emulate -L zsh emulate -L zsh
local repo="${1-.}" local repo="$1"
cd "$repo" \ cd "$repo" \
|| return || return
@@ -45,7 +42,7 @@ new_gh() { # [DIRECTORY]
|| return || return
hub create \ hub create \
|| return || return
git push -u origin HEAD \ git push -u origin master \
|| return || return
} }
@@ -55,19 +52,18 @@ new_gh() { # [DIRECTORY]
# to your GitHub. # to your GitHub.
exist_gh() { # [DIRECTORY] exist_gh() { # [DIRECTORY]
emulate -L zsh emulate -L zsh
local repo="${1:-.}" local repo=$1
cd "$repo" \ cd "$repo"
|| return
hub create \ hub create \
|| return || return
git push -u origin HEAD git push -u origin master
} }
# git.io "GitHub URL" # git.io "GitHub URL"
# #
# Shorten GitHub url, example: # Shorten GitHub url, example:
# https://github.com/nvogel/dotzsh > https://git.io/8nU25w # https://github.com/nvogel/dotzsh > https://git.io/8nU25w
# source: https://github.com/nvogel/dotzsh # source: https://github.com/nvogel/dotzsh
# documentation: https://github.com/blog/985-git-io-github-url-shortener # documentation: https://github.com/blog/985-git-io-github-url-shortener
# #
@@ -78,3 +74,4 @@ git.io() {
} }
# End Functions ############################################################# # End Functions #############################################################
+2 -2
View File
@@ -13,6 +13,6 @@ fi
zmodload -F zsh/files b:zf_mv zmodload -F zsh/files b:zf_mv
() { () {
local TMPPREFIX="$ZSH_CACHE_DIR/completions/._glab" local TMPPREFIX="$ZSH_CACHE_DIR/completions/_glab"
zf_mv -f -- =( glab completion -s zsh ) "$ZSH_CACHE_DIR/completions/_glab" zf_mv -f -- =( glab completion -s zsh ) "$TMPPREFIX"
} &| } &|
+1 -5
View File
@@ -4,11 +4,7 @@ globalias() {
# (A) makes it an array even if there's only one element # (A) makes it an array even if there's only one element
local word=${${(Az)LBUFFER}[-1]} local word=${${(Az)LBUFFER}[-1]}
if [[ $GLOBALIAS_FILTER_VALUES[(Ie)$word] -eq 0 ]]; then if [[ $GLOBALIAS_FILTER_VALUES[(Ie)$word] -eq 0 ]]; then
# Completion also considers quoted strings and assignment values as aliases. zle _expand_alias
# Only expand when the complete shell word is an alias name.
if (( ${+aliases[$word]} || ${+galiases[$word]} )); then
zle _expand_alias
fi
zle expand-word zle expand-word
fi fi
zle self-insert zle self-insert
@@ -1,81 +0,0 @@
#!/usr/bin/env zsh
# Exercise the actual ZLE widgets in an isolated interactive shell.
emulate -L zsh
setopt err_return
zmodload zsh/zpty
zmodload zsh/zselect
local test_dir=$(mktemp -d)
export GLOBALIAS_TEST_PLUGIN=${0:A:h:h}/globalias.plugin.zsh
export GLOBALIAS_TEST_RESULT=$test_dir/result
wait_for_marker() {
local marker=$1 output received
local -i deadline=$(( SECONDS + 5 ))
while (( SECONDS < deadline )); do
if zpty -r globalias-test output; then
received+=$output
[[ $received == *$marker* ]] && return 0
else
zselect -t 1 || true
fi
done
print -u2 -r -- "Timed out waiting for ZLE: $received"
return 1
}
check_expansion() {
local input=$1 expected=$2 actual
zpty -w -n globalias-test "$input"$' \x18'
wait_for_marker GLOBALIAS_TEST_CAPTURED
actual=$(< "$GLOBALIAS_TEST_RESULT")
if [[ $actual != "$expected" ]]; then
print -u2 -r -- "Input: ${(qqq)input}"
print -u2 -r -- "Expected: ${(qqq)expected}; got: ${(qqq)actual}"
return 1
fi
}
{
cat > "$test_dir/setup.zsh" <<'SETUP'
autoload -Uz compinit
compinit -D
source "$GLOBALIAS_TEST_PLUGIN"
alias 1='cd -1'
alias ll='ls -l'
alias -g G='| grep'
GLOBALIAS_FILTER_VALUES=(ll)
_globalias_test_capture() {
print -rn -- "$BUFFER" > "$GLOBALIAS_TEST_RESULT"
print -r -- $'\nGLOBALIAS_TEST_CAPTURED'
BUFFER=
zle .accept-line
}
zle -N _globalias_test_capture
bindkey '^X' _globalias_test_capture
PS1='GLOBALIAS_TEST_READY> '
RPROMPT=
SETUP
zpty -b globalias-test zsh -dfi
zpty -w globalias-test "source ${(q)test_dir}/setup.zsh"
wait_for_marker GLOBALIAS_TEST_READY
check_expansion 'DEBUG=1' 'DEBUG=1 '
check_expansion 'DEBUG="1"' 'DEBUG="1" '
check_expansion "DEBUG='1'" "DEBUG='1' "
check_expansion '1' 'cd -1 '
check_expansion '"1"' '"1" '
check_expansion "'1'" "'1' "
check_expansion '\1' '\1 '
check_expansion 'echo G' 'echo | grep '
check_expansion 'DEBUG=1 1' 'DEBUG=1 cd -1 '
check_expansion 'll' 'll '
check_expansion 'echo $((1+2))' 'echo 3 '
check_expansion 'echo {a,b}' 'echo a b '
check_expansion '' ' '
print 'All globalias expansion tests passed.'
} always {
zpty -d globalias-test 2>/dev/null || true
rm -rf -- "$test_dir"
}
+1 -31
View File
@@ -5,40 +5,10 @@ Applies some fixes for some common issues encountered with [GPG's gpg-agent](htt
More specifically, this plugin: More specifically, this plugin:
- Updates the `GPG_TTY` environment variable before each shell execution. - Updates the `GPG_TTY` environment variable before each shell execution.
- Updates the `SSH_AUTH_SOCK` environment variable if `gpg-agent` is your SSH - Updates the `SSH_AUTH_SOCK` environment variable if `enable-ssh-support` is turned on.
agent. By default the plugin checks whether `enable-ssh-support` is turned
on. The [`ssh-support` setting](#settings) lets you say so yourself.
To use it, add `gpg-agent` to the plugins array of your zshrc file: To use it, add `gpg-agent` to the plugins array of your zshrc file:
```zsh ```zsh
plugins=(... gpg-agent) plugins=(... gpg-agent)
``` ```
## Settings
Every time a shell starts, the plugin runs `gpgconf --list-options gpg-agent` to
find out whether `enable-ssh-support` is turned on. That check can be slow. If
you already know the answer, state it with the `ssh-support` style and the
plugin skips the check. Set it in your zshrc, before Oh My Zsh is sourced.
If you don't use `gpg-agent` as your SSH agent:
```zsh
zstyle ':omz:plugins:gpg-agent' ssh-support no
```
The plugin then only sets `GPG_TTY`. It leaves `SSH_AUTH_SOCK` alone, and it
doesn't update the agent's tty before each command, which only SSH support
needs.
If you do use `gpg-agent` as your SSH agent:
```zsh
zstyle ':omz:plugins:gpg-agent' ssh-support yes
```
The plugin then sets `SSH_AUTH_SOCK` without checking. `enable-ssh-support`
still has to be set in your `gpg-agent.conf` for SSH to work.
Leave the style unset to keep the automatic check.
+1 -16
View File
@@ -1,16 +1,5 @@
export GPG_TTY=$TTY export GPG_TTY=$TTY
# The ssh-support style says whether gpg-agent is used as the ssh agent.
# Setting it saves asking gpgconf, which can be slow.
zstyle -t ':omz:plugins:gpg-agent' ssh-support
_gpg_agent_ssh_support=$? # 0 if yes, 1 if no, 2 if not set
# Everything below is only needed for ssh support
if (( _gpg_agent_ssh_support == 1 )); then
unset _gpg_agent_ssh_support
return
fi
# Fix for passphrase prompt on the correct tty # Fix for passphrase prompt on the correct tty
# See https://www.gnupg.org/documentation/manuals/gnupg/Agent-Options.html#option-_002d_002denable_002dssh_002dsupport # See https://www.gnupg.org/documentation/manuals/gnupg/Agent-Options.html#option-_002d_002denable_002dssh_002dsupport
function _gpg-agent_update-tty_preexec { function _gpg-agent_update-tty_preexec {
@@ -20,13 +9,9 @@ autoload -U add-zsh-hook
add-zsh-hook preexec _gpg-agent_update-tty_preexec add-zsh-hook preexec _gpg-agent_update-tty_preexec
# If enable-ssh-support is set, fix ssh agent integration # If enable-ssh-support is set, fix ssh agent integration
if (( _gpg_agent_ssh_support == 0 )) \ if [[ $(gpgconf --list-options gpg-agent 2>/dev/null | awk -F: '$1=="enable-ssh-support" {print $10}') = 1 ]]; then
|| [[ $(gpgconf --list-options gpg-agent 2>/dev/null \
| awk -F: '$1=="enable-ssh-support" {print $10}') = 1 ]]; then
unset SSH_AGENT_PID unset SSH_AGENT_PID
if [[ "${gnupg_SSH_AUTH_SOCK_by:-0}" -ne $$ ]]; then if [[ "${gnupg_SSH_AUTH_SOCK_by:-0}" -ne $$ ]]; then
export SSH_AUTH_SOCK="$(gpgconf --list-dirs agent-ssh-socket)" export SSH_AUTH_SOCK="$(gpgconf --list-dirs agent-ssh-socket)"
fi fi
fi fi
unset _gpg_agent_ssh_support
-4
View File
@@ -267,7 +267,6 @@ __gradle_subcommand() {
'-Dorg.gradle.configuration-cache.problems=[Configures how the configuration cache handles problems (fail or warn). Supported values are 'warn', or 'fail' (default).]:org.gradle.configuration cache.problems:(fail warn)' \ '-Dorg.gradle.configuration-cache.problems=[Configures how the configuration cache handles problems (fail or warn). Supported values are 'warn', or 'fail' (default).]:org.gradle.configuration cache.problems:(fail warn)' \
'-Dorg.gradle.configuration-cache.read-only=[]' \ '-Dorg.gradle.configuration-cache.read-only=[]' \
'-Dorg.gradle.configuration-cache.unsafe.ignore.unsupported-build-events-listeners=[]' \ '-Dorg.gradle.configuration-cache.unsafe.ignore.unsupported-build-events-listeners=[]' \
'-Dorg.gradle.configuration-cache.unsafe.skip-task-logging-listeners-serialization=[]' \
'-Dorg.gradle.configuration-cache=[Enables the configuration cache. Gradle will try to reuse the build configuration from previous builds.]' \ '-Dorg.gradle.configuration-cache=[Enables the configuration cache. Gradle will try to reuse the build configuration from previous builds.]' \
'-Dorg.gradle.configureondemand=[Configures necessary projects only. Gradle will attempt to reduce configuration time for large multi-project builds.]' \ '-Dorg.gradle.configureondemand=[Configures necessary projects only. Gradle will attempt to reduce configuration time for large multi-project builds.]' \
'-Dorg.gradle.console.interactive=[]' \ '-Dorg.gradle.console.interactive=[]' \
@@ -297,7 +296,6 @@ __gradle_subcommand() {
'-Dorg.gradle.jvmargs=[]' \ '-Dorg.gradle.jvmargs=[]' \
'-Dorg.gradle.logging.level=[]:org.gradle.logging.level:(quiet warn info debug)' \ '-Dorg.gradle.logging.level=[]:org.gradle.logging.level:(quiet warn info debug)' \
'-Dorg.gradle.logging.stacktrace=[]' \ '-Dorg.gradle.logging.stacktrace=[]' \
'-Dorg.gradle.mirror.maven.settings=[]' \
'-Dorg.gradle.native=[]' \ '-Dorg.gradle.native=[]' \
'-Dorg.gradle.parallel=[Builds projects in parallel. Gradle will attempt to determine the optimal number of executor threads to use.]:org.gradle.parallel:(true false)' \ '-Dorg.gradle.parallel=[Builds projects in parallel. Gradle will attempt to determine the optimal number of executor threads to use.]:org.gradle.parallel:(true false)' \
'-Dorg.gradle.priority=[Specifies the scheduling priority for the Gradle daemon and all processes launched by it. Supported values are 'normal' (default) or 'low'.]:org.gradle.priority:(normal low)' \ '-Dorg.gradle.priority=[Specifies the scheduling priority for the Gradle daemon and all processes launched by it. Supported values are 'normal' (default) or 'low'.]:org.gradle.priority:(normal low)' \
@@ -409,7 +407,6 @@ _gradle() {
'-Dorg.gradle.configuration-cache.problems=[Configures how the configuration cache handles problems (fail or warn). Supported values are 'warn', or 'fail' (default).]:org.gradle.configuration cache.problems:(fail warn):->argument-expected' \ '-Dorg.gradle.configuration-cache.problems=[Configures how the configuration cache handles problems (fail or warn). Supported values are 'warn', or 'fail' (default).]:org.gradle.configuration cache.problems:(fail warn):->argument-expected' \
'-Dorg.gradle.configuration-cache.read-only=[]:->argument-expected' \ '-Dorg.gradle.configuration-cache.read-only=[]:->argument-expected' \
'-Dorg.gradle.configuration-cache.unsafe.ignore.unsupported-build-events-listeners=[]:->argument-expected' \ '-Dorg.gradle.configuration-cache.unsafe.ignore.unsupported-build-events-listeners=[]:->argument-expected' \
'-Dorg.gradle.configuration-cache.unsafe.skip-task-logging-listeners-serialization=[]:->argument-expected' \
'-Dorg.gradle.configuration-cache=[Enables the configuration cache. Gradle will try to reuse the build configuration from previous builds.]:->argument-expected' \ '-Dorg.gradle.configuration-cache=[Enables the configuration cache. Gradle will try to reuse the build configuration from previous builds.]:->argument-expected' \
'-Dorg.gradle.configureondemand=[Configures necessary projects only. Gradle will attempt to reduce configuration time for large multi-project builds.]:->argument-expected' \ '-Dorg.gradle.configureondemand=[Configures necessary projects only. Gradle will attempt to reduce configuration time for large multi-project builds.]:->argument-expected' \
'-Dorg.gradle.console.interactive=[]:->argument-expected' \ '-Dorg.gradle.console.interactive=[]:->argument-expected' \
@@ -439,7 +436,6 @@ _gradle() {
'-Dorg.gradle.jvmargs=[]:->argument-expected' \ '-Dorg.gradle.jvmargs=[]:->argument-expected' \
'-Dorg.gradle.logging.level=[]:org.gradle.logging.level:(quiet warn info debug):->argument-expected' \ '-Dorg.gradle.logging.level=[]:org.gradle.logging.level:(quiet warn info debug):->argument-expected' \
'-Dorg.gradle.logging.stacktrace=[]:->argument-expected' \ '-Dorg.gradle.logging.stacktrace=[]:->argument-expected' \
'-Dorg.gradle.mirror.maven.settings=[]:->argument-expected' \
'-Dorg.gradle.native=[]:->argument-expected' \ '-Dorg.gradle.native=[]:->argument-expected' \
'-Dorg.gradle.parallel=[Builds projects in parallel. Gradle will attempt to determine the optimal number of executor threads to use.]:org.gradle.parallel:(true false):->argument-expected' \ '-Dorg.gradle.parallel=[Builds projects in parallel. Gradle will attempt to determine the optimal number of executor threads to use.]:org.gradle.parallel:(true false):->argument-expected' \
'-Dorg.gradle.priority=[Specifies the scheduling priority for the Gradle daemon and all processes launched by it. Supported values are 'normal' (default) or 'low'.]:org.gradle.priority:(normal low):->argument-expected' \ '-Dorg.gradle.priority=[Specifies the scheduling priority for the Gradle daemon and all processes launched by it. Supported values are 'normal' (default) or 'low'.]:org.gradle.priority:(normal low):->argument-expected' \
+2 -2
View File
@@ -11,7 +11,7 @@ else
source "$ZSH_CACHE_DIR/completions/_hasura" source "$ZSH_CACHE_DIR/completions/_hasura"
zmodload -F zsh/files b:zf_mv zmodload -F zsh/files b:zf_mv
() { () {
local TMPPREFIX="$ZSH_CACHE_DIR/completions/._hasura" local TMPPREFIX="$ZSH_CACHE_DIR/completions/_hasura"
zf_mv -f -- =( hasura completion zsh ) "$ZSH_CACHE_DIR/completions/_hasura" zf_mv -f -- =( hasura completion zsh ) "$TMPPREFIX"
} &| } &|
fi fi
+2 -2
View File
@@ -15,8 +15,8 @@ fi
zmodload -F zsh/files b:zf_mv zmodload -F zsh/files b:zf_mv
() { () {
local TMPPREFIX="$ZSH_CACHE_DIR/completions/._hcloud" local TMPPREFIX="$ZSH_CACHE_DIR/completions/_hcloud"
zf_mv -f -- =( hcloud completion zsh 2> /dev/null ) "$ZSH_CACHE_DIR/completions/_hcloud" zf_mv -f -- =( hcloud completion zsh 2> /dev/null ) "$TMPPREFIX"
} &| } &|
# Main alias # Main alias
+2 -2
View File
@@ -11,8 +11,8 @@ else
source "$ZSH_CACHE_DIR/completions/_helm" source "$ZSH_CACHE_DIR/completions/_helm"
zmodload -F zsh/files b:zf_mv zmodload -F zsh/files b:zf_mv
() { () {
local TMPPREFIX="$ZSH_CACHE_DIR/completions/._helm" local TMPPREFIX="$ZSH_CACHE_DIR/completions/_helm"
zf_mv -f -- =( helm completion zsh ) "$ZSH_CACHE_DIR/completions/_helm" zf_mv -f -- =( helm completion zsh ) "$TMPPREFIX"
} &| } &|
fi fi
+2 -2
View File
@@ -63,6 +63,6 @@ fi
zmodload -F zsh/files b:zf_mv zmodload -F zsh/files b:zf_mv
() { () {
local TMPPREFIX="$ZSH_CACHE_DIR/completions/._herdr" local TMPPREFIX="$ZSH_CACHE_DIR/completions/_herdr"
zf_mv -f -- =( herdr completion zsh < /dev/null 2> /dev/null ) "$ZSH_CACHE_DIR/completions/_herdr" zf_mv -f -- =( herdr completion zsh < /dev/null 2> /dev/null ) "$TMPPREFIX"
} &| } &|
+2 -2
View File
@@ -10,6 +10,6 @@ fi
zmodload -F zsh/files b:zf_mv zmodload -F zsh/files b:zf_mv
() { () {
local TMPPREFIX="$ZSH_CACHE_DIR/completions/._hermes" local TMPPREFIX="$ZSH_CACHE_DIR/completions/_hermes"
zf_mv -f -- =( hermes completion zsh < /dev/null 2> /dev/null ) "$ZSH_CACHE_DIR/completions/_hermes" zf_mv -f -- =( hermes completion zsh < /dev/null 2> /dev/null ) "$TMPPREFIX"
} &| } &|
+2 -2
View File
@@ -13,8 +13,8 @@ fi
zmodload -F zsh/files b:zf_mv zmodload -F zsh/files b:zf_mv
() { () {
local TMPPREFIX="$ZSH_CACHE_DIR/completions/._jj" local TMPPREFIX="$ZSH_CACHE_DIR/completions/_jj"
zf_mv -f -- =( COMPLETE=zsh jj ) "$ZSH_CACHE_DIR/completions/_jj" zf_mv -f -- =( COMPLETE=zsh jj ) "$TMPPREFIX"
} &| } &|
function __jj_prompt_jj() { function __jj_prompt_jj() {
+2 -2
View File
@@ -13,6 +13,6 @@ fi
# the actual completion file will be loaded. # the actual completion file will be loaded.
zmodload -F zsh/files b:zf_mv zmodload -F zsh/files b:zf_mv
() { () {
local TMPPREFIX="$ZSH_CACHE_DIR/completions/._k9s" local TMPPREFIX="$ZSH_CACHE_DIR/completions/_k9s"
zf_mv -f -- =( k9s completion zsh ) "$ZSH_CACHE_DIR/completions/_k9s" zf_mv -f -- =( k9s completion zsh ) "$TMPPREFIX"
} &| } &|
+2 -2
View File
@@ -13,8 +13,8 @@ fi
# Generate and load kind completion # Generate and load kind completion
zmodload -F zsh/files b:zf_mv zmodload -F zsh/files b:zf_mv
() { () {
local TMPPREFIX="$ZSH_CACHE_DIR/completions/._kind" local TMPPREFIX="$ZSH_CACHE_DIR/completions/_kind"
zf_mv -f -- =( kind completion zsh ) "$ZSH_CACHE_DIR/completions/_kind" zf_mv -f -- =( kind completion zsh ) "$TMPPREFIX"
} &| } &|
# Register aliases # Register aliases
+12 -39
View File
@@ -39,7 +39,6 @@ KUBE_PS1_HIDE_IF_NOCONTEXT="${KUBE_PS1_HIDE_IF_NOCONTEXT:-false}"
_KUBE_PS1_KUBECONFIG_CACHE="${KUBECONFIG}" _KUBE_PS1_KUBECONFIG_CACHE="${KUBECONFIG}"
_KUBE_PS1_DISABLE_PATH="${HOME}/.kube/kube-ps1/disabled" _KUBE_PS1_DISABLE_PATH="${HOME}/.kube/kube-ps1/disabled"
_KUBE_PS1_LAST_TIME=0 _KUBE_PS1_LAST_TIME=0
_KUBE_PS1_HAS_CONTEXT=false
# Determine our shell # Determine our shell
_kube_ps1_shell_type() { _kube_ps1_shell_type() {
@@ -265,21 +264,15 @@ _kube_ps1_prompt_update() {
[[ "${KUBE_PS1_ENABLED}" == "off" ]] && return $return_code [[ "${KUBE_PS1_ENABLED}" == "off" ]] && return $return_code
if ! _kube_ps1_binary_check "${KUBE_PS1_BINARY}"; then if ! _kube_ps1_binary_check "${KUBE_PS1_BINARY}"; then
# Unable to determine context availability; preserve the existing # No ability to fetch context/namespace; display N/A.
# BINARY-N/A prompt instead of treating it as no context.
KUBE_PS1_CONTEXT="BINARY-N/A" KUBE_PS1_CONTEXT="BINARY-N/A"
KUBE_PS1_NAMESPACE="N/A" KUBE_PS1_NAMESPACE="N/A"
unset _KUBE_PS1_HAS_CONTEXT
# Refresh when the binary becomes available again.
_KUBE_PS1_LAST_TIME=0
return $return_code return $return_code
fi fi
if [[ "${_KUBE_PS1_LAST_TIME}" == 0 ]] || if [[ "${KUBECONFIG}" != "${_KUBE_PS1_KUBECONFIG_CACHE}" ]]; then
[[ "${KUBECONFIG}" != "${_KUBE_PS1_KUBECONFIG_CACHE}" ]]; then # User changed KUBECONFIG; unconditionally refetch.
# Fetch initially, even if no config file exists, and whenever the _KUBE_PS1_KUBECONFIG_CACHE=${KUBECONFIG}
# user changes KUBECONFIG.
_KUBE_PS1_KUBECONFIG_CACHE="${KUBECONFIG}"
_kube_ps1_get_context_ns _kube_ps1_get_context_ns
return $return_code return $return_code
fi fi
@@ -307,30 +300,13 @@ _kube_ps1_prompt_update() {
} }
_kube_ps1_get_context() { _kube_ps1_get_context() {
local context if [[ "${KUBE_PS1_CONTEXT_ENABLE}" == true ]]; then
KUBE_PS1_CONTEXT="$(${KUBE_PS1_BINARY} config current-context 2>/dev/null)"
KUBE_PS1_CONTEXT="${KUBE_PS1_CONTEXT:-N/A}"
# Context availability must be detected even when context display is if [[ -n "${KUBE_PS1_CLUSTER_FUNCTION}" ]]; then
# disabled but KUBE_PS1_HIDE_IF_NOCONTEXT is enabled. KUBE_PS1_CONTEXT="$("${KUBE_PS1_CLUSTER_FUNCTION}" "${KUBE_PS1_CONTEXT}")"
if [[ "${KUBE_PS1_CONTEXT_ENABLE}" != true ]] && fi
[[ "${KUBE_PS1_HIDE_IF_NOCONTEXT}" != true ]]; then
KUBE_PS1_CONTEXT=
return
fi
context="$("${KUBE_PS1_BINARY}" config current-context 2>/dev/null)"
_KUBE_PS1_HAS_CONTEXT=false
[[ -n "${context}" ]] && _KUBE_PS1_HAS_CONTEXT=true
if [[ "${KUBE_PS1_CONTEXT_ENABLE}" != true ]]; then
KUBE_PS1_CONTEXT=
return
fi
KUBE_PS1_CONTEXT="${context:-N/A}"
if [[ -n "${KUBE_PS1_CLUSTER_FUNCTION}" ]]; then
KUBE_PS1_CONTEXT="$("${KUBE_PS1_CLUSTER_FUNCTION}" "${KUBE_PS1_CONTEXT}")"
fi fi
} }
@@ -349,7 +325,7 @@ _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[0] == 4 && BASH_VERSINFO[1] >= 2))); then if ((BASH_VERSINFO[0] > 4 || (BASH_VERSINFO[0] == 4 && BASH_VERSINFO[1] >= 2))); then
printf -v _KUBE_PS1_LAST_TIME '%(%s)T' -1 _KUBE_PS1_LAST_TIME=$(printf '%(%s)T')
else else
_KUBE_PS1_LAST_TIME=$(date +%s) _KUBE_PS1_LAST_TIME=$(date +%s)
fi fi
@@ -431,11 +407,8 @@ kubeoff() {
# Build our prompt # Build our prompt
kube_ps1() { kube_ps1() {
[[ "${KUBE_PS1_ENABLED}" == "off" ]] && return [[ "${KUBE_PS1_ENABLED}" == "off" ]] && return
[[ "${KUBE_PS1_HIDE_IF_NOCONTEXT}" == true ]] &&
[[ "${_KUBE_PS1_HAS_CONTEXT}" == false ]] && return
[[ -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
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}"
+2 -2
View File
@@ -12,8 +12,8 @@ fi
zmodload -F zsh/files b:zf_mv zmodload -F zsh/files b:zf_mv
() { () {
local TMPPREFIX="$ZSH_CACHE_DIR/completions/._kubectl" local TMPPREFIX="$ZSH_CACHE_DIR/completions/_kubectl"
zf_mv -f -- =( kubectl completion zsh 2> /dev/null ) "$ZSH_CACHE_DIR/completions/_kubectl" zf_mv -f -- =( kubectl completion zsh 2> /dev/null ) "$TMPPREFIX"
} &| } &|
# This command is used a LOT both below and in daily life # This command is used a LOT both below and in daily life
-15
View File
@@ -6,21 +6,6 @@ This plugin adds aliases and autocompletion for Laravel [Artisan](https://larave
plugins=(... laravel) plugins=(... laravel)
``` ```
## Settings
By default the aliases run `php artisan`. To use a different PHP command, such as
`herd php` (which runs the PHP version the [Laravel Herd](https://herd.laravel.com) site
is isolated to, instead of Herd's global version) or a specific version like `php8.4`,
set this before Oh My Zsh is sourced:
```zsh
zstyle ':omz:plugins:laravel' php 'herd php'
```
`php` in the aliases below is then replaced with that command.
## Aliases
| Alias | Description | | Alias | Description |
|:-:|:-:| |:-:|:-:|
| `artisan` | `php artisan` | | `artisan` | `php artisan` |
+39 -44
View File
@@ -1,56 +1,51 @@
#!zsh #!zsh
# Command used to run artisan, e.g. `herd php` or `php8.4` (default: `php`) alias artisan='php artisan'
zstyle -s ':omz:plugins:laravel' php _omz_laravel_php || _omz_laravel_php=php alias bob='php artisan bob::build'
alias artisan="$_omz_laravel_php artisan"
alias bob="$_omz_laravel_php artisan bob::build"
# Development # Development
alias pas="$_omz_laravel_php artisan serve" alias pas='php artisan serve'
alias pad="$_omz_laravel_php artisan dev" alias pad='php artisan dev'
alias pats="$_omz_laravel_php artisan test" alias pats='php artisan test'
# Database # Database
alias pam="$_omz_laravel_php artisan migrate" alias pam='php artisan migrate'
alias pamf="$_omz_laravel_php artisan migrate:fresh" alias pamf='php artisan migrate:fresh'
alias pamfs="$_omz_laravel_php artisan migrate:fresh --seed" alias pamfs='php artisan migrate:fresh --seed'
alias pamr="$_omz_laravel_php artisan migrate:rollback" alias pamr='php artisan migrate:rollback'
alias pads="$_omz_laravel_php artisan db:seed" alias pads='php artisan db:seed'
alias padw="$_omz_laravel_php artisan db:wipe" alias padw='php artisan db:wipe'
# Makers # Makers
alias pamm="$_omz_laravel_php artisan make:model" alias pamm='php artisan make:model'
alias pamc="$_omz_laravel_php artisan make:controller" alias pamc='php artisan make:controller'
alias pams="$_omz_laravel_php artisan make:seeder" alias pams='php artisan make:seeder'
alias pamt="$_omz_laravel_php artisan make:test" alias pamt='php artisan make:test'
alias pamfa="$_omz_laravel_php artisan make:factory" alias pamfa='php artisan make:factory'
alias pamp="$_omz_laravel_php artisan make:policy" alias pamp='php artisan make:policy'
alias pame="$_omz_laravel_php artisan make:event" alias pame='php artisan make:event'
alias pamj="$_omz_laravel_php artisan make:job" alias pamj='php artisan make:job'
alias paml="$_omz_laravel_php artisan make:listener" alias paml='php artisan make:listener'
alias pamn="$_omz_laravel_php artisan make:notification" alias pamn='php artisan make:notification'
alias pampp="$_omz_laravel_php artisan make:provider" alias pampp='php artisan make:provider'
alias pamcl="$_omz_laravel_php artisan make:class" alias pamcl='php artisan make:class'
alias pamen="$_omz_laravel_php artisan make:enum" alias pamen='php artisan make:enum'
alias pami="$_omz_laravel_php artisan make:interface" alias pami='php artisan make:interface'
alias pamtr="$_omz_laravel_php artisan make:trait" alias pamtr='php artisan make:trait'
alias pamv="$_omz_laravel_php artisan make:view" alias pamv='php artisan make:view'
alias pammig="$_omz_laravel_php artisan make:migration" alias pammig='php artisan make:migration'
# Clears # Clears
alias pacac="$_omz_laravel_php artisan cache:clear" alias pacac='php artisan cache:clear'
alias pacoc="$_omz_laravel_php artisan config:clear" alias pacoc='php artisan config:clear'
alias pavic="$_omz_laravel_php artisan view:clear" alias pavic='php artisan view:clear'
alias paroc="$_omz_laravel_php artisan route:clear" alias paroc='php artisan route:clear'
alias paopc="$_omz_laravel_php artisan optimize:clear" alias paopc='php artisan optimize:clear'
# queues # queues
alias paqf="$_omz_laravel_php artisan queue:failed" alias paqf='php artisan queue:failed'
alias paqft="$_omz_laravel_php artisan queue:failed-table" alias paqft='php artisan queue:failed-table'
alias paql="$_omz_laravel_php artisan queue:listen" alias paql='php artisan queue:listen'
alias paqr="$_omz_laravel_php artisan queue:retry" alias paqr='php artisan queue:retry'
alias paqt="$_omz_laravel_php artisan queue:table" alias paqt='php artisan queue:table'
alias paqw="$_omz_laravel_php artisan queue:work" alias paqw='php artisan queue:work'
unset _omz_laravel_php
-18
View File
@@ -1,18 +0,0 @@
# logcli plugin
This plugin adds completion for [Grafana Loki's logcli](https://grafana.com/docs/loki/latest/query/logcli/).
To use it, add `logcli` to the plugins array in your zshrc file:
```zsh
plugins=(... logcli)
```
This plugin does not add any aliases.
## Cache
This plugin caches the completion script and automatically updates it when the
plugin is loaded, which is usually when you start a new terminal emulator.
The cache is stored at `$ZSH_CACHE_DIR/completions/_logcli`.
-18
View File
@@ -1,18 +0,0 @@
# Autocompletion for Grafana Loki's CLI (logcli).
if (( ! $+commands[logcli] )); then
return
fi
# If the completion file doesn't exist yet, we need to autoload it and
# bind it to `logcli`. Otherwise, compinit will have already done that.
if [[ ! -f "$ZSH_CACHE_DIR/completions/_logcli" ]]; then
typeset -g -A _comps
autoload -Uz _logcli
_comps[logcli]=_logcli
fi
zmodload -F zsh/files b:zf_mv
() {
local TMPPREFIX="$ZSH_CACHE_DIR/completions/._logcli"
zf_mv -f -- =( logcli --completion-script-zsh ) "$ZSH_CACHE_DIR/completions/_logcli"
} &|
+2 -2
View File
@@ -12,6 +12,6 @@ fi
zmodload -F zsh/files b:zf_mv zmodload -F zsh/files b:zf_mv
() { () {
local TMPPREFIX="$ZSH_CACHE_DIR/completions/._minikube" local TMPPREFIX="$ZSH_CACHE_DIR/completions/_minikube"
zf_mv -f -- =( minikube completion zsh ) "$ZSH_CACHE_DIR/completions/_minikube" zf_mv -f -- =( minikube completion zsh ) "$TMPPREFIX"
} &| } &|
+8 -11
View File
@@ -1,5 +1,5 @@
if (( $+commands[mise] )); then if (( $+commands[mise] )); then
_mise_bin=$commands[mise] _mise_bin=mise
elif [[ -x ~/.local/bin/mise ]]; then elif [[ -x ~/.local/bin/mise ]]; then
_mise_bin=~/.local/bin/mise _mise_bin=~/.local/bin/mise
else else
@@ -8,6 +8,7 @@ fi
# Load mise hooks # Load mise hooks
eval "$($_mise_bin activate zsh)" eval "$($_mise_bin activate zsh)"
unset _mise_bin
# If the completion file doesn't exist yet, we need to autoload it and # If the completion file doesn't exist yet, we need to autoload it and
# bind it to `mise`. Otherwise, compinit will have already done that. # bind it to `mise`. Otherwise, compinit will have already done that.
@@ -17,13 +18,9 @@ if [[ ! -f "$ZSH_CACHE_DIR/completions/_mise" ]]; then
_comps[mise]=_mise _comps[mise]=_mise
fi fi
# Generate completion only when missing/empty or stale relative to the mise binary. # Generate and load mise completion
if [[ ! -s "$ZSH_CACHE_DIR/completions/_mise" || "$_mise_bin" -nt "$ZSH_CACHE_DIR/completions/_mise" ]]; then zmodload -F zsh/files b:zf_mv
zmodload -F zsh/files b:zf_mv () {
() { local TMPPREFIX="$ZSH_CACHE_DIR/completions/_mise"
local TMPPREFIX="$ZSH_CACHE_DIR/completions/._mise" zf_mv -f -- =( mise completion zsh ) "$TMPPREFIX"
zf_mv -f -- =( "$_mise_bin" completion zsh ) "$ZSH_CACHE_DIR/completions/_mise" } &|
} &|
fi
unset _mise_bin
+2 -2
View File
@@ -13,8 +13,8 @@ fi
zmodload -F zsh/files b:zf_mv zmodload -F zsh/files b:zf_mv
() { () {
local TMPPREFIX="$ZSH_CACHE_DIR/completions/._molecule" local TMPPREFIX="$ZSH_CACHE_DIR/completions/_molecule"
zf_mv -f -- =( _MOLECULE_COMPLETE=zsh_source molecule ) "$ZSH_CACHE_DIR/completions/_molecule" zf_mv -f -- =( _MOLECULE_COMPLETE=zsh_source molecule ) "$TMPPREFIX"
} &| } &|
# Alias # Alias
+2 -2
View File
@@ -13,6 +13,6 @@ fi
zmodload -F zsh/files b:zf_mv zmodload -F zsh/files b:zf_mv
() { () {
local TMPPREFIX="$ZSH_CACHE_DIR/completions/._atlas" local TMPPREFIX="$ZSH_CACHE_DIR/completions/_atlas"
zf_mv -f -- =( atlas completion zsh ) "$ZSH_CACHE_DIR/completions/_atlas" zf_mv -f -- =( atlas completion zsh ) "$TMPPREFIX"
} &| } &|
+4 -4
View File
@@ -9,8 +9,8 @@ if (( $+commands[nsc] )); then
zmodload -F zsh/files b:zf_mv zmodload -F zsh/files b:zf_mv
() { () {
local TMPPREFIX="$ZSH_CACHE_DIR/completions/._nsc" local TMPPREFIX="$ZSH_CACHE_DIR/completions/_nsc"
zf_mv -f -- =( nsc completion zsh ) "$ZSH_CACHE_DIR/completions/_nsc" zf_mv -f -- =( nsc completion zsh ) "$TMPPREFIX"
} &| } &|
fi fi
@@ -25,7 +25,7 @@ if (( $+commands[nats] )); then
zmodload -F zsh/files b:zf_mv zmodload -F zsh/files b:zf_mv
() { () {
local TMPPREFIX="$ZSH_CACHE_DIR/completions/._nats" local TMPPREFIX="$ZSH_CACHE_DIR/completions/_nats"
zf_mv -f -- =( nats --completion-script-zsh ) "$ZSH_CACHE_DIR/completions/_nats" zf_mv -f -- =( nats --completion-script-zsh ) "$TMPPREFIX"
} &| } &|
fi fi
+2 -2
View File
@@ -13,6 +13,6 @@ fi
zmodload -F zsh/files b:zf_mv zmodload -F zsh/files b:zf_mv
() { () {
local TMPPREFIX="$ZSH_CACHE_DIR/completions/._ngrok" local TMPPREFIX="$ZSH_CACHE_DIR/completions/_ngrok"
zf_mv -f -- =( ngrok completion zsh ) "$ZSH_CACHE_DIR/completions/_ngrok" zf_mv -f -- =( ngrok completion zsh ) "$TMPPREFIX"
} &| } &|
+2 -2
View File
@@ -13,6 +13,6 @@ fi
zmodload -F zsh/files b:zf_mv zmodload -F zsh/files b:zf_mv
() { () {
local TMPPREFIX="$ZSH_CACHE_DIR/completions/._pass-cli" local TMPPREFIX="$ZSH_CACHE_DIR/completions/_pass-cli"
zf_mv -f -- =( pass-cli completions zsh ) "$ZSH_CACHE_DIR/completions/_pass-cli" zf_mv -f -- =( pass-cli completions zsh ) "$TMPPREFIX"
} &| } &|
+2 -2
View File
@@ -45,8 +45,8 @@ else
zmodload -F zsh/files b:zf_mv zmodload -F zsh/files b:zf_mv
() { () {
local TMPPREFIX="$ZSH_CACHE_DIR/completions/._pipenv" local TMPPREFIX="$ZSH_CACHE_DIR/completions/_pipenv"
zf_mv -f -- =( _PIPENV_COMPLETE=zsh_source pipenv ) "$ZSH_CACHE_DIR/completions/_pipenv" zf_mv -f -- =( _PIPENV_COMPLETE=zsh_source pipenv ) "$TMPPREFIX"
} &| } &|
fi fi
+2 -2
View File
@@ -12,8 +12,8 @@ fi
zmodload -F zsh/files b:zf_mv zmodload -F zsh/files b:zf_mv
() { () {
local TMPPREFIX="$ZSH_CACHE_DIR/completions/._podman" local TMPPREFIX="$ZSH_CACHE_DIR/completions/_podman"
zf_mv -f -- =( podman completion zsh 2> /dev/null ) "$ZSH_CACHE_DIR/completions/_podman" zf_mv -f -- =( podman completion zsh 2> /dev/null ) "$TMPPREFIX"
} &| } &|
alias pbl='podman build' alias pbl='podman build'
+2 -2
View File
@@ -41,6 +41,6 @@ fi
zmodload -F zsh/files b:zf_mv zmodload -F zsh/files b:zf_mv
() { () {
local TMPPREFIX="$ZSH_CACHE_DIR/completions/._poetry" local TMPPREFIX="$ZSH_CACHE_DIR/completions/_poetry"
zf_mv -f -- =( poetry completions zsh ) "$ZSH_CACHE_DIR/completions/_poetry" zf_mv -f -- =( poetry completions zsh ) "$TMPPREFIX"
} &| } &|
+2 -2
View File
@@ -12,7 +12,7 @@ fi
zmodload -F zsh/files b:zf_mv zmodload -F zsh/files b:zf_mv
() { () {
local TMPPREFIX="$ZSH_CACHE_DIR/completions/._procs" local TMPPREFIX="$ZSH_CACHE_DIR/completions/_procs"
autoload -Uz is-at-least autoload -Uz is-at-least
local _version=$(procs --version) local _version=$(procs --version)
zf_mv -f -- =( zf_mv -f -- =(
@@ -21,5 +21,5 @@ zmodload -F zsh/files b:zf_mv
else else
procs --completion-out zsh procs --completion-out zsh
fi fi
) "$ZSH_CACHE_DIR/completions/_procs" ) "$TMPPREFIX"
} &| } &|
+2 -2
View File
@@ -12,8 +12,8 @@ fi
zmodload -F zsh/files b:zf_mv zmodload -F zsh/files b:zf_mv
() { () {
local TMPPREFIX="$ZSH_CACHE_DIR/completions/._pulumi" local TMPPREFIX="$ZSH_CACHE_DIR/completions/_pulumi"
zf_mv -f -- =( pulumi gen-completion zsh ) "$ZSH_CACHE_DIR/completions/_pulumi" zf_mv -f -- =( pulumi gen-completion zsh ) "$TMPPREFIX"
} &| } &|
# Aliases # Aliases
+1 -1
View File
@@ -29,7 +29,7 @@ function pyuserpaths() {
# Get minor release version. # Get minor release version.
# The patch version is variable length, truncate it. # The patch version is variable length, truncate it.
version=${(M)${"$($python -V 2>&1)":7}##[^.]##.[^.]##} version=${(M)${"$($python -V 2>&1)":7}#[^.]##.[^.]##}
# Add version specific path, if: # Add version specific path, if:
# - it exists in the filesystem # - it exists in the filesystem
+2 -2
View File
@@ -13,6 +13,6 @@ fi
zmodload -F zsh/files b:zf_mv zmodload -F zsh/files b:zf_mv
() { () {
local TMPPREFIX="$ZSH_CACHE_DIR/completions/._qodana" local TMPPREFIX="$ZSH_CACHE_DIR/completions/_qodana"
zf_mv -f -- =( qodana completion zsh ) "$ZSH_CACHE_DIR/completions/_qodana" zf_mv -f -- =( qodana completion zsh ) "$TMPPREFIX"
} &| } &|
-2
View File
@@ -3,8 +3,6 @@
The primary job of this plugin is to provide `rbenv_prompt_info` which can be added to your theme to include Ruby The primary job of this plugin is to provide `rbenv_prompt_info` which can be added to your theme to include Ruby
version and gemset information into your prompt. version and gemset information into your prompt.
Additionally, this plugin provides completion for the `rbenv` command. See also <https://github.com/rbenv/rbenv/#shell-completions>.
Some functionality of this plugin will not work unless you also have the rbenv plugin *gemset* installed. Some functionality of this plugin will not work unless you also have the rbenv plugin *gemset* installed.
https://github.com/jf/rbenv-gemset https://github.com/jf/rbenv-gemset
+1 -8
View File
@@ -24,13 +24,6 @@ if [[ $FOUND_RBENV -ne 1 ]]; then
fi fi
if [[ $FOUND_RBENV -eq 1 ]]; then if [[ $FOUND_RBENV -eq 1 ]]; then
rbenv_completions="${commands[rbenv]:A:h:h}/completions"
if [[ -f "$rbenv_completions/_rbenv" ]]; then
fpath+=("$rbenv_completions")
autoload -Uz _rbenv
compdef _rbenv rbenv
fi
eval "$(rbenv init --no-rehash - zsh)" eval "$(rbenv init --no-rehash - zsh)"
alias rubies="rbenv versions" alias rubies="rbenv versions"
@@ -72,4 +65,4 @@ else
} }
fi fi
unset FOUND_RBENV rbenvdirs dir rbenv_completions unset FOUND_RBENV rbenvdirs dir
+2 -2
View File
@@ -12,8 +12,8 @@ fi
zmodload -F zsh/files b:zf_mv zmodload -F zsh/files b:zf_mv
() { () {
local TMPPREFIX="$ZSH_CACHE_DIR/completions/._rbw" local TMPPREFIX="$ZSH_CACHE_DIR/completions/_rbw"
zf_mv -f -- =( rbw gen-completions zsh ) "$ZSH_CACHE_DIR/completions/_rbw" zf_mv -f -- =( rbw gen-completions zsh ) "$TMPPREFIX"
} &| } &|
# rbwpw function copies the password of a service to the clipboard # rbwpw function copies the password of a service to the clipboard
+2 -2
View File
@@ -13,6 +13,6 @@ fi
zmodload -F zsh/files b:zf_mv zmodload -F zsh/files b:zf_mv
() { () {
local TMPPREFIX="$ZSH_CACHE_DIR/completions/._rclone" local TMPPREFIX="$ZSH_CACHE_DIR/completions/_rclone"
zf_mv -f -- =( rclone completion zsh - ) "$ZSH_CACHE_DIR/completions/_rclone" zf_mv -f -- =( rclone completion zsh - ) "$TMPPREFIX"
} &| } &|
+2 -2
View File
@@ -14,9 +14,9 @@ plugins=(... ruby)
| ------- | -------------------------------------- | ---------------------------------------------------- | | ------- | -------------------------------------- | ---------------------------------------------------- |
| rb | `ruby` | The Ruby command | | rb | `ruby` | The Ruby command |
| sgem | `sudo gem` | Run sudo gem on the system ruby, not the active ruby | | sgem | `sudo gem` | Run sudo gem on the system ruby, not the active ruby |
| rfind | `find . -name "*.rb" -print0 \| xargs -0 grep -n` | Find ruby file | | rfind | `find . -name "*.rb" \| xargs grep -n` | Find ruby file |
| rrun | `ruby -e` | Execute some code: E.g: `rrun "puts 'Hello world!'"` | | rrun | `ruby -e` | Execute some code: E.g: `rrun "puts 'Hello world!'"` |
| rserver | `ruby -run -e httpd . -p 8080` | Start HTTP Webrick serving local directory/files | | rserver | `ruby -e httpd . -p 8080` | Start HTTP Webrick serving local directory/files |
| gein | `gem install` | Install a gem into the local repository | | gein | `gem install` | Install a gem into the local repository |
| geun | `gem uninstall` | Uninstall gems from the local repository | | geun | `gem uninstall` | Uninstall gems from the local repository |
| geli | `gem list` | Display gems installed locally | | geli | `gem list` | Display gems installed locally |
+1 -1
View File
@@ -2,7 +2,7 @@
alias sgem='sudo gem' alias sgem='sudo gem'
# Find ruby file # Find ruby file
alias rfind='find . -name "*.rb" -print0 | xargs -0 grep -n' alias rfind='find . -name "*.rb" | xargs grep -n'
# Shorthand Ruby # Shorthand Ruby
alias rb="ruby" alias rb="ruby"
-32
View File
@@ -1,32 +0,0 @@
#!/usr/bin/env zsh
emulate -LR zsh
source "${1:-${0:A:h:h}/ruby.plugin.zsh}"
test_dir=$(mktemp -d) || exit 1
trap 'command rm -rf -- "$test_dir"' EXIT
typeset -i failures=0 tests=0
typeset filename output
for filename in plain.rb 'file with spaces.rb' "single'quote.rb" 'double"quote.rb' $'line\nbreak.rb' 'unicode-ą.rb'; do
print -r -- 'needle' >| "$test_dir/$filename"
output=$(cd "$test_dir" && rfind needle 2> "$test_dir/stderr")
actual_status=$?
(( tests++ ))
if [[ $actual_status == 0 && $output == '1:needle' && ! -s "$test_dir/stderr" ]]; then
print -r -- "PASS: ${(qqq)filename}"
else
print -u2 -r -- "FAIL: ${(qqq)filename} (status $actual_status)"
print -u2 -r -- " stdout: ${(qqq)output}"
print -u2 -r -- " stderr: $(<"$test_dir/stderr")"
(( failures++ ))
fi
command rm -- "$test_dir/$filename"
done
print -r -- "$tests tests, $failures failures"
(( failures == 0 ))
+2 -2
View File
@@ -22,6 +22,6 @@ fi
# Overwrites the file each time as completions might change with ruff versions. # Overwrites the file each time as completions might change with ruff versions.
zmodload -F zsh/files b:zf_mv zmodload -F zsh/files b:zf_mv
() { () {
local TMPPREFIX="$ZSH_CACHE_DIR/completions/._ruff" local TMPPREFIX="$ZSH_CACHE_DIR/completions/_ruff"
zf_mv -f -- =( ruff generate-shell-completion zsh ) "$ZSH_CACHE_DIR/completions/_ruff" zf_mv -f -- =( ruff generate-shell-completion zsh ) "$TMPPREFIX"
} &| } &|
+2 -2
View File
@@ -21,8 +21,8 @@ fi
# Generate completion files in the background # Generate completion files in the background
zmodload -F zsh/files b:zf_mv zmodload -F zsh/files b:zf_mv
() { () {
local TMPPREFIX="$ZSH_CACHE_DIR/completions/._rustup" local TMPPREFIX="$ZSH_CACHE_DIR/completions/_rustup"
zf_mv -f -- =( rustup completions zsh ) "$ZSH_CACHE_DIR/completions/_rustup" zf_mv -f -- =( rustup completions zsh ) "$TMPPREFIX"
} &| } &|
cat >| "$ZSH_CACHE_DIR/completions/_cargo" <<'EOF' cat >| "$ZSH_CACHE_DIR/completions/_cargo" <<'EOF'
#compdef cargo #compdef cargo
+2 -2
View File
@@ -14,8 +14,8 @@ function install_autocompletion {
zmodload -F zsh/files b:zf_mv zmodload -F zsh/files b:zf_mv
() { () {
local TMPPREFIX="$ZSH_CACHE_DIR/completions/._$1" local TMPPREFIX="$ZSH_CACHE_DIR/completions/_$1"
zf_mv -f -- =( $1 completion zsh ) "$ZSH_CACHE_DIR/completions/_$1" zf_mv -f -- =( $1 completion zsh ) "$TMPPREFIX"
} "$1" &| } "$1" &|
} }
+2 -2
View File
@@ -13,6 +13,6 @@ fi
zmodload -F zsh/files b:zf_mv zmodload -F zsh/files b:zf_mv
() { () {
local TMPPREFIX="$ZSH_CACHE_DIR/completions/._skaffold" local TMPPREFIX="$ZSH_CACHE_DIR/completions/_skaffold"
zf_mv -f -- =( skaffold completion zsh ) "$ZSH_CACHE_DIR/completions/_skaffold" zf_mv -f -- =( skaffold completion zsh ) "$TMPPREFIX"
} &| } &|
-3
View File
@@ -1,3 +0,0 @@
## Sops Plugin
This plugin sets up completion for [sops](https://getsops.io).
-18
View File
@@ -1,18 +0,0 @@
# COMPLETION FUNCTION
if (( ! $+commands[sops] )); then
return
fi
# If the completion file doesn't exist yet, we need to autoload it and
# bind it to `sops`. Otherwise, compinit will have already done that.
if [[ ! -f "$ZSH_CACHE_DIR/completions/_sops" ]]; then
typeset -g -A _comps
autoload -Uz _sops
_comps[sops]=_sops
fi
zmodload -F zsh/files b:zf_mv
() {
local TMPPREFIX="$ZSH_CACHE_DIR/completions/._sops"
zf_mv -f -- =( sops completion zsh ) "$ZSH_CACHE_DIR/completions/_sops"
} &|
+2 -2
View File
@@ -12,6 +12,6 @@ fi
zmodload -F zsh/files b:zf_mv zmodload -F zsh/files b:zf_mv
() { () {
local TMPPREFIX="$ZSH_CACHE_DIR/completions/._stripe" local TMPPREFIX="$ZSH_CACHE_DIR/completions/_stripe"
zf_mv -f -- =( stripe completion --shell zsh --write-to-stdout ) "$ZSH_CACHE_DIR/completions/_stripe" zf_mv -f -- =( stripe completion --shell zsh --write-to-stdout ) "$TMPPREFIX"
} &| } &|
+2 -2
View File
@@ -24,6 +24,6 @@ fi
zmodload -F zsh/files b:zf_mv zmodload -F zsh/files b:zf_mv
() { () {
local TMPPREFIX="$ZSH_CACHE_DIR/completions/._tailscale" local TMPPREFIX="$ZSH_CACHE_DIR/completions/_tailscale"
zf_mv -f -- =( tailscale completion zsh ) "$ZSH_CACHE_DIR/completions/_tailscale" zf_mv -f -- =( tailscale completion zsh ) "$TMPPREFIX"
} &| } &|
+2 -2
View File
@@ -13,6 +13,6 @@ fi
# Generate and load task completion # Generate and load task completion
zmodload -F zsh/files b:zf_mv zmodload -F zsh/files b:zf_mv
() { () {
local TMPPREFIX="$ZSH_CACHE_DIR/completions/._task" local TMPPREFIX="$ZSH_CACHE_DIR/completions/_task"
zf_mv -f -- =( task --completion zsh ) "$ZSH_CACHE_DIR/completions/_task" zf_mv -f -- =( task --completion zsh ) "$TMPPREFIX"
} &| } &|
+2 -2
View File
@@ -13,6 +13,6 @@ fi
zmodload -F zsh/files b:zf_mv zmodload -F zsh/files b:zf_mv
() { () {
local TMPPREFIX="$ZSH_CACHE_DIR/completions/._timoni" local TMPPREFIX="$ZSH_CACHE_DIR/completions/_timoni"
zf_mv -f -- =( timoni completion zsh ) "$ZSH_CACHE_DIR/completions/_timoni" zf_mv -f -- =( timoni completion zsh ) "$TMPPREFIX"
} &| } &|
+1 -1
View File
@@ -52,7 +52,7 @@ The plugin will generate a default archive filename based on the input:
| Format | Description | Tool Used | | Format | Description | Tool Used |
|:-----------------|:-------------------------------|:-----------------| |:-----------------|:-------------------------------|:-----------------|
| `7z` | 7zip archive | `7zz`,`7z`,`7za` | | `7z` | 7zip archive | `7z` |
| `bz2` | Bzip2-compressed file | `bzip2` | | `bz2` | Bzip2-compressed file | `bzip2` |
| `gz` | Gzip-compressed file | `gzip` | | `gz` | Gzip-compressed file | `gzip` |
| `lzma` | LZMA-compressed file | `lzma` | | `lzma` | LZMA-compressed file | `lzma` |
@@ -49,17 +49,7 @@ tlz (tar.lzma), txz (tar.xz), tZ (tar.Z), xz, Z, zip, and zst."
fi fi
case "$ext" in case "$ext" in
7z) 7z) 7z u "${output}" "${@}" ;;
if (( $+commands[7zz] )); then
7zz u "${output}" "${@}"
elif (( $+commands[7z] )); then
7z u "${output}" "${@}"
elif (( $+commands[7za] )); then
7za u "${output}" "${@}"
else
echo "ua: cannot create 7z files: install 7zz, 7z or 7za" >&2
return 1
fi ;;
bz2) bzip2 -vcf "${@}" > "${output}" ;; bz2) bzip2 -vcf "${@}" > "${output}" ;;
gz) gzip -vcf "${@}" > "${output}" ;; gz) gzip -vcf "${@}" > "${output}" ;;
lzma) lzma -vc -T0 "${@}" > "${output}" ;; lzma) lzma -vc -T0 "${@}" > "${output}" ;;
+4 -4
View File
@@ -45,10 +45,10 @@ fi
# Overwrites the file each time as completions might change with uv versions. # Overwrites the file each time as completions might change with uv versions.
zmodload -F zsh/files b:zf_mv zmodload -F zsh/files b:zf_mv
() { () {
local TMPPREFIX="$ZSH_CACHE_DIR/completions/._uv" local TMPPREFIX="$ZSH_CACHE_DIR/completions/_uv"
zf_mv -f -- =( uv generate-shell-completion zsh ) "$ZSH_CACHE_DIR/completions/_uv" zf_mv -f -- =( uv generate-shell-completion zsh ) "$TMPPREFIX"
} &| } &|
() { () {
local TMPPREFIX="$ZSH_CACHE_DIR/completions/._uvx" local TMPPREFIX="$ZSH_CACHE_DIR/completions/_uvx"
zf_mv -f -- =( uvx --generate-shell-completion zsh ) "$ZSH_CACHE_DIR/completions/_uvx" zf_mv -f -- =( uvx --generate-shell-completion zsh ) "$TMPPREFIX"
} &| } &|
+2 -2
View File
@@ -13,6 +13,6 @@ fi
zmodload -F zsh/files b:zf_mv zmodload -F zsh/files b:zf_mv
() { () {
local TMPPREFIX="$ZSH_CACHE_DIR/completions/._volta" local TMPPREFIX="$ZSH_CACHE_DIR/completions/_volta"
zf_mv -f -- =( volta completions zsh ) "$ZSH_CACHE_DIR/completions/_volta" zf_mv -f -- =( volta completions zsh ) "$TMPPREFIX"
} &| } &|
+1 -12
View File
@@ -38,17 +38,6 @@ Zsh-z is a drop-in replacement for `rupa/z` and will, by default, use the same d
## News ## News
### v2.0.1 (October 1, 2026)
- **Database writes now work with `setopt NO_CLOBBER`.** Under `NO_CLOBBER`,
every database write could fail with `can't clobber parameter tmpfd containing
file descriptor 0`, even when the database already existed. That error no longer
occurs ([#81](https://github.com/agkozak/zsh-z/issues/81)).
- **Database and lockfile creation now works with `setopt NO_CLOBBER`.** With
`NO_CLOBBER` set and `APPEND_CREATE` unset, Zsh-z could not create a missing
database or lockfile. It now creates them without changing your shell options or
losing existing directory history ([#105](https://github.com/agkozak/zsh-z/issues/105)).
### v2.0 (August 14, 2026) ### v2.0 (August 14, 2026)
Version **2.0** is a major step forward, and these are the changes most worth knowing about: Version **2.0** is a major step forward, and these are the changes most worth knowing about:
@@ -58,7 +47,7 @@ Version **2.0** is a major step forward, and these are the changes most worth kn
- **Safer, crash-resistant concurrent writes.** Writes are now guarded by a dedicated, stable lockfile using `zsh/system` file locking, with a bounded wait for lock acquisition (the new [`ZSHZ_LOCK_TIMEOUT`](#settings), default `1` second). Write errors are handled gracefully, and locks are always released even if a write is interrupted. On Cygwin and MSYS2 a write is also retried briefly if Windows refuses it: a virus scanner or the search indexer that opens the database in the instant between its being written and its being moved into place makes the move fail, which used to lose that one directory silently. Zsh-z now retries the move briefly. - **Safer, crash-resistant concurrent writes.** Writes are now guarded by a dedicated, stable lockfile using `zsh/system` file locking, with a bounded wait for lock acquisition (the new [`ZSHZ_LOCK_TIMEOUT`](#settings), default `1` second). Write errors are handled gracefully, and locks are always released even if a write is interrupted. On Cygwin and MSYS2 a write is also retried briefly if Windows refuses it: a virus scanner or the search indexer that opens the database in the instant between its being written and its being moved into place makes the move fail, which used to lose that one directory silently. Zsh-z now retries the move briefly.
- **Your database file now has `600` permissions** -- readable and writable only by you -- so that other users on a shared system cannot read your directory history ([#92](https://github.com/agkozak/zsh-z/issues/92)). On Zsh 5+ this uses the in-process `zf_chmod` builtin; on Zsh 4.3.11 it uses a `umask`-in-a-subshell technique that avoids the fork-and-exec of an external `chmod`. - **Your database file now has `600` permissions** -- readable and writable only by you -- so that other users on a shared system cannot read your directory history ([#92](https://github.com/agkozak/zsh-z/issues/92)). On Zsh 5+ this uses the in-process `zf_chmod` builtin; on Zsh 4.3.11 it uses a `umask`-in-a-subshell technique that avoids the fork-and-exec of an external `chmod`.
- **`COMPLETE_ALIASES` works automatically in normal setups.** Tab completion no longer breaks when you have `setopt COMPLETE_ALIASES` enabled. Zsh-z registers the alias automatically on the first Tab press, so the manual `compdef` line that earlier versions required is no longer necessary. [See below](#complete_aliases). - **`COMPLETE_ALIASES` works automatically in normal setups.** Tab completion no longer breaks when you have `setopt COMPLETE_ALIASES` enabled. Zsh-z registers the alias automatically on the first Tab press, so the manual `compdef` line that earlier versions required is no longer necessary. [See below](#complete_aliases).
- **Fixed a `can't clobber parameter tmpfd` error on some Zsh builds.** On certain Zsh builds, every database write could fail with `can't clobber parameter tmpfd containing file descriptor 0`, leaving an error at each new prompt ([#81](https://github.com/agkozak/zsh-z/issues/81)). *Correction:* the error occurs under `setopt NO_CLOBBER`, and the v2.0 change did not fix it there; v2.0.1 does. - **Fixed a `can't clobber parameter tmpfd` error on some Zsh builds.** On certain Zsh builds, every database write could fail with `can't clobber parameter tmpfd containing file descriptor 0`, leaving an error at each new prompt. The file descriptor used for the temporary database file is now held in an unset scalar rather than one seeded with `0`, so the write never trips Zsh's file-descriptor-clobber guard ([#81](https://github.com/agkozak/zsh-z/issues/81)).
- **A misconfigured database file no longer closes your shell -- or nags you at every prompt.** When `ZSHZ_DATA` points at a directory, or names a file without a directory, Zsh-z now reports the problem and returns instead of calling `exit`. The per-prompt `--add` stays quiet about it, so you are told once, when you actually run `z`, rather than at every prompt ([#103](https://github.com/agkozak/zsh-z/issues/103); props @ahjota). - **A misconfigured database file no longer closes your shell -- or nags you at every prompt.** When `ZSHZ_DATA` points at a directory, or names a file without a directory, Zsh-z now reports the problem and returns instead of calling `exit`. The per-prompt `--add` stays quiet about it, so you are told once, when you actually run `z`, rather than at every prompt ([#103](https://github.com/agkozak/zsh-z/issues/103); props @ahjota).
- **`z -x` can now remove the entry for a directory that no longer exists -- and can no longer crash Zsh 4.3.11.** The removal target used to have to exist on disk, so a database entry whose directory had been deleted -- exactly the entry you most want gone -- could not be removed. `z -x /deleted/dir` (and `z -xR`) now canonicalizes the argument without requiring it to exist, resolving symlinks in as much of the path as is still present. The same change fixes a crash on Zsh 4.3.11, where an upstream bug makes `${x:A}` segfault when the top-level component of the path is missing: `z -x /gone/sub` -- or a `ZSHZ_DATA` pointing into a missing top-level directory -- could kill the shell there. - **`z -x` can now remove the entry for a directory that no longer exists -- and can no longer crash Zsh 4.3.11.** The removal target used to have to exist on disk, so a database entry whose directory had been deleted -- exactly the entry you most want gone -- could not be removed. `z -x /deleted/dir` (and `z -xR`) now canonicalizes the argument without requiring it to exist, resolving symlinks in as much of the path as is still present. The same change fixes a crash on Zsh 4.3.11, where an upstream bug makes `${x:A}` segfault when the top-level component of the path is missing: `z -x /gone/sub` -- or a `ZSHZ_DATA` pointing into a missing top-level directory -- could kill the shell there.
- **More robust startup and operation.** A version check on an unsupported Zsh no longer risks exiting your interactive shell. - **More robust startup and operation.** A version check on an unsupported Zsh no longer risks exiting your interactive shell.
+13 -14
View File
@@ -371,17 +371,16 @@ zshz() {
# before the lock is taken, and on Cygwin/MSYS2 a concurrent writer's rename # before the lock is taken, and on Cygwin/MSYS2 a concurrent writer's rename
# passes through a window in which the datafile is unlinked or delete- # passes through a window in which the datafile is unlinked or delete-
# pending, so any second syscall on the path (chmod) -- or even the creating # pending, so any second syscall on the path (chmod) -- or even the creating
# open itself -- can fail spuriously. Forced append redirection (>>|) creates # open itself -- can fail spuriously. Append mode (>>) creates the file
# the file even under NO_CLOBBER with APPEND_CREATE disabled, without # without truncating one that a concurrent writer has just renamed into
# truncating one that a concurrent writer has just renamed into place. # place. The first attempt is silent; if the file still does not exist
# The first attempt is silent; if the file still does not exist
# afterward (so no concurrent writer supplied it), retry loudly so that real # afterward (so no concurrent writer supplied it), retry loudly so that real
# failures (directory permissions, read-only filesystem) reach the user. # failures (directory permissions, read-only filesystem) reach the user.
[[ -f $datafile ]] || { [[ -f $datafile ]] || {
mkdir -p "${datafile:h}" && mkdir -p "${datafile:h}" &&
( umask 077; : >>| "$datafile" ) 2> /dev/null || ( umask 077; : >> "$datafile" ) 2> /dev/null ||
[[ -f $datafile ]] || [[ -f $datafile ]] ||
( umask 077; : >>| "$datafile" ) ( umask 077; : >> "$datafile" )
# When $ZSHZ_OWNER is set (e.g. under `sudo -s'), hand the freshly created # When $ZSHZ_OWNER is set (e.g. under `sudo -s'), hand the freshly created
# file off to that user immediately, so a query-only invocation can't leave # file off to that user immediately, so a query-only invocation can't leave
# behind a root-owned .z that the normal-user shell can't read. `-h' so a # behind a root-owned .z that the normal-user shell can't read. `-h' so a
@@ -526,14 +525,14 @@ zshz() {
# two-inodes race the stable lockfile exists to prevent. # two-inodes race the stable lockfile exists to prevent.
# Under $ZSHZ_OWNER all of this runs with root's authority on a path the # Under $ZSHZ_OWNER all of this runs with root's authority on a path the
# unprivileged owner controls, and every step follows a symlink: `-f' # unprivileged owner controls, and every step follows a symlink: `-f'
# tests the target, `>>|' creates a dangling one, and flock opens it. # tests the target, `>>' creates a dangling one, and flock opens it.
# $datafile survives a planted link only because the `mv' below replaces # $datafile survives a planted link only because the `mv' below replaces
# it outright; the lockfile is deliberately never removed, so a symlink # it outright; the lockfile is deliberately never removed, so a symlink
# here would persist and be acted on at every subsequent write. Refuse. # here would persist and be acted on at every subsequent write. Refuse.
local _lock_owner=${ZSHZ_OWNER:-${_Z_OWNER}} local _lock_owner=${ZSHZ_OWNER:-${_Z_OWNER}}
[[ -n $_lock_owner && -L $lockfile ]] && return 1 [[ -n $_lock_owner && -L $lockfile ]] && return 1
if [[ ! -f $lockfile ]]; then if [[ ! -f $lockfile ]]; then
( umask 077; : >>| "$lockfile" ) 2> /dev/null ( umask 077; : >> "$lockfile" ) 2> /dev/null
[[ -n $_lock_owner ]] && [[ -n $_lock_owner ]] &&
${ZSHZ[CHOWN]} -h "${_lock_owner}:$(id -ng "${_lock_owner}")" "$lockfile" ${ZSHZ[CHOWN]} -h "${_lock_owner}:$(id -ng "${_lock_owner}")" "$lockfile"
fi fi
@@ -586,13 +585,13 @@ zshz() {
# Discard entries that are incomplete or incorrectly formatted # Discard entries that are incomplete or incorrectly formatted
lines=( ${(M)lines:#/*\|[[:digit:]]##[.,]#[[:digit:]]#\|[[:digit:]]##} ) lines=( ${(M)lines:#/*\|[[:digit:]]##[.,]#[[:digit:]]#\|[[:digit:]]##} )
# Explicitly unset the local scalar before allocating a file descriptor. # Hold the fd in an *unset* scalar, not `integer tmpfd' (which seeds it
# Under NO_CLOBBER, even an empty scalar can be treated as fd 0 (stdin), # with 0). On some Zsh builds, `exec {tmpfd}>|...' refuses to clobber a
# causing `exec {tmpfd}>|...' to refuse to overwrite it. The `>|' only # parameter already holding a number that names an open fd -- and 0 is
# overrides file clobber protection, not the descriptor parameter check. # stdin, always open -- yielding "can't clobber parameter tmpfd
# See https://github.com/agkozak/zsh-z/issues/81 # containing file descriptor 0". An empty scalar isn't a valid fd, so
# the guard never fires. See https://github.com/agkozak/zsh-z/issues/81
local tmpfd local tmpfd
unset tmpfd
case $action in case $action in
--add) --add)
# When zf_chmod isn't available (Zsh 4.3.11), avoid the # When zf_chmod isn't available (Zsh 4.3.11), avoid the
@@ -1240,14 +1240,9 @@ _zsh_highlight_main_highlighter_check_path()
fi fi
tmp_path=$tmp_path:a tmp_path=$tmp_path:a
local candidate_new_tmp_path
while [[ $tmp_path != / ]]; do while [[ $tmp_path != / ]]; do
[[ -n ${(M)ZSH_HIGHLIGHT_DIRS_BLACKLIST:#$tmp_path} ]] && return 1 [[ -n ${(M)ZSH_HIGHLIGHT_DIRS_BLACKLIST:#$tmp_path} ]] && return 1
candidate_new_tmp_path=${tmp_path:h} tmp_path=$tmp_path:h
if [[ $candidate_new_tmp_path == $tmp_path ]]; then
break
fi
tmp_path=${candidate_new_tmp_path}
done done
if (( in_command_position )); then if (( in_command_position )); then
+1 -4
View File
@@ -274,14 +274,11 @@ function handle_update() {
# Ask for confirmation and only update on 'y', 'Y' or Enter # Ask for confirmation and only update on 'y', 'Y' or Enter
# Otherwise just show a reminder for how to update # Otherwise just show a reminder for how to update
# ㅛ (U+315B) is the character produced at the Y key position on the Korean
# Dubeolsik layout, so it is accepted too to avoid cancelling the update
# when a Korean IME is active.
printf "[oh-my-zsh] Would you like to update? [Y/n] " printf "[oh-my-zsh] Would you like to update? [Y/n] "
read -r -k 1 option read -r -k 1 option
[[ "$option" = $'\n' ]] || echo [[ "$option" = $'\n' ]] || echo
case "$option" in case "$option" in
[yY$'\n']|$'ㅛ') update_ohmyzsh ;; [yY$'\n']) update_ohmyzsh ;;
[nN]) update_last_updated_file ;& [nN]) update_last_updated_file ;&
*) echo "[oh-my-zsh] You can update manually by running \`omz update\`" ;; *) echo "[oh-my-zsh] You can update manually by running \`omz update\`" ;;
esac esac