Features: *(none)*;
Fixes: 1) Add `-Force` flag to `New-Item` to overwrite environment variables if they already exist; Extra: 1) Remove unused spinner logic from script for better readability and maintainability.
This commit is contained in:
parent
e3ff0bd7ec
commit
9ac562ed9c
1 changed files with 1 additions and 34 deletions
|
|
@ -25,39 +25,6 @@ $art -split "`r?`n" | ForEach-Object {
|
||||||
|
|
||||||
Write-Host "`n by WISELESS TEAM`n" -ForegroundColor Gray
|
Write-Host "`n by WISELESS TEAM`n" -ForegroundColor Gray
|
||||||
|
|
||||||
$Spinner = @('|', '/', '-', '\')
|
|
||||||
$Colors = @('White', 'Gray')
|
|
||||||
$Delay = 100
|
|
||||||
|
|
||||||
function Invoke-Spinner
|
|
||||||
{
|
|
||||||
[CmdletBinding()]
|
|
||||||
param(
|
|
||||||
[Parameter(Mandatory)][string]$Arguments,
|
|
||||||
[Parameter(Mandatory)][string]$Message
|
|
||||||
)
|
|
||||||
Write-Host -NoNewLine -ForegroundColor Cyan ("{0}… " -f $Message)
|
|
||||||
$si = New-Object System.Diagnostics.ProcessStartInfo
|
|
||||||
$si.FileName = "docker"
|
|
||||||
$si.Arguments = "$Arguments --ansi never"
|
|
||||||
$si.RedirectStandardOutput = $true
|
|
||||||
$si.RedirectStandardError = $true
|
|
||||||
$si.UseShellExecute = $false
|
|
||||||
$p = [System.Diagnostics.Process]::Start($si)
|
|
||||||
$i = 0
|
|
||||||
while (-not $p.HasExited)
|
|
||||||
{
|
|
||||||
$frame = $Spinner[$i % $Spinner.Length]
|
|
||||||
$col = $Colors[$i % $Colors.Length]
|
|
||||||
Write-Host -NoNewLine -ForegroundColor $col $frame
|
|
||||||
Start-Sleep -Milliseconds $Delay
|
|
||||||
Write-Host -NoNewLine "`b"
|
|
||||||
$i++
|
|
||||||
}
|
|
||||||
$p.WaitForExit()
|
|
||||||
Write-Host -ForegroundColor Green "✔"
|
|
||||||
}
|
|
||||||
|
|
||||||
$envFile = '.env'
|
$envFile = '.env'
|
||||||
|
|
||||||
if (-not (Test-Path $envFile))
|
if (-not (Test-Path $envFile))
|
||||||
|
|
@ -94,7 +61,7 @@ Get-Content $envFile | ForEach-Object {
|
||||||
$value = $value.Substring(1, $value.Length - 2)
|
$value = $value.Substring(1, $value.Length - 2)
|
||||||
}
|
}
|
||||||
|
|
||||||
New-Item -Path Env:\$key -Value $value | Out-Null
|
New-Item -Force -Path Env:\$key -Value $value | Out-Null
|
||||||
$envVars[$key] = $value
|
$envVars[$key] = $value
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue