Skip to content

Commit 83acd44

Browse files
🩹 [Patch]: Simplify module installation logic by removing unnecessary variable assignments
1 parent cf6e867 commit 83acd44

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

‎scripts/main.ps1‎

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,12 @@ param(
1111
$PSStyle.OutputRendering = 'Ansi'
1212

1313
'Microsoft.PowerShell.PlatyPS' | ForEach-Object {
14-
$name = $_
15-
Write-Output "Installing module: $name"
14+
Write-Output "Installing module: $_"
1615
$retryCount = 5
1716
$retryDelay = 10
1817
for ($i = 0; $i -lt $retryCount; $i++) {
1918
try {
20-
Install-PSResource -Name $name -WarningAction SilentlyContinue -TrustRepository -Repository PSGallery
19+
Install-PSResource -Name $_ -WarningAction SilentlyContinue -TrustRepository -Repository PSGallery
2120
break
2221
} catch {
2322
Write-Warning "Installation of $($psResourceParams.Name) failed with error: $_"
@@ -28,7 +27,7 @@ $PSStyle.OutputRendering = 'Ansi'
2827
Start-Sleep -Seconds $retryDelay
2928
}
3029
}
31-
Import-Module -Name $name
30+
Import-Module -Name $_
3231
}
3332

3433
$path = (Join-Path -Path $PSScriptRoot -ChildPath 'helpers') | Get-Item | Resolve-Path -Relative

0 commit comments

Comments
 (0)