- pj_completions: merge into $env.config instead of replacing it wholesale - pj_completions: use parse-time const for cache dir instead of pwd fallback - pj_fzf / pj_historyhintcomplete: null-safe keybindings access via ? and default - pj_helix: replace $env.OS (Windows-only) with $nu.os-info.name; extract shared launcher - pj_prompt: fix off-by-one in git OID substring (0..7 -> 0..<7) - pj_prompt: use $nu.os-info.name for OS detection instead of sys host hostname - pj_prompt: cache git availability in static base, skip per-render which call - pj_prompt: bind LAST_EXIT_CODE once in right-prompt closure - pj_brew / pj_uv: add --ignore-errors to hide-env calls - pj_aliases: convert quote/dadjoke to defs with try/catch error handling - pj_deepseek: guard curl availability before invoking - pj_zoxide: add ? to $nu.os-info.name access - pj_starship: fix null-to-nuon producing "null" string; broaden detection - nu_polyjuice: load pj_starship module
25 lines
1.1 KiB
Nu
25 lines
1.1 KiB
Nu
export def --env "pj brewthu" [] {
|
|
let os_name = ($nu.os-info.name? | default "" | into string | str lowercase)
|
|
if not (($os_name | str contains "darwin") or ($os_name | str contains "macos")) {
|
|
return
|
|
}
|
|
|
|
let bottle_domain = ($env.HOMEBREW_BOTTLE_DOMAIN? | default "")
|
|
|
|
if ($bottle_domain | is-empty) {
|
|
load-env {
|
|
HOMEBREW_API_DOMAIN: "https://mirrors.tuna.tsinghua.edu.cn/homebrew-bottles/api"
|
|
HOMEBREW_BOTTLE_DOMAIN: "https://mirrors.tuna.tsinghua.edu.cn/homebrew-bottles"
|
|
HOMEBREW_BREW_GIT_REMOTE: "https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/brew.git"
|
|
HOMEBREW_CORE_GIT_REMOTE: "https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-core.git"
|
|
HOMEBREW_PIP_INDEX_URL: "https://pypi.tuna.tsinghua.edu.cn/simple"
|
|
}
|
|
} else {
|
|
hide-env --ignore-errors HOMEBREW_API_DOMAIN
|
|
hide-env --ignore-errors HOMEBREW_BOTTLE_DOMAIN
|
|
hide-env --ignore-errors HOMEBREW_BREW_GIT_REMOTE
|
|
hide-env --ignore-errors HOMEBREW_CORE_GIT_REMOTE
|
|
hide-env --ignore-errors HOMEBREW_PIP_INDEX_URL
|
|
}
|
|
}
|