Fixed Edit-DockerCompose to treat multiple files

This commit is contained in:
lksz 2021-01-18 19:04:39 -05:00
parent 1b62fd1114
commit b9c429ece4
1 changed files with 12 additions and 7 deletions

View File

@ -24,17 +24,22 @@ foreach( $local:ext in @('.yml', '.yaml') ) {
$local:testPath = Join-Path $path $fileName $local:testPath = Join-Path $path $fileName
if( $Force -or $(Test-Path $testPath) ) { if( $Force -or $(Test-Path $testPath) ) {
$editFiles += $testPath $editFiles += $testPath
$editFiles += Get-ChildItem $(Join-Path $path '*') -Include $EditBonus -Depth 1 $editFiles += Get-ChildItem $(Join-Path $path '*') -Include $EditBonus -Depth 1 |
Select-Object -ExpandProperty FullName
} }
} }
} }
if( -not $editFiles ) { continue } if( $editFiles ) {
break break
} }
}
$local:FinalEditList = $editFiles | Where-Object {$_} | Sort-Object {
$local:n = [System.IO.Path]::GetFileName($_)
Join-Path [PSystem.IO.ath]::GetDirectoryName($_) "$(if( $n[0] -eq '.' ) { "9" } else { "1" })$n"
}
$FinalEditList = @() + $FinalEditList + @() + $AdditionalFiles
Edit-TextFile ($($editFiles | Sort-Object) + $AdditionalFiles) Edit-TextFile $FinalEditList
$editFiles | Select-Object -First 1 | ForEach-Object { docker-compose --file $(Resolve-Path $_) config -q } $editFiles | Select-Object -First 1 | ForEach-Object { docker-compose --file $(Resolve-Path $_) config -q }