diff options
| author | TheSiahxyz <164138827+TheSiahxyz@users.noreply.github.com> | 2026-05-14 15:39:14 +0900 |
|---|---|---|
| committer | TheSiahxyz <164138827+TheSiahxyz@users.noreply.github.com> | 2026-05-14 15:39:14 +0900 |
| commit | 7bab6f2679c40340afa3839f25b32ce3acb3014f (patch) | |
| tree | 5e1f3606fc7fdacafbe58750cadc4d59e32ef13d /ar/.config/zsh | |
| parent | 0b62b36715ee2ea7ec015ed0842f698451a9eb9f (diff) | |
Diffstat (limited to 'ar/.config/zsh')
| -rw-r--r-- | ar/.config/zsh/packages.zsh | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/ar/.config/zsh/packages.zsh b/ar/.config/zsh/packages.zsh index b3931f5..2210ed2 100644 --- a/ar/.config/zsh/packages.zsh +++ b/ar/.config/zsh/packages.zsh @@ -1,20 +1,27 @@ #!/bin/zsh ### --- Packages --- ### +# Value format: "<subcmd> [args...]" +# Most tools use `init` (zoxide/atuin/batman/...); some use `hook` (direnv), +# `activate` (mise), `env` (fnm), etc. — encode it per-package. typeset -A packages packages=( - atuin "--disable-up-arrow" - batman "--export-env" - zoxide "--cmd cd --hook prompt" - tmuxdbussync "" + atuin "init --disable-up-arrow" + batman "init --export-env" + direnv "hook" + zoxide "init --cmd cd --hook prompt" + tmuxdbussync "init" ) ### --- Eval Function --- ### eval_packages() { for package in ${(k)packages}; do if command -v "$package" >/dev/null; then - local args=(${(s: :)packages[$package]}) - [[ ${#args[@]} -gt 0 ]] && eval "$($package init zsh ${args[@]})" || eval "$($package init zsh)" + local parts=(${(s: :)packages[$package]}) + (( ${#parts[@]} > 0 )) || continue + local subcmd=${parts[1]} + local args=(${parts[2,-1]}) + eval "$($package $subcmd zsh ${args[@]})" fi done } |
