20 lines
619 B
PowerShell
20 lines
619 B
PowerShell
[CmdletBinding(SupportsShouldProcess)]param(
|
|
[string[]]$ProjectPath=@($PWD),
|
|
[switch]$Force,
|
|
[string[]]$AdditionalFiles
|
|
|
|
)
|
|
|
|
$local:editCandidates = @('docker-compose.yml','.base.docker-compose.yml')
|
|
$local:editFiles = @()
|
|
foreach( $local:fileName in $EditCandidates ) {
|
|
foreach( $local:path in $ProjectPath ) {
|
|
$local:testPath = Join-Path $path $fileName
|
|
if( $Force -or $(Test-Path $testPath) ) { $editFiles += $testPath }
|
|
}
|
|
}
|
|
|
|
Edit-TextFile ($editFiles + $AdditionalFiles)
|
|
|
|
$editFiles | Select-Object -First 1 | ForEach-Object { docker-compose --file $(Resolve-Path $_) config -q }
|