@@ -5,26 +5,32 @@ $script:defaultConfigPath = "$PSScriptRoot\..\Config\config.json"
55$script :registryConfigPath = " HKLM:\SOFTWARE\PythonPowershellUtilities"
66
77function Get-PythonUtilitiesConfigValue ([string ]$Key ){
8+ $Null = @ (
89 # Add registry keys if they haven't been added already, otherwise just return them
910 if (! (Test-Path $script :registryConfigPath )){
1011 New-Item - Path $script :registryConfigPath
1112 Set-PythonUtilitiesConfigValue - Key " PythonInstallRoot" - Value " C:\PythonInstallations"
1213 Set-PythonUtilitiesConfigValue - Key " VirtualEnvironmentRoot" - Value " C:\PythonVirtualEnvironments"
1314 }
1415 $entry = Get-ItemProperty $script :registryConfigPath - Name $Key
16+ )
1517 return $entry .$Key
1618}
1719
1820function Set-PythonUtilitiesConfigValue ([string ]$Key , [string ]$Value ){
19- Set-ItemProperty - Path $script :registryConfigPath - Name $Key - Value $Value
21+ $Null = @ (
22+ Set-ItemProperty - Path $script :registryConfigPath - Name $Key - Value $Value > $null
23+ )
2024}
2125
2226function Get-PythonInstallerCache (){
27+ $Null = @ (
2328 $installRoot = Get-PythonInstallRoot
2429 $installerCache = " $installRoot \Installers"
2530 if (! (Test-Path $installerCache )){
26- New-Item - ItemType Directory - Path $installerCache - Force | Out-Null
31+ New-Item - ItemType Directory - Path $installerCache - Force > $null
2732 }
33+ )
2834 return $installerCache
2935}
3036
@@ -33,6 +39,7 @@ function Get-PythonInstallRoot(){
3339}
3440
3541function Set-PythonInstallRoot ([string ]$Path , [switch ]$Force = $false ){
42+ $Null = @ (
3643 $installRoot = Get-PythonInstallRoot
3744 $installerCache = Get-PythonInstallerCache
3845 if (Test-Path - Path $installerCache ){
@@ -57,15 +64,17 @@ function Set-PythonInstallRoot([string]$Path, [switch]$Force=$false){
5764 }
5865 }
5966 }
60- New-Item - ItemType directory - Path " $Path \Installers" - Force | Out-Null
67+ New-Item - ItemType directory - Path " $Path \Installers" - Force > $null
6168 Set-PythonUtilitiesConfigValue - Key " PythonInstallRoot" - Value $Path
69+ )
6270}
6371
6472function Get-VirtualEnvironmentRoot (){
6573 return Get-PythonUtilitiesConfigValue - Key " VirtualEnvironmentRoot"
6674}
6775
6876function Set-VirtualEnvironmentRoot ([string ]$Path , [switch ]$Force ){
77+ $Null = @ (
6978 if (! $Force ){
7079 $venvRootPath = Get-VirtualEnvironmentRoot
7180 if (Test-Path $venvRootPath ) {
@@ -79,4 +88,5 @@ function Set-VirtualEnvironmentRoot([string]$Path, [switch]$Force){
7988 }
8089 }
8190 Set-PythonUtilitiesConfigValue - Key " VirtualEnvironmentRoot" - Value $Path
91+ )
8292}
0 commit comments