fix(nushell): improve robustness and clarify abstraction boundaries

- 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
This commit is contained in:
2026-07-31 00:31:04 +08:00
parent 427fa547a6
commit deb4e45c4e
13 changed files with 78 additions and 80 deletions
+3 -7
View File
@@ -96,11 +96,7 @@ export def "pj completion" [
}
let repo_url = "https://github.com/nushell/nu_scripts.git"
let cache_dir = if ('NU_POLYJUICE_PATH' in $env) {
($env.NU_POLYJUICE_PATH | path join 'cache')
} else {
(pwd | path join 'nushell' 'cache')
}
let cache_dir = $pj_cache_dir
let repo_dir = ($cache_dir | path join 'nu_scripts')
let completion_dir = ($repo_dir | path join 'custom-completions')
@@ -169,7 +165,7 @@ export def "pj completion" [
}
export-env {
$env.config = {
$env.config = ($env.config? | default {} | merge {
completions: {
quick: true
partial: true
@@ -180,7 +176,7 @@ export-env {
max_results: 100
}
}
}
})
if not ($pj_completion_registry_module | path exists) {
mkdir $pj_cache_dir