mirror of
https://github.com/Baipyrus/dotfiles.git
synced 2024-11-14 23:23:50 +00:00
format and fix linting for PowerShell
This commit is contained in:
parent
c7b8073f71
commit
dc79bf08fd
@ -1,7 +1,8 @@
|
|||||||
# Get internet settings
|
# Get internet settings
|
||||||
$settings = Get-ItemProperty -Path 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Internet Settings';
|
$settings = Get-ItemProperty -Path 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Internet Settings';
|
||||||
|
|
||||||
function Set-Proxy {
|
function SetProxy
|
||||||
|
{
|
||||||
# Get proxy data from settings
|
# Get proxy data from settings
|
||||||
$proxy_server = $settings.proxyServer;
|
$proxy_server = $settings.proxyServer;
|
||||||
|
|
||||||
@ -18,9 +19,10 @@ function Set-Proxy {
|
|||||||
npm config set proxy $proxy_server;
|
npm config set proxy $proxy_server;
|
||||||
npm config set https-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
|
# Unset proxy environment variables
|
||||||
$env:http_proxy = ($env:https_proxy = '')
|
$env:http_proxy = ($env:https_proxy = '')
|
||||||
[System.Environment]::SetEnvironmentVariable('http_proxy', [NullString]::Value, 'User');
|
[System.Environment]::SetEnvironmentVariable('http_proxy', [NullString]::Value, 'User');
|
||||||
@ -34,7 +36,10 @@ function Unset-Proxy {
|
|||||||
npm config delete proxy;
|
npm config delete proxy;
|
||||||
npm config delete https-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 }
|
if ($settings.proxyEnable -and (!$env:http_proxy))
|
||||||
elseif ((!$settings.proxyEnable) -and $env:http_proxy) { Unset-Proxy }
|
{ SetProxy;
|
||||||
|
} elseif ((!$settings.proxyEnable) -and $env:http_proxy)
|
||||||
|
{ UnsetProxy;
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user