Last active
January 11, 2023 15:25
-
-
Save cderv/fcef10e9d890c8eeb796f842d85a3bc1 to your computer and use it in GitHub Desktop.
Switch between Dev and Release Quarto binary
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Switch-Path { | |
param() | |
$paths=$([Environment]::GetEnvironmentVariable('Path','User') -Split ";") | |
$dev = $paths | Select-String -SimpleMatch "quarto-cli\package\dist\bin" | |
$rel = $paths | Select-String -SimpleMatch "scoop\shims" | |
$rel_i=[array]::IndexOf($paths, "$rel") | |
$dev_i=[array]::IndexOf($paths, "$dev") | |
if ($dev_i -gt $rel_i) { | |
$old = $paths[$dev_i] | |
$paths[$dev_i] = $paths[$rel_i] | |
$paths[$rel_i] = $old | |
} else { | |
$old = $paths[$dev_i] | |
$paths[$dev_i] = $paths[$rel_i] | |
$paths[$rel_i] = $old | |
} | |
[Environment]::SetEnvironmentVariable('Path', $paths -Join ';', 'User') | |
} | |
Export-ModuleMember -Function Switch-Path |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment