7 Commits

Author SHA1 Message Date
copilot-swe-agent[bot]
78c871176f Fix plugin-manager integration script reliability
Co-authored-by: mcornella <1441704+mcornella@users.noreply.github.com>
2026-08-17 21:45:07 +00:00
copilot-swe-agent[bot]
1595e00f7c Add bootstrap CI coverage and smoke matrix
Co-authored-by: mcornella <1441704+mcornella@users.noreply.github.com>
2026-08-17 21:41:31 +00:00
copilot-swe-agent[bot]
eb62826522 docs: add plugin manager entrypoint injection notes
Co-authored-by: mcornella <1441704+mcornella@users.noreply.github.com>
2026-08-17 09:12:38 +00:00
copilot-swe-agent[bot]
c15b32baa4 docs: add plugin-manager bootstrap hook guidance
Co-authored-by: mcornella <1441704+mcornella@users.noreply.github.com>
2026-08-17 07:48:08 +00:00
copilot-swe-agent[bot]
ffd4c95a4f feat(core): add shared bootstrap entrypoint for plugin managers
Co-authored-by: mcornella <1441704+mcornella@users.noreply.github.com>
2026-08-17 07:17:47 +00:00
copilot-swe-agent[bot]
4cdd45338c fix(docker): create completions cache directory when plugin loads
Co-authored-by: mcornella <1441704+mcornella@users.noreply.github.com>
2026-08-17 06:16:18 +00:00
copilot-swe-agent[bot]
8e5be2cb3a Initial plan 2026-08-17 06:15:20 +00:00
59 changed files with 558 additions and 298 deletions

View File

@@ -41,3 +41,49 @@ jobs:
./themes/*.zsh-theme; do ./themes/*.zsh-theme; do
zsh -n "$file" || return 1 zsh -n "$file" || return 1
done done
- name: Focused syntax check for bootstrap-adjacent touched files
if: github.event_name == 'pull_request'
run: |
mapfile -t touched < <(
git diff --name-only "${{ github.event.pull_request.base.sha }}" "${{ github.sha }}" \
| grep -E '^(lib/bootstrap\.zsh|lib/tests/bootstrap.*\.zsh|oh-my-zsh\.sh|lib/(completion|compfix|functions|theme-and-appearance)\.zsh|plugins/.+/.+\.plugin\.zsh|themes/.+\.zsh-theme)$' \
|| true
)
if [ "${#touched[@]}" -eq 0 ]; then
echo "No bootstrap-adjacent files touched"
exit 0
fi
for file in "${touched[@]}"; do
echo "Syntax checking $file"
zsh -n "$file"
done
- name: Run bootstrap unit test
if: github.event_name == 'pull_request'
run: zsh ./lib/tests/bootstrap.test.zsh
- name: Run inline bootstrap invariants smoke test
if: github.event_name == 'pull_request'
run: zsh ./lib/tests/bootstrap-inline-ci.test.zsh
plugin-manager-smoke:
name: Plugin manager smoke (${{ matrix.manager }}:${{ matrix.scenario }})
runs-on: ubuntu-latest
if: github.repository == 'ohmyzsh/ohmyzsh' && github.event_name == 'pull_request'
strategy:
fail-fast: false
matrix:
manager: [antigen, zinit]
scenario: [positive, negative]
steps:
- name: Set up git repository
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Install zsh
run: sudo apt-get update; sudo apt-get install zsh
- name: Run plugin-manager bootstrap integration
run: zsh ./lib/tests/plugin-manager-bootstrap-integration.test.zsh "${{ matrix.manager }}" "${{ matrix.scenario }}"

View File

@@ -0,0 +1,37 @@
name: Plugin manager integration (advisory)
on:
schedule:
- cron: '0 6 * * *'
workflow_dispatch:
permissions:
contents: read
jobs:
plugin-manager-matrix:
name: ${{ matrix.manager }}:${{ matrix.scenario }}
runs-on: ubuntu-latest
if: github.repository == 'ohmyzsh/ohmyzsh'
continue-on-error: true
strategy:
fail-fast: false
matrix:
manager: [antigen, zinit, zgen, zplug, antibody, zulu]
scenario: [positive, negative]
steps:
- name: Set up git repository
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Install zsh and go
run: sudo apt-get update; sudo apt-get install zsh golang
- name: Run plugin-manager bootstrap integration
run: zsh ./lib/tests/plugin-manager-bootstrap-integration.test.zsh "${{ matrix.manager }}" "${{ matrix.scenario }}"
- name: Rollout note
if: always()
run: |
echo "Phase 2 active: full manager matrix is advisory/nightly."
echo "Phase 3 target: promote full matrix to required after stability window."

View File

@@ -23,6 +23,7 @@ you would make is not already covered.
- [A note on AI-assisted contributions](#a-note-on-ai-assisted-contributions) - [A note on AI-assisted contributions](#a-note-on-ai-assisted-contributions)
- [Use the Search, Luke](#use-the-search-luke) - [Use the Search, Luke](#use-the-search-luke)
- [Commit Guidelines](#commit-guidelines) - [Commit Guidelines](#commit-guidelines)
- [Plugin And Theme Bootstrap Compatibility](#plugin-and-theme-bootstrap-compatibility)
- [Format](#format) - [Format](#format)
- [Style](#style) - [Style](#style)
- [Volunteer](#volunteer) - [Volunteer](#volunteer)
@@ -176,6 +177,24 @@ specification. The automatic changelog tool uses these to automatically generate
a changelog based on the commit messages. Here's a guide to writing a commit message a changelog based on the commit messages. Here's a guide to writing a commit message
to allow this: to allow this:
### Plugin And Theme Bootstrap Compatibility
Oh My Zsh now provides a shared bootstrap entrypoint at `lib/bootstrap.zsh` for plugin-manager setups that don't
source `oh-my-zsh.sh`.
When working on plugins/themes:
- assume bootstrap has already run in manager-driven setups
- rely on bootstrap guarantees (`ZSH*` defaults, cache/completions setup, required `fpath` entries)
- avoid adding per-plugin/per-theme copies of common setup unless truly plugin-specific
Common patterns we should migrate away from over time:
- repeated cache setup logic (`mkdir -p "$ZSH_CACHE_DIR/completions"`)
- repeated base `fpath` bootstrapping for OMZ core/custom directories
If your plugin/theme still needs custom initialization, keep it scoped to that plugin/theme behavior only.
### Format ### Format
``` ```

115
README.md
View File

@@ -46,6 +46,7 @@ Twitter), and join us on [Discord](https://discord.gg/ohmyzsh).
- [Manual Installation](#manual-installation) - [Manual Installation](#manual-installation)
- [Installation Problems](#installation-problems) - [Installation Problems](#installation-problems)
- [Custom Plugins And Themes](#custom-plugins-and-themes) - [Custom Plugins And Themes](#custom-plugins-and-themes)
- [Using Plugin Managers Without `oh-my-zsh.sh`](#using-plugin-managers-without-oh-my-zshsh)
- [Enable GNU ls In macOS And FreeBSD Systems](#enable-gnu-ls-in-macos-and-freebsd-systems) - [Enable GNU ls In macOS And FreeBSD Systems](#enable-gnu-ls-in-macos-and-freebsd-systems)
- [Skip Aliases](#skip-aliases) - [Skip Aliases](#skip-aliases)
- [Async git prompt](#async-git-prompt) - [Async git prompt](#async-git-prompt)
@@ -349,6 +350,120 @@ If you have many functions that go well together, you can put them as a `XYZ.plu
If you would like to override the functionality of a plugin distributed with Oh My Zsh, create a plugin of the If you would like to override the functionality of a plugin distributed with Oh My Zsh, create a plugin of the
same name in the `custom/plugins/` directory and it will be loaded instead of the one in `plugins/`. same name in the `custom/plugins/` directory and it will be loaded instead of the one in `plugins/`.
### Using Plugin Managers Without `oh-my-zsh.sh`
Some plugin managers load individual OMZ plugins/themes directly and do not source `oh-my-zsh.sh`.
For those setups, source this bootstrap entrypoint before loading any OMZ plugin or theme:
```zsh
source "$ZSH/lib/bootstrap.zsh"
```
#### Bootstrap compatibility contract
`lib/bootstrap.zsh` is idempotent and is the only required pre-load step for plugin-manager setups.
It guarantees:
- `ZSH`, `ZSH_CUSTOM`, and `ZSH_CACHE_DIR` defaults
- writable cache fallback to `${XDG_CACHE_HOME:-$HOME/.cache}/oh-my-zsh`
- `$ZSH_CACHE_DIR/completions` directory creation
- required OMZ `fpath` entries for plugins/themes:
- `$ZSH/functions`
- `$ZSH/completions`
- `$ZSH_CUSTOM/functions`
- `$ZSH_CUSTOM/completions`
- `$ZSH_CACHE_DIR/completions`
- public signal: `OMZ_IS_BOOTSTRAPPED=true` (for one-time hook guards)
What still requires `oh-my-zsh.sh`:
- update checks
- plugin auto-discovery from the `plugins=(...)` list
- `compinit`/`compfix` orchestration and zcompdump metadata refresh
- alias filtering via `:omz:*` zstyles during file sourcing
- final full-init signal: `OMZ_IS_LOADED=true`
#### Plugin manager hook guidance
Run bootstrap once, before any OMZ plugin/theme load:
```zsh
[[ -n "${OMZ_IS_BOOTSTRAPPED:-}" ]] || source "$ZSH/lib/bootstrap.zsh"
```
- **Antigen** (pre-bundle hook pattern):
```zsh
omz_preload() { [[ -n "${OMZ_IS_BOOTSTRAPPED:-}" ]] || source "$ZSH/lib/bootstrap.zsh"; }
omz_preload
antigen bundle OMZ::plugins/git
antigen apply
```
- **Zinit** (`atinit` pre-load hook):
```zsh
zinit ice atinit'[[ -n "${OMZ_IS_BOOTSTRAPPED:-}" ]] || source "$ZSH/lib/bootstrap.zsh"'
zinit snippet OMZ::plugins/git/git.plugin.zsh
```
- **zgen** (pre-load hook function called before OMZ loads):
```zsh
omz_preload() { [[ -n "${OMZ_IS_BOOTSTRAPPED:-}" ]] || source "$ZSH/lib/bootstrap.zsh"; }
omz_preload
zgen load ohmyzsh/ohmyzsh plugins/git
```
- **zplug** (run pre-load hook immediately before OMZ entries):
```zsh
omz_preload() { [[ -n "${OMZ_IS_BOOTSTRAPPED:-}" ]] || source "$ZSH/lib/bootstrap.zsh"; }
omz_preload
zplug "plugins/git", from:oh-my-zsh
zplug load
```
- **antibody** (run pre-load hook before `antibody bundle`/`source` output):
```zsh
omz_preload() { [[ -n "${OMZ_IS_BOOTSTRAPPED:-}" ]] || source "$ZSH/lib/bootstrap.zsh"; }
omz_preload
source <(antibody bundle <<'EOF'
ohmyzsh/ohmyzsh path:plugins/git
EOF
)
```
- **zulu** (run pre-load hook before OMZ module loads):
```zsh
omz_preload() { [[ -n "${OMZ_IS_BOOTSTRAPPED:-}" ]] || source "$ZSH/lib/bootstrap.zsh"; }
omz_preload
zulu install oh-my-zsh
```
Compatibility matrix:
| Load mode | `OMZ_IS_BOOTSTRAPPED` | `OMZ_IS_LOADED` | Suitable for |
| :-- | :--: | :--: | :-- |
| `source $ZSH/oh-my-zsh.sh` | ✅ | ✅ | Full OMZ framework features |
| `source $ZSH/lib/bootstrap.zsh` + manager-loaded OMZ plugins/themes | ✅ | ❌ | Plugin/theme prerequisites only |
#### Manager entrypoints and OMZ-side auto-injection limits
Most plugin managers load OMZ by directly sourcing selected plugin/theme/lib entrypoints, not by sourcing
`oh-my-zsh.sh`, so OMZ cannot universally inject bootstrap on its own.
| Manager | Typical OMZ entrypoint(s) it loads | Can OMZ auto-inject bootstrap without user hook? |
| :-- | :-- | :--: |
| Antigen | `antigen bundle ...` targets after `antigen use oh-my-zsh` | ❌ |
| Zinit | `OMZ::`, `OMZL::`, `OMZP::`, `OMZT::` snippets | ❌ |
| zgen | `zgen oh-my-zsh ...` selected OMZ paths | ❌ |
| zplug | `from:oh-my-zsh` selected OMZ entries | ❌ |
| antibody | `ohmyzsh/ohmyzsh path:...` selected OMZ paths | ❌ |
| zulu | OMZ package/module entries selected by zulu | ❌ |
### Enable GNU ls In macOS And FreeBSD Systems ### Enable GNU ls In macOS And FreeBSD Systems
<a name="enable-gnu-ls"></a> <a name="enable-gnu-ls"></a>

44
lib/bootstrap.zsh Normal file
View File

@@ -0,0 +1,44 @@
#
# Shared Oh My Zsh bootstrap entrypoint.
#
# This file can be sourced by plugin managers that don't source `oh-my-zsh.sh`.
# It is safe to source multiple times.
#
# Keep source path for callers that invoke omz_bootstrap again later.
typeset -g _OMZ_BOOTSTRAP_SOURCE="${${(%):-%x}:a}"
omz_bootstrap() {
# If ZSH is not defined, infer from this file location.
[[ -n "${ZSH:-}" ]] || export ZSH="${_OMZ_BOOTSTRAP_SOURCE:h:h}"
# Set ZSH_CUSTOM to the path where custom config files and plugins exist.
[[ -n "${ZSH_CUSTOM:-}" ]] || ZSH_CUSTOM="$ZSH/custom"
# Set cache directory.
[[ -n "${ZSH_CACHE_DIR:-}" ]] || ZSH_CACHE_DIR="$ZSH/cache"
# Ensure cache dir is writable, otherwise fallback to a HOME-based cache.
if [[ ! -w "$ZSH_CACHE_DIR" ]]; then
ZSH_CACHE_DIR="${XDG_CACHE_HOME:-$HOME/.cache}/oh-my-zsh"
fi
# Create cache and completions dir.
command mkdir -p "$ZSH_CACHE_DIR/completions"
# Add required OMZ search paths.
local dir
for dir in \
"$ZSH/functions" \
"$ZSH/completions" \
"$ZSH_CUSTOM/functions" \
"$ZSH_CUSTOM/completions" \
"$ZSH_CACHE_DIR/completions"; do
(( ${fpath[(Ie)$dir]} )) || fpath=("$dir" $fpath)
done
# Public signal: OMZ bootstrap has completed.
typeset -g OMZ_IS_BOOTSTRAPPED=true
}
omz_bootstrap "$@"

View File

@@ -0,0 +1,35 @@
#!/usr/bin/zsh -df
set -eu
bootstrap_file="${0:A:h:h}/bootstrap.zsh"
assert() {
local condition="$1" message="$2"
if ! eval "$condition"; then
print -u2 "\e[31mError\e[0m: $message"
exit 1
fi
}
tmp==(:)
mkdir -p "$tmp/ohmyzsh"/{functions,completions,cache} "$tmp/ohmyzsh/custom"/{functions,completions}
export ZSH="$tmp/ohmyzsh"
unset ZSH_CUSTOM ZSH_CACHE_DIR OMZ_IS_BOOTSTRAPPED
fpath=()
source "$bootstrap_file"
assert '[[ "$OMZ_IS_BOOTSTRAPPED" == true ]]' "OMZ bootstrap signal should be true"
assert '[[ -d "$ZSH_CACHE_DIR/completions" ]]' "cache completions directory should exist"
assert '[[ "${fpath[(Ie)$ZSH/functions]}" -gt 0 ]]' "fpath should include OMZ functions"
assert '[[ "${fpath[(Ie)$ZSH/completions]}" -gt 0 ]]' "fpath should include OMZ completions"
assert '[[ "${fpath[(Ie)$ZSH_CUSTOM/functions]}" -gt 0 ]]' "fpath should include custom functions"
assert '[[ "${fpath[(Ie)$ZSH_CUSTOM/completions]}" -gt 0 ]]' "fpath should include custom completions"
assert '[[ "${fpath[(Ie)$ZSH_CACHE_DIR/completions]}" -gt 0 ]]' "fpath should include cache completions"
touch "$ZSH_CACHE_DIR/completions/_bootstrap_ci_smoke"
assert '[[ -f "$ZSH_CACHE_DIR/completions/_bootstrap_ci_smoke" ]]' "completion cache write should succeed"
print -u2 "\e[32mSuccess\e[0m bootstrap inline invariants"

View File

@@ -0,0 +1,88 @@
#!/usr/bin/zsh -df
set -u
bootstrap_file="${0:A:h:h}/bootstrap.zsh"
_assert() {
local condition="$1" message="$2"
if ! eval "$condition"; then
print -u2 "\e[31mError\e[0m: $message"
return 1
fi
}
test_bootstrap_sets_defaults_and_paths() {
local tmp==(:)
mkdir -p "$tmp/ohmyzsh"/{functions,completions,cache} "$tmp/ohmyzsh/custom"/{functions,completions}
(
set -e
export ZSH="$tmp/ohmyzsh"
unset ZSH_CUSTOM ZSH_CACHE_DIR OMZ_IS_BOOTSTRAPPED
fpath=()
source "$bootstrap_file"
_assert '[[ "$ZSH_CUSTOM" == "'"$tmp/ohmyzsh/custom"'" ]]' "ZSH_CUSTOM default should be set"
_assert '[[ "$ZSH_CACHE_DIR" == "'"$tmp/ohmyzsh/cache"'" ]]' "ZSH_CACHE_DIR default should be set"
_assert '[[ -d "'"$tmp/ohmyzsh/cache/completions"'" ]]' "completions dir should be created"
_assert '[[ "${fpath[(Ie)'"$tmp/ohmyzsh/functions"']}" -gt 0 ]]' "fpath should include OMZ functions dir"
_assert '[[ "${fpath[(Ie)'"$tmp/ohmyzsh/completions"']}" -gt 0 ]]' "fpath should include OMZ completions dir"
_assert '[[ "${fpath[(Ie)'"$tmp/ohmyzsh/custom/functions"']}" -gt 0 ]]' "fpath should include custom functions dir"
_assert '[[ "${fpath[(Ie)'"$tmp/ohmyzsh/custom/completions"']}" -gt 0 ]]' "fpath should include custom completions dir"
_assert '[[ "${fpath[(Ie)'"$tmp/ohmyzsh/cache/completions"']}" -gt 0 ]]' "fpath should include cache completions dir"
_assert '[[ "$OMZ_IS_BOOTSTRAPPED" == true ]]' "bootstrap signal should be set"
)
}
test_bootstrap_is_idempotent() {
local tmp==(:)
mkdir -p "$tmp/ohmyzsh"/{functions,completions,cache} "$tmp/ohmyzsh/custom"/{functions,completions}
(
set -e
export ZSH="$tmp/ohmyzsh"
unset ZSH_CUSTOM ZSH_CACHE_DIR OMZ_IS_BOOTSTRAPPED
fpath=()
source "$bootstrap_file"
source "$bootstrap_file"
omz_bootstrap
_assert '[[ ${#fpath} -eq ${#${(u)fpath}} ]]' "fpath entries should not duplicate after repeated bootstrap"
_assert '[[ "$OMZ_IS_BOOTSTRAPPED" == true ]]' "bootstrap signal should remain true"
)
}
test_bootstrap_uses_writable_cache_fallback() {
local tmp==(:)
mkdir -p "$tmp/ohmyzsh"/{functions,completions} "$tmp/ohmyzsh/custom"/{functions,completions}
mkdir -p "$tmp/no-write" "$tmp/xdg-cache"
chmod 0555 "$tmp/no-write"
(
set -e
export ZSH="$tmp/ohmyzsh"
export XDG_CACHE_HOME="$tmp/xdg-cache"
export ZSH_CACHE_DIR="$tmp/no-write"
unset ZSH_CUSTOM OMZ_IS_BOOTSTRAPPED
fpath=()
source "$bootstrap_file"
_assert '[[ "$ZSH_CACHE_DIR" == "'"$tmp/xdg-cache/oh-my-zsh"'" ]]' "cache dir should fallback when not writable"
_assert '[[ -d "'"$tmp/xdg-cache/oh-my-zsh/completions"'" ]]' "fallback completions dir should be created"
_assert '[[ "${fpath[(Ie)'"$tmp/xdg-cache/oh-my-zsh/completions"']}" -gt 0 ]]' "fpath should include fallback completions dir"
)
}
tests=(
test_bootstrap_sets_defaults_and_paths
test_bootstrap_is_idempotent
test_bootstrap_uses_writable_cache_fallback
)
for test_name in $tests; do
print -u2 "Test: $test_name"
"$test_name" || exit 1
print -u2 "\e[32mSuccess\e[0m"
print -u2 ""
done

View File

@@ -0,0 +1,104 @@
#!/usr/bin/zsh -df
set -euo pipefail
if (( $# != 2 )); then
print -u2 "Usage: $0 <manager> <positive|negative>"
exit 1
fi
manager="$1"
scenario="$2"
if [[ "$scenario" != "positive" && "$scenario" != "negative" ]]; then
print -u2 "scenario must be 'positive' or 'negative'"
exit 1
fi
repo_root="${0:A:h:h:h}"
tmp==(:)
workspace="$tmp/workspace"
home_dir="$tmp/home"
cache_dir="$tmp/cache"
zshrc="$tmp/.zshrc"
mkdir -p "$workspace" "$home_dir" "$cache_dir"
manager_install=''
manager_source=''
case "$manager" in
antigen)
manager_install='git clone https://github.com/zsh-users/antigen.git "$MANAGER_HOME/antigen" >/dev/null 2>&1'
manager_source='source "$MANAGER_HOME/antigen/antigen.zsh"'
;;
zinit)
manager_install='git clone https://github.com/zdharma-continuum/zinit.git "$MANAGER_HOME/zinit" >/dev/null 2>&1'
manager_source='source "$MANAGER_HOME/zinit/zinit.zsh"'
;;
zgen)
manager_install='git clone https://github.com/tarjoilija/zgen.git "$MANAGER_HOME/zgen" >/dev/null 2>&1'
manager_source='source "$MANAGER_HOME/zgen/zgen.zsh"'
;;
zplug)
manager_install='git clone https://github.com/zplug/zplug "$MANAGER_HOME/zplug" >/dev/null 2>&1'
manager_source='export ZPLUG_HOME="$MANAGER_HOME/zplug"; source "$ZPLUG_HOME/init.zsh"'
;;
antibody)
manager_install='command -v go >/dev/null 2>&1; export GOBIN="$MANAGER_HOME/bin"; mkdir -p "$GOBIN"; go install github.com/getantibody/antibody@latest >/dev/null 2>&1'
manager_source='"$MANAGER_HOME/bin/antibody" --version >/dev/null 2>&1'
;;
zulu)
manager_install='git clone https://github.com/zulu-zsh/zulu.git "$MANAGER_HOME/zulu" >/dev/null 2>&1'
manager_source='source "$MANAGER_HOME/zulu/zulu.zsh"'
;;
*)
print -u2 "Unsupported manager: $manager"
exit 1
;;
esac
cat > "$zshrc" <<RC
set -eo pipefail
export HOME="$home_dir"
export XDG_CACHE_HOME="$cache_dir"
export OMZ_ROOT="$repo_root"
export ZSH="\$OMZ_ROOT"
export MANAGER_HOME="$workspace/$manager"
mkdir -p "\$MANAGER_HOME"
$manager_install
$manager_source
RC
if [[ "$scenario" == "positive" ]]; then
cat >> "$zshrc" <<'RC'
source "$OMZ_ROOT/lib/bootstrap.zsh"
[[ "${OMZ_IS_BOOTSTRAPPED:-}" == true ]] || { print -u2 "bootstrap signal missing before OMZ load"; return 1; }
RC
else
cat >> "$zshrc" <<'RC'
[[ -z "${OMZ_IS_BOOTSTRAPPED:-}" ]] || { print -u2 "bootstrap signal unexpectedly set without hook"; return 1; }
source "$OMZ_ROOT/lib/bootstrap.zsh"
RC
fi
cat >> "$zshrc" <<RC
[[ "\${OMZ_IS_BOOTSTRAPPED:-}" == true ]] || { print -u2 "bootstrap signal not set before OMZ entrypoint sourcing"; return 1; }
source "\$OMZ_ROOT/lib/functions.zsh"
source "\$OMZ_ROOT/plugins/git/git.plugin.zsh"
autoload -Uz compinit
compinit -i -d "\$ZSH_CACHE_DIR/.zcompdump"
source "\$OMZ_ROOT/themes/robbyrussell.zsh-theme"
[[ -d "\$ZSH_CACHE_DIR/completions" ]] || { print -u2 "completions cache directory missing"; return 1; }
touch "\$ZSH_CACHE_DIR/completions/_ci_${manager}_${scenario}" || { print -u2 "completion cache write failed"; return 1; }
[[ -f "\$ZSH_CACHE_DIR/completions/_ci_${manager}_${scenario}" ]] || { print -u2 "completion cache file missing"; return 1; }
RC
zsh -df "$zshrc"
print -u2 "\e[32mSuccess\e[0m $manager $scenario"

View File

@@ -50,31 +50,14 @@ unset -f omz_f
# If ZSH is not defined, use the current script's directory. # If ZSH is not defined, use the current script's directory.
[[ -n "$ZSH" ]] || export ZSH="${${(%):-%x}:a:h}" [[ -n "$ZSH" ]] || export ZSH="${${(%):-%x}:a:h}"
# Set ZSH_CUSTOM to the path where your custom config files # Shared, manager-agnostic bootstrap.
# and plugins exists, or else we will use the default custom/ source "$ZSH/lib/bootstrap.zsh"
[[ -n "$ZSH_CUSTOM" ]] || ZSH_CUSTOM="$ZSH/custom"
# Set ZSH_CACHE_DIR to the path where cache files should be created
# or else we will use the default cache/
[[ -n "$ZSH_CACHE_DIR" ]] || ZSH_CACHE_DIR="$ZSH/cache"
# Make sure $ZSH_CACHE_DIR is writable, otherwise use a directory in $HOME
if [[ ! -w "$ZSH_CACHE_DIR" ]]; then
ZSH_CACHE_DIR="${XDG_CACHE_HOME:-$HOME/.cache}/oh-my-zsh"
fi
# Create cache and completions dir and add to $fpath
mkdir -p "$ZSH_CACHE_DIR/completions"
(( ${fpath[(Ie)$ZSH_CACHE_DIR/completions]} )) || fpath=("$ZSH_CACHE_DIR/completions" $fpath)
# Check for updates on initial load... # Check for updates on initial load...
source "$ZSH/tools/check_for_upgrade.sh" source "$ZSH/tools/check_for_upgrade.sh"
# Initializes Oh My Zsh # Initializes Oh My Zsh
# add a function path
fpath=($ZSH/{functions,completions} $ZSH_CUSTOM/{functions,completions} $fpath)
# Load all stock functions (from $fpath files) called below. # Load all stock functions (from $fpath files) called below.
autoload -U compaudit compinit zrecompile autoload -U compaudit compinit zrecompile
@@ -234,3 +217,6 @@ fi
# set completion colors to be the same as `ls`, after theme has been loaded # set completion colors to be the same as `ls`, after theme has been loaded
[[ -z "$LS_COLORS" ]] || zstyle ':completion:*' list-colors "${(s.:.)LS_COLORS}" [[ -z "$LS_COLORS" ]] || zstyle ':completion:*' list-colors "${(s.:.)LS_COLORS}"
# Public signal: full Oh My Zsh init script has completed.
typeset -g OMZ_IS_LOADED=true

View File

@@ -9,11 +9,7 @@ if [[ ! -f "$ZSH_CACHE_DIR/completions/_op" ]]; then
_comps[op]=_op _comps[op]=_op
fi fi
zmodload -F zsh/files b:zf_mv op completion zsh >| "$ZSH_CACHE_DIR/completions/_op" &|
() {
local TMPPREFIX="$ZSH_CACHE_DIR/completions/_op"
zf_mv -f -- =( op completion zsh ) "$TMPPREFIX"
} &|
# Load opswd function # Load opswd function
autoload -Uz opswd autoload -Uz opswd

View File

@@ -11,8 +11,4 @@ if [[ ! -f "$ZSH_CACHE_DIR/completions/_arduino-cli" ]]; then
fi fi
# Generate and load arduino-cli completion # Generate and load arduino-cli completion
zmodload -F zsh/files b:zf_mv arduino-cli completion zsh >! "$ZSH_CACHE_DIR/completions/_arduino-cli" &|
() {
local TMPPREFIX="$ZSH_CACHE_DIR/completions/_arduino-cli"
zf_mv -f -- =( arduino-cli completion zsh ) "$TMPPREFIX"
} &|

View File

@@ -11,8 +11,4 @@ if [[ ! -f "$ZSH_CACHE_DIR/completions/_argocd" ]]; then
_comps[argocd]=_argocd _comps[argocd]=_argocd
fi fi
zmodload -F zsh/files b:zf_mv argocd completion zsh >| "$ZSH_CACHE_DIR/completions/_argocd" &|
() {
local TMPPREFIX="$ZSH_CACHE_DIR/completions/_argocd"
zf_mv -f -- =( argocd completion zsh ) "$TMPPREFIX"
} &|

View File

@@ -12,8 +12,4 @@ if [[ ! -f "$ZSH_CACHE_DIR/completions/_asdf" ]]; then
autoload -Uz _asdf autoload -Uz _asdf
_comps[asdf]=_asdf _comps[asdf]=_asdf
fi fi
zmodload -F zsh/files b:zf_mv asdf completion zsh >| "$ZSH_CACHE_DIR/completions/_asdf" &|
() {
local TMPPREFIX="$ZSH_CACHE_DIR/completions/_asdf"
zf_mv -f -- =( asdf completion zsh ) "$TMPPREFIX"
} &|

View File

@@ -11,8 +11,4 @@ if [[ ! -f "$ZSH_CACHE_DIR/completions/_buf" ]]; then
fi fi
# Generate and load buf completion # Generate and load buf completion
zmodload -F zsh/files b:zf_mv buf completion zsh >! "$ZSH_CACHE_DIR/completions/_buf" &|
() {
local TMPPREFIX="$ZSH_CACHE_DIR/completions/_buf"
zf_mv -f -- =( buf completion zsh ) "$TMPPREFIX"
} &|

View File

@@ -11,8 +11,4 @@ if [[ ! -f "$ZSH_CACHE_DIR/completions/_bun" ]]; then
_comps[bun]=_bun _comps[bun]=_bun
fi fi
zmodload -F zsh/files b:zf_mv SHELL=zsh bun completions >| "$ZSH_CACHE_DIR/completions/_bun" &|
() {
local TMPPREFIX="$ZSH_CACHE_DIR/completions/_bun"
zf_mv -f -- =( SHELL=zsh bun completions ) "$TMPPREFIX"
} &|

View File

@@ -11,8 +11,4 @@ if [[ ! -f "$ZSH_CACHE_DIR/completions/_charm" ]]; then
_comps[charm]=_charm _comps[charm]=_charm
fi fi
zmodload -F zsh/files b:zf_mv charm completion zsh >| "$ZSH_CACHE_DIR/completions/_charm" &|
() {
local TMPPREFIX="$ZSH_CACHE_DIR/completions/_charm"
zf_mv -f -- =( charm completion zsh ) "$TMPPREFIX"
} &|

View File

@@ -11,8 +11,4 @@ if [[ ! -f "$ZSH_CACHE_DIR/completions/_chezmoi" ]]; then
_comps[chezmoi]=_chezmoi _comps[chezmoi]=_chezmoi
fi fi
zmodload -F zsh/files b:zf_mv chezmoi completion zsh >| "$ZSH_CACHE_DIR/completions/_chezmoi" &|
() {
local TMPPREFIX="$ZSH_CACHE_DIR/completions/_chezmoi"
zf_mv -f -- =( chezmoi completion zsh ) "$TMPPREFIX"
} &|

View File

@@ -11,8 +11,4 @@ if [[ ! -f "$ZSH_CACHE_DIR/completions/_codex" ]]; then
_comps[codex]=_codex _comps[codex]=_codex
fi fi
zmodload -F zsh/files b:zf_mv codex completion zsh < /dev/null 2> /dev/null >| "$ZSH_CACHE_DIR/completions/_codex" &|
() {
local TMPPREFIX="$ZSH_CACHE_DIR/completions/_codex"
zf_mv -f -- =( codex completion zsh < /dev/null 2> /dev/null ) "$TMPPREFIX"
} &|

View File

@@ -25,8 +25,4 @@ if [[ ! -f "$ZSH_CACHE_DIR/completions/_deno" ]]; then
_comps[deno]=_deno _comps[deno]=_deno
fi fi
zmodload -F zsh/files b:zf_mv deno completions zsh >| "$ZSH_CACHE_DIR/completions/_deno" &|
() {
local TMPPREFIX="$ZSH_CACHE_DIR/completions/_deno"
zf_mv -f -- =( deno completions zsh ) "$TMPPREFIX"
} &|

View File

@@ -56,8 +56,7 @@ if [[ ! -f "$ZSH_CACHE_DIR/completions/_docker" ]]; then
_comps[docker]=_docker _comps[docker]=_docker
fi fi
zmodload -F zsh/files b:zf_mv {
() {
# `docker completion` is only available from 23.0.0 on # `docker completion` is only available from 23.0.0 on
# docker version returns `Docker version 24.0.2, build cb74dfcd85` # docker version returns `Docker version 24.0.2, build cb74dfcd85`
# with `s:,:` remove the comma after the version, and select third word of it # with `s:,:` remove the comma after the version, and select third word of it
@@ -65,7 +64,6 @@ 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 "${0:h}/completions/_docker" "$ZSH_CACHE_DIR/completions/_docker" command cp "${0:h}/completions/_docker" "$ZSH_CACHE_DIR/completions/_docker"
else else
local TMPPREFIX="$ZSH_CACHE_DIR/completions/_docker" command docker completion zsh | tee "$ZSH_CACHE_DIR/completions/_docker" > /dev/null
zf_mv -f -- =( command docker completion zsh ) "$TMPPREFIX"
fi fi
} &| } &|

View File

@@ -14,8 +14,4 @@ if [[ ! -f "$ZSH_CACHE_DIR/completions/_doctl" ]]; then
_comps[doctl]=_doctl _comps[doctl]=_doctl
fi fi
zmodload -F zsh/files b:zf_mv doctl completion zsh >| "$ZSH_CACHE_DIR/completions/_doctl" &|
() {
local TMPPREFIX="$ZSH_CACHE_DIR/completions/_doctl"
zf_mv -f -- =( doctl completion zsh ) "$TMPPREFIX"
} &|

View File

@@ -30,8 +30,4 @@ if [[ ! -f "$ZSH_CACHE_DIR/completions/_flutter" ]]; then
_comps[flutter]=_flutter _comps[flutter]=_flutter
fi fi
zmodload -F zsh/files b:zf_mv flutter zsh-completion < /dev/null >| "$ZSH_CACHE_DIR/completions/_flutter" &|
() {
local TMPPREFIX="$ZSH_CACHE_DIR/completions/_flutter"
zf_mv -f -- =( flutter zsh-completion < /dev/null ) "$TMPPREFIX"
} &|

View File

@@ -11,8 +11,4 @@ if [[ ! -f "$ZSH_CACHE_DIR/completions/_flux" ]]; then
_comps[flux]=_flux _comps[flux]=_flux
fi fi
zmodload -F zsh/files b:zf_mv flux completion zsh >| "$ZSH_CACHE_DIR/completions/_flux" &|
() {
local TMPPREFIX="$ZSH_CACHE_DIR/completions/_flux"
zf_mv -f -- =( flux completion zsh ) "$TMPPREFIX"
} &|

View File

@@ -10,11 +10,7 @@ if [[ ! -f "$ZSH_CACHE_DIR/completions/_fnm" ]]; then
_comps[fnm]=_fnm _comps[fnm]=_fnm
fi fi
zmodload -F zsh/files b:zf_mv fnm completions --shell=zsh >| "$ZSH_CACHE_DIR/completions/_fnm" &|
() {
local TMPPREFIX="$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
local -a fnm_env_cmd local -a fnm_env_cmd

View File

@@ -11,8 +11,4 @@ if [[ ! -f "$ZSH_CACHE_DIR/completions/_gh" ]]; then
_comps[gh]=_gh _comps[gh]=_gh
fi fi
zmodload -F zsh/files b:zf_mv gh completion --shell zsh >| "$ZSH_CACHE_DIR/completions/_gh" &|
() {
local TMPPREFIX="$ZSH_CACHE_DIR/completions/_gh"
zf_mv -f -- =( gh completion --shell zsh ) "$TMPPREFIX"
} &|

View File

@@ -9,9 +9,5 @@ if [[ ! -f "$ZSH_CACHE_DIR/completions/_hasura" ]]; then
source "$ZSH_CACHE_DIR/completions/_hasura" source "$ZSH_CACHE_DIR/completions/_hasura"
else else
source "$ZSH_CACHE_DIR/completions/_hasura" source "$ZSH_CACHE_DIR/completions/_hasura"
zmodload -F zsh/files b:zf_mv hasura completion zsh --file "$ZSH_CACHE_DIR/completions/_hasura" >/dev/null &|
() {
local TMPPREFIX="$ZSH_CACHE_DIR/completions/_hasura"
zf_mv -f -- =( hasura completion zsh ) "$TMPPREFIX"
} &|
fi fi

View File

@@ -13,11 +13,7 @@ if [[ ! -f "$ZSH_CACHE_DIR/completions/_hcloud" ]]; then
_comps[hcloud]=_hcloud _comps[hcloud]=_hcloud
fi fi
zmodload -F zsh/files b:zf_mv hcloud completion zsh 2> /dev/null >| "$ZSH_CACHE_DIR/completions/_hcloud" &|
() {
local TMPPREFIX="$ZSH_CACHE_DIR/completions/_hcloud"
zf_mv -f -- =( hcloud completion zsh 2> /dev/null ) "$TMPPREFIX"
} &|
# Main alias # Main alias
alias hc='hcloud' alias hc='hcloud'

View File

@@ -9,11 +9,7 @@ if [[ ! -f "$ZSH_CACHE_DIR/completions/_helm" ]]; then
source "$ZSH_CACHE_DIR/completions/_helm" source "$ZSH_CACHE_DIR/completions/_helm"
else else
source "$ZSH_CACHE_DIR/completions/_helm" source "$ZSH_CACHE_DIR/completions/_helm"
zmodload -F zsh/files b:zf_mv helm completion zsh | tee "$ZSH_CACHE_DIR/completions/_helm" >/dev/null &|
() {
local TMPPREFIX="$ZSH_CACHE_DIR/completions/_helm"
zf_mv -f -- =( helm completion zsh ) "$TMPPREFIX"
} &|
fi fi
alias h='helm' alias h='helm'

View File

@@ -11,11 +11,7 @@ if [[ ! -f "$ZSH_CACHE_DIR/completions/_jj" ]]; then
_comps[jj]=_jj _comps[jj]=_jj
fi fi
zmodload -F zsh/files b:zf_mv COMPLETE=zsh jj >| "$ZSH_CACHE_DIR/completions/_jj" &|
() {
local TMPPREFIX="$ZSH_CACHE_DIR/completions/_jj"
zf_mv -f -- =( COMPLETE=zsh jj ) "$TMPPREFIX"
} &|
function __jj_prompt_jj() { function __jj_prompt_jj() {
local -a flags local -a flags
@@ -76,3 +72,4 @@ alias jjsq='jj squash'
alias jjst='jj status' alias jjst='jj status'
alias jjwa='jj workspace add' alias jjwa='jj workspace add'
alias jjwf='jj workspace forget' alias jjwf='jj workspace forget'

View File

@@ -11,8 +11,4 @@ fi
# and then generate it in the background. On first completion, # and then generate it in the background. On first completion,
# the actual completion file will be loaded. # the actual completion file will be loaded.
zmodload -F zsh/files b:zf_mv k9s completion zsh >| "$ZSH_CACHE_DIR/completions/_k9s" &|
() {
local TMPPREFIX="$ZSH_CACHE_DIR/completions/_k9s"
zf_mv -f -- =( k9s completion zsh ) "$TMPPREFIX"
} &|

View File

@@ -11,11 +11,7 @@ if [[ ! -f "$ZSH_CACHE_DIR/completions/_kind" ]]; then
fi fi
# Generate and load kind completion # Generate and load kind completion
zmodload -F zsh/files b:zf_mv kind completion zsh >! "$ZSH_CACHE_DIR/completions/_kind" &|
() {
local TMPPREFIX="$ZSH_CACHE_DIR/completions/_kind"
zf_mv -f -- =( kind completion zsh ) "$TMPPREFIX"
} &|
# Register aliases # Register aliases
alias kicc="kind create cluster" alias kicc="kind create cluster"

View File

@@ -10,11 +10,7 @@ if [[ ! -f "$ZSH_CACHE_DIR/completions/_kubectl" ]]; then
_comps[kubectl]=_kubectl _comps[kubectl]=_kubectl
fi fi
zmodload -F zsh/files b:zf_mv kubectl completion zsh 2> /dev/null >| "$ZSH_CACHE_DIR/completions/_kubectl" &|
() {
local TMPPREFIX="$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
alias k=kubectl alias k=kubectl

View File

@@ -10,8 +10,4 @@ if [[ ! -f "$ZSH_CACHE_DIR/completions/_minikube" ]]; then
_comps[minikube]=_minikube _comps[minikube]=_minikube
fi fi
zmodload -F zsh/files b:zf_mv minikube completion zsh >| "$ZSH_CACHE_DIR/completions/_minikube" &|
() {
local TMPPREFIX="$ZSH_CACHE_DIR/completions/_minikube"
zf_mv -f -- =( minikube completion zsh ) "$TMPPREFIX"
} &|

View File

@@ -14,8 +14,4 @@ if [[ ! -f "$ZSH_CACHE_DIR/completions/_mise" ]]; then
fi fi
# Generate and load mise completion # Generate and load mise completion
zmodload -F zsh/files b:zf_mv mise completion zsh >| "$ZSH_CACHE_DIR/completions/_mise" &|
() {
local TMPPREFIX="$ZSH_CACHE_DIR/completions/_mise"
zf_mv -f -- =( mise completion zsh ) "$TMPPREFIX"
} &|

View File

@@ -11,11 +11,7 @@ if [[ ! -f "$ZSH_CACHE_DIR/completions/_molecule" ]]; then
_comps[molecule]=_molecule _comps[molecule]=_molecule
fi fi
zmodload -F zsh/files b:zf_mv _MOLECULE_COMPLETE=zsh_source molecule >| "$ZSH_CACHE_DIR/completions/_molecule" &|
() {
local TMPPREFIX="$ZSH_CACHE_DIR/completions/_molecule"
zf_mv -f -- =( _MOLECULE_COMPLETE=zsh_source molecule ) "$TMPPREFIX"
} &|
# Alias # Alias
# molecule: https://docs.ansible.com/projects/molecule/ # molecule: https://docs.ansible.com/projects/molecule/

View File

@@ -11,8 +11,4 @@ if [[ ! -f "$ZSH_CACHE_DIR/completions/_atlas" ]]; then
_comps[atlas]=_atlas _comps[atlas]=_atlas
fi fi
zmodload -F zsh/files b:zf_mv atlas completion zsh >| "$ZSH_CACHE_DIR/completions/atlas" &|
() {
local TMPPREFIX="$ZSH_CACHE_DIR/completions/_atlas"
zf_mv -f -- =( atlas completion zsh ) "$TMPPREFIX"
} &|

View File

@@ -7,11 +7,7 @@ if (( $+commands[nsc] )); then
_comps[nsc]=_nsc _comps[nsc]=_nsc
fi fi
zmodload -F zsh/files b:zf_mv nsc completion zsh >| "$ZSH_CACHE_DIR/completions/_nsc" &|
() {
local TMPPREFIX="$ZSH_CACHE_DIR/completions/_nsc"
zf_mv -f -- =( nsc completion zsh ) "$TMPPREFIX"
} &|
fi fi
if (( $+commands[nats] )); then if (( $+commands[nats] )); then
@@ -23,9 +19,5 @@ if (( $+commands[nats] )); then
_comps[nats]=_nats _comps[nats]=_nats
fi fi
zmodload -F zsh/files b:zf_mv nats --completion-script-zsh >| "$ZSH_CACHE_DIR/completions/_nats" &|
() {
local TMPPREFIX="$ZSH_CACHE_DIR/completions/_nats"
zf_mv -f -- =( nats --completion-script-zsh ) "$TMPPREFIX"
} &|
fi fi

View File

@@ -11,8 +11,4 @@ if [[ ! -f "$ZSH_CACHE_DIR/completions/_ngrok" ]]; then
_comps[ngrok]=_ngrok _comps[ngrok]=_ngrok
fi fi
zmodload -F zsh/files b:zf_mv ngrok completion zsh >| "$ZSH_CACHE_DIR/completions/_ngrok" &|
() {
local TMPPREFIX="$ZSH_CACHE_DIR/completions/_ngrok"
zf_mv -f -- =( ngrok completion zsh ) "$TMPPREFIX"
} &|

View File

@@ -11,8 +11,4 @@ if [[ ! -f "$ZSH_CACHE_DIR/completions/_pass-cli" ]]; then
_comps[pass-cli]=_pass-cli _comps[pass-cli]=_pass-cli
fi fi
zmodload -F zsh/files b:zf_mv pass-cli completions zsh >| "$ZSH_CACHE_DIR/completions/_pass-cli" &|
() {
local TMPPREFIX="$ZSH_CACHE_DIR/completions/_pass-cli"
zf_mv -f -- =( pass-cli completions zsh ) "$TMPPREFIX"
} &|

View File

@@ -43,11 +43,7 @@ else
_comps[pipenv]=_pipenv _comps[pipenv]=_pipenv
fi fi
zmodload -F zsh/files b:zf_mv _PIPENV_COMPLETE=zsh_source pipenv >| "$ZSH_CACHE_DIR/completions/_pipenv" &|
() {
local TMPPREFIX="$ZSH_CACHE_DIR/completions/_pipenv"
zf_mv -f -- =( _PIPENV_COMPLETE=zsh_source pipenv ) "$TMPPREFIX"
} &|
fi fi
if zstyle -T ':omz:plugins:pipenv' auto-shell; then if zstyle -T ':omz:plugins:pipenv' auto-shell; then

View File

@@ -10,11 +10,7 @@ if [[ ! -f "$ZSH_CACHE_DIR/completions/_podman" ]]; then
_comps[podman]=_podman _comps[podman]=_podman
fi fi
zmodload -F zsh/files b:zf_mv podman completion zsh 2> /dev/null >| "$ZSH_CACHE_DIR/completions/_podman" &|
() {
local TMPPREFIX="$ZSH_CACHE_DIR/completions/_podman"
zf_mv -f -- =( podman completion zsh 2> /dev/null ) "$TMPPREFIX"
} &|
alias pbl='podman build' alias pbl='podman build'
alias pcin='podman container inspect' alias pcin='podman container inspect'

View File

@@ -39,8 +39,4 @@ if [[ ! -f "$ZSH_CACHE_DIR/completions/_poetry" ]]; then
_comps[poetry]=_poetry _comps[poetry]=_poetry
fi fi
zmodload -F zsh/files b:zf_mv poetry completions zsh >| "$ZSH_CACHE_DIR/completions/_poetry" &|
() {
local TMPPREFIX="$ZSH_CACHE_DIR/completions/_poetry"
zf_mv -f -- =( poetry completions zsh ) "$TMPPREFIX"
} &|

View File

@@ -10,16 +10,12 @@ if [[ ! -f "$ZSH_CACHE_DIR/completions/_procs" ]]; then
_comps[procs]=_procs _comps[procs]=_procs
fi fi
zmodload -F zsh/files b:zf_mv {
() {
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 -- =(
if is-at-least "0.14" "${_version#procs }"; then if is-at-least "0.14" "${_version#procs }"; then
procs --gen-completion-out zsh procs --gen-completion-out zsh >| "$ZSH_CACHE_DIR/completions/_procs"
else else
procs --completion-out zsh procs --completion-out zsh >| "$ZSH_CACHE_DIR/completions/_procs"
fi fi
) "$TMPPREFIX"
} &| } &|

View File

@@ -10,11 +10,7 @@ if [[ ! -f "$ZSH_CACHE_DIR/completions/_pulumi" ]]; then
_comps[pulumi]=_pulumi _comps[pulumi]=_pulumi
fi fi
zmodload -F zsh/files b:zf_mv pulumi gen-completion zsh >| "$ZSH_CACHE_DIR/completions/_pulumi" &|
() {
local TMPPREFIX="$ZSH_CACHE_DIR/completions/_pulumi"
zf_mv -f -- =( pulumi gen-completion zsh ) "$TMPPREFIX"
} &|
# Aliases # Aliases
alias pul='pulumi' alias pul='pulumi'

View File

@@ -11,8 +11,4 @@ if [[ ! -f "$ZSH_CACHE_DIR/completions/_qodana" ]]; then
_comps[qodana]=_qodana _comps[qodana]=_qodana
fi fi
zmodload -F zsh/files b:zf_mv qodana completion zsh >| "$ZSH_CACHE_DIR/completions/_qodana" &|
() {
local TMPPREFIX="$ZSH_CACHE_DIR/completions/_qodana"
zf_mv -f -- =( qodana completion zsh ) "$TMPPREFIX"
} &|

View File

@@ -10,11 +10,7 @@ if [[ ! -f "$ZSH_CACHE_DIR/completions/_rbw" ]]; then
_comps[rbw]=_rbw _comps[rbw]=_rbw
fi fi
zmodload -F zsh/files b:zf_mv rbw gen-completions zsh >| "$ZSH_CACHE_DIR/completions/_rbw" &|
() {
local TMPPREFIX="$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
# and clears it after 20 seconds # and clears it after 20 seconds

View File

@@ -11,8 +11,4 @@ if [[ ! -f "$ZSH_CACHE_DIR/completions/_rclone" ]]; then
_comps[rclone]=_rclone _comps[rclone]=_rclone
fi fi
zmodload -F zsh/files b:zf_mv rclone completion zsh - >| "$ZSH_CACHE_DIR/completions/_rclone" &|
() {
local TMPPREFIX="$ZSH_CACHE_DIR/completions/_rclone"
zf_mv -f -- =( rclone completion zsh - ) "$TMPPREFIX"
} &|

View File

@@ -19,11 +19,7 @@ if [[ ! -f "$ZSH_CACHE_DIR/completions/_rustup" ]]; then
fi fi
# Generate completion files in the background # Generate completion files in the background
zmodload -F zsh/files b:zf_mv rustup completions zsh >| "$ZSH_CACHE_DIR/completions/_rustup" &|
() {
local TMPPREFIX="$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
source "$(rustup run ${${(z)$(rustup default)}[1]} rustc --print sysroot)"/share/zsh/site-functions/_cargo source "$(rustup run ${${(z)$(rustup default)}[1]} rustc --print sysroot)"/share/zsh/site-functions/_cargo

View File

@@ -12,11 +12,7 @@ function install_autocompletion {
_comps[$1]=_$1 _comps[$1]=_$1
fi fi
zmodload -F zsh/files b:zf_mv $1 completion zsh >| "$ZSH_CACHE_DIR/completions/_$1" &|
() {
local TMPPREFIX="$ZSH_CACHE_DIR/completions/_$1"
zf_mv -f -- =( $1 completion zsh ) "$TMPPREFIX"
} "$1" &|
} }
install_autocompletion cosign install_autocompletion cosign

View File

@@ -11,8 +11,4 @@ if [[ ! -f "$ZSH_CACHE_DIR/completions/_skaffold" ]]; then
_comps[skaffold]=_skaffold _comps[skaffold]=_skaffold
fi fi
zmodload -F zsh/files b:zf_mv skaffold completion zsh >| "$ZSH_CACHE_DIR/completions/_skaffold" &|
() {
local TMPPREFIX="$ZSH_CACHE_DIR/completions/_skaffold"
zf_mv -f -- =( skaffold completion zsh ) "$TMPPREFIX"
} &|

View File

@@ -10,8 +10,4 @@ if [[ ! -f "$ZSH_CACHE_DIR/completions/_stripe" ]]; then
_comps[stripe]=_stripe _comps[stripe]=_stripe
fi fi
zmodload -F zsh/files b:zf_mv stripe completion --shell zsh --write-to-stdout >| "$ZSH_CACHE_DIR/completions/_stripe" &|
() {
local TMPPREFIX="$ZSH_CACHE_DIR/completions/_stripe"
zf_mv -f -- =( stripe completion --shell zsh --write-to-stdout ) "$TMPPREFIX"
} &|

View File

@@ -22,8 +22,4 @@ if (( $+aliases[tailscale] )); then
_comps[${aliases[tailscale]:t}]=_tailscale _comps[${aliases[tailscale]:t}]=_tailscale
fi fi
zmodload -F zsh/files b:zf_mv tailscale completion zsh >| "$ZSH_CACHE_DIR/completions/_tailscale" &|
() {
local TMPPREFIX="$ZSH_CACHE_DIR/completions/_tailscale"
zf_mv -f -- =( tailscale completion zsh ) "$TMPPREFIX"
} &|

View File

@@ -11,8 +11,4 @@ if [[ ! -f "$ZSH_CACHE_DIR/completions/_task" ]]; then
fi fi
# Generate and load task completion # Generate and load task completion
zmodload -F zsh/files b:zf_mv task --completion zsh >! "$ZSH_CACHE_DIR/completions/_task" &|
() {
local TMPPREFIX="$ZSH_CACHE_DIR/completions/_task"
zf_mv -f -- =( task --completion zsh ) "$TMPPREFIX"
} &|

View File

@@ -11,8 +11,4 @@ if [[ ! -f "$ZSH_CACHE_DIR/completions/_timoni" ]]; then
_comps[timoni]=_timoni _comps[timoni]=_timoni
fi fi
zmodload -F zsh/files b:zf_mv timoni completion zsh >| "$ZSH_CACHE_DIR/completions/_timoni" &|
() {
local TMPPREFIX="$ZSH_CACHE_DIR/completions/_timoni"
zf_mv -f -- =( timoni completion zsh ) "$TMPPREFIX"
} &|

View File

@@ -43,12 +43,5 @@ fi
# uv and uvx are installed together (uvx is an alias to `uv tool run`) # uv and uvx are installed together (uvx is an alias to `uv tool run`)
# 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 uv generate-shell-completion zsh >| "$ZSH_CACHE_DIR/completions/_uv" &|
() { uvx --generate-shell-completion zsh >| "$ZSH_CACHE_DIR/completions/_uvx" &|
local TMPPREFIX="$ZSH_CACHE_DIR/completions/_uv"
zf_mv -f -- =( uv generate-shell-completion zsh ) "$TMPPREFIX"
} &|
() {
local TMPPREFIX="$ZSH_CACHE_DIR/completions/_uvx"
zf_mv -f -- =( uvx --generate-shell-completion zsh ) "$TMPPREFIX"
} &|

View File

@@ -11,8 +11,4 @@ if [[ ! -f "$ZSH_CACHE_DIR/completions/_volta" ]]; then
_comps[volta]=_volta _comps[volta]=_volta
fi fi
zmodload -F zsh/files b:zf_mv volta completions zsh >| "$ZSH_CACHE_DIR/completions/_volta" &|
() {
local TMPPREFIX="$ZSH_CACHE_DIR/completions/_volta"
zf_mv -f -- =( volta completions zsh ) "$TMPPREFIX"
} &|

View File

@@ -221,12 +221,12 @@ supports_hyperlinks() {
# If $TERM_PROGRAM is set, these terminals support hyperlinks # If $TERM_PROGRAM is set, these terminals support hyperlinks
case "$TERM_PROGRAM" in case "$TERM_PROGRAM" in
ghostty|Hyper|iTerm.app|terminology|vscode|WezTerm) return 0 ;; Hyper|iTerm.app|terminology|WezTerm|vscode) return 0 ;;
esac esac
# These termcap entries support hyperlinks # These termcap entries support hyperlinks
case "$TERM" in case "$TERM" in
alacritty|alacritty-direct|xterm-ghostty|xterm-kitty) return 0 ;; xterm-kitty|alacritty|alacritty-direct) return 0 ;;
esac esac
# xfce4-terminal supports hyperlinks # xfce4-terminal supports hyperlinks

View File

@@ -49,31 +49,9 @@ USER=${USER:-$(id -u -n)}
# $HOME is defined at the time of login, but it could be unset. If it is unset, # $HOME is defined at the time of login, but it could be unset. If it is unset,
# a tilde by itself (~) will not be expanded to the current user's home directory. # a tilde by itself (~) will not be expanded to the current user's home directory.
# POSIX: https://pubs.opengroup.org/onlinepubs/009696899/basedefs/xbd_chap08.html#tag_08_03 # POSIX: https://pubs.opengroup.org/onlinepubs/009696899/basedefs/xbd_chap08.html#tag_08_03
if [ -z "$HOME" ]; then HOME="${HOME:-$(getent passwd $USER 2>/dev/null | cut -d: -f6)}"
HOME=$(getent passwd "$USER" 2>/dev/null | cut -d: -f6) # macOS does not have getent, but this works even if $HOME is unset
HOME="${HOME:-$(eval echo ~"$USER")}"
# macOS does not have getent; fall back to tilde expansion, but only if
# $USER is a safe username. The eval below would otherwise expand any shell
# metacharacters in $USER and allow command injection (CWE-78).
case "$USER" in
*[![:alnum:]_.-]*|'')
;;
*)
resolved_home=$(eval echo ~"$USER")
# Unknown users are not expanded and produce a literal "~username".
[ "$resolved_home" = "~$USER" ] || HOME=$resolved_home
;;
esac
case "$HOME" in
/*) ;;
*)
echo "Error: unable to determine the current user's home directory." >&2
echo "Set HOME explicitly and rerun the installer." >&2
exit 1
;;
esac
fi
# Track if $ZSH was provided # Track if $ZSH was provided
@@ -190,12 +168,12 @@ supports_hyperlinks() {
# If $TERM_PROGRAM is set, these terminals support hyperlinks # If $TERM_PROGRAM is set, these terminals support hyperlinks
case "$TERM_PROGRAM" in case "$TERM_PROGRAM" in
ghostty|Hyper|iTerm.app|terminology|vscode|WezTerm) return 0 ;; Hyper|iTerm.app|terminology|WezTerm|vscode) return 0 ;;
esac esac
# These termcap entries support hyperlinks # These termcap entries support hyperlinks
case "$TERM" in case "$TERM" in
alacritty|alacritty-direct|xterm-ghostty|xterm-kitty) return 0 ;; xterm-kitty|alacritty|alacritty-direct) return 0 ;;
esac esac
# xfce4-terminal supports hyperlinks # xfce4-terminal supports hyperlinks

View File

@@ -95,12 +95,12 @@ supports_hyperlinks() {
# If $TERM_PROGRAM is set, these terminals support hyperlinks # If $TERM_PROGRAM is set, these terminals support hyperlinks
case "$TERM_PROGRAM" in case "$TERM_PROGRAM" in
ghostty|Hyper|iTerm.app|terminology|vscode|WezTerm) return 0 ;; Hyper|iTerm.app|terminology|WezTerm|vscode) return 0 ;;
esac esac
# These termcap entries support hyperlinks # These termcap entries support hyperlinks
case "$TERM" in case "$TERM" in
alacritty|alacritty-direct|xterm-ghostty|xterm-kitty) return 0 ;; xterm-kitty|alacritty|alacritty-direct) return 0 ;;
esac esac
# xfce4-terminal supports hyperlinks # xfce4-terminal supports hyperlinks