From dc79bf08fd72a5fa6f936b17d8c4b8568bbda0cd Mon Sep 17 00:00:00 2001 From: Baipyrus Date: Mon, 26 Aug 2024 21:03:54 +0200 Subject: [PATCH] format and fix linting for PowerShell --- PowerShell/Microsoft.PowerShell_profile.ps1 | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/PowerShell/Microsoft.PowerShell_profile.ps1 b/PowerShell/Microsoft.PowerShell_profile.ps1 index 75aed95..4da1a85 100644 --- a/PowerShell/Microsoft.PowerShell_profile.ps1 +++ b/PowerShell/Microsoft.PowerShell_profile.ps1 @@ -1,7 +1,8 @@ # Get internet settings $settings = Get-ItemProperty -Path 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Internet Settings'; -function Set-Proxy { +function SetProxy +{ # Get proxy data from settings $proxy_server = $settings.proxyServer; @@ -18,9 +19,10 @@ function Set-Proxy { npm config set proxy $proxy_server; npm config set https-proxy $proxy_server; } -Set-Alias -Name proxy-set -Value Set-Proxy +Set-Alias -Name Proxy-Set -Value SetProxy; -function Unset-Proxy { +function UnsetProxy +{ # Unset proxy environment variables $env:http_proxy = ($env:https_proxy = '') [System.Environment]::SetEnvironmentVariable('http_proxy', [NullString]::Value, 'User'); @@ -34,7 +36,10 @@ function Unset-Proxy { npm config delete proxy; npm config delete https-proxy; } -Set-Alias -Name proxy-unset -Value Unset-Proxy +Set-Alias -Name Proxy-Unset -Value UnsetProxy; -if ($settings.proxyEnable -and (!$env:http_proxy)) { Set-Proxy } -elseif ((!$settings.proxyEnable) -and $env:http_proxy) { Unset-Proxy } +if ($settings.proxyEnable -and (!$env:http_proxy)) +{ SetProxy; +} elseif ((!$settings.proxyEnable) -and $env:http_proxy) +{ UnsetProxy; +}