Installers persist PATH themselves instead of printing instructions
install.sh: append the export line to the login shell's rc file (zsh: $ZDOTDIR/.zshrc; bash: ~/.bash_profile on macOS, ~/.bashrc on Linux; fish: fish_add_path in config.fish; otherwise ~/.profile). Idempotent — a second run detects the existing entry and skips. On an unwritable rc it fails loudly with the manual command. install.ps1: prepend the bin dir to the per-user PATH via [Environment]::SetEnvironmentVariable(..., 'User') — registry-backed, picked up by every new terminal. Strict-mode-safe for a null user Path. Verified end-to-end on macOS with a fake HOME: install → rc appended → fresh zsh sources it → kigi resolves and runs. All shell branches, ZDOTDIR/XDG overrides, idempotency, and the write-failure path covered by a harness driving the real script tail; install.ps1 parse-checked and its path-construction logic exercised under pwsh strict mode.
This commit is contained in:
+6
-5
@@ -138,12 +138,13 @@ try {
|
||||
$OnPath = (($UserPath -split ";") -contains $BinDir) -or
|
||||
(($env:Path -split ";") -contains $BinDir)
|
||||
if (-not $OnPath) {
|
||||
# Persist the bin dir on the per-user PATH so the user doesn't have
|
||||
# to. Registry-backed; every new terminal picks it up automatically.
|
||||
$NewUserPath = if ($UserPath) { "$BinDir;$UserPath" } else { $BinDir }
|
||||
[Environment]::SetEnvironmentVariable("Path", $NewUserPath, "User")
|
||||
Write-Host ""
|
||||
Write-Host "$BinDir is not on your PATH. Add it for the current user with:"
|
||||
Write-Host ""
|
||||
Write-Host " [Environment]::SetEnvironmentVariable('Path', `"$BinDir;`" + [Environment]::GetEnvironmentVariable('Path', 'User'), 'User')"
|
||||
Write-Host ""
|
||||
Write-Host "Then open a new terminal and run 'kigi' to get started."
|
||||
Write-Host "Added $BinDir to your user PATH."
|
||||
Write-Host "Open a new terminal, then run 'kigi' to get started."
|
||||
} else {
|
||||
Write-Host "Run 'kigi' to get started."
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user