From a6ae67ade6d8afa1fb0b5c2db053e39e41624d8e Mon Sep 17 00:00:00 2001 From: Eyre_S Date: Tue, 2 Apr 2024 12:24:41 +0800 Subject: [PATCH] add python version by hatch in pwsh --- PowerShell/Microsoft.PowerShell_profile.ps1 | 22 +++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/PowerShell/Microsoft.PowerShell_profile.ps1 b/PowerShell/Microsoft.PowerShell_profile.ps1 index 44ba0f4..2ebb043 100644 --- a/PowerShell/Microsoft.PowerShell_profile.ps1 +++ b/PowerShell/Microsoft.PowerShell_profile.ps1 @@ -8,6 +8,8 @@ <# ================= - user variable #> +. "$HOME/OneDrive/sukazyo-pin/environment.ps1" + $ws = "S:\workspace" $tests = "S:\__test" @@ -26,6 +28,10 @@ function whereis { Get-Command $args | Format-List } +function dos2unix { & "C:/Program Files/Git/usr/bin/dos2unix" $args } + +function unix2dos { & "C:/Program Files/Git/usr/bin/unix2dos" $args } + <# == batcat == #> Set-Alias -Name cat -Value bat @@ -200,6 +206,22 @@ Set-Alias -Name cdi -Value zi # Import-Module "$ChocolateyProfile" # } +<# === Python Versions managered by hatch === #> + +$pythons = "$HOME/AppData/Local/hatch/pythons" + +function pys () { + $version, $args_pass = $args + $py_path = "$pythons/$version/python" + echo "using Python version : $version" + echo "using Python path : $py_path" + & "$py_path/python.exe" $args_pass +} + +function pysm () { + hatch python $args +} + <# === Oh-My-Posh === #> # $USE_POSH_THEME = "catppuccin"