Browse Source

Make fnm create global scoped environment variables in PowerShell (#667)

* Fix #664

* Remove unused import
remotes/origin/feat/support-install-latest
citreae535 3 years ago committed by GitHub
parent
commit
f71d0642a3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 1
      src/shell/infer/windows.rs
  2. 9
      src/shell/powershell.rs

1
src/shell/infer/windows.rs

@ -1,7 +1,6 @@ @@ -1,7 +1,6 @@
#![cfg(not(unix))]
use crate::shell::Shell;
use log::debug;
use std::ffi::OsStr;
use sysinfo::{ProcessExt, System, SystemExt};

9
src/shell/powershell.rs

@ -36,11 +36,10 @@ impl Shell for PowerShell { @@ -36,11 +36,10 @@ impl Shell for PowerShell {
};
Ok(formatdoc!(
r#"
function Set-FnmOnLoad {{ {autoload_hook} }}
function Set-LocationWithFnm {{ param($path); Set-Location $path; Set-FnmOnLoad }}
Set-Alias cd_with_fnm Set-LocationWithFnm -Force
Remove-Item alias:\cd
New-Alias cd Set-LocationWithFnm
function global:Set-FnmOnLoad {{ {autoload_hook} }}
function global:Set-LocationWithFnm {{ param($path); if ($path -eq $null) {{Set-Location}} else {{Set-Location $path}}; Set-FnmOnLoad }}
Set-Alias -Scope global cd_with_fnm Set-LocationWithFnm
Set-Alias -Option AllScope -Scope global cd Set-LocationWithFnm
Set-FnmOnLoad
"#,
autoload_hook = autoload_hook

Loading…
Cancel
Save