diff --git a/docker/Edit-DockerCompose.ps1 b/docker/Edit-DockerCompose.ps1 index 0215876..4670800 100644 --- a/docker/Edit-DockerCompose.ps1 +++ b/docker/Edit-DockerCompose.ps1 @@ -14,15 +14,27 @@ ) -$local:editCandidates = @('docker-compose.yml','.base.docker-compose.yml','Dockerfile') +$local:EditCandidates = @('docker-compose.###','.base.docker-compose.###') +$local:EditBonus = @('Dockerfile', '.env', '*.env') $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 } +foreach( $local:ext in @('.yml', '.yaml') ) { + $local:rawEditCandidates = $EditCandidates | ForEach-Object { $_ -replace '\.###',$ext } + foreach( $local:fileName in $rawEditCandidates ) { + foreach( $local:path in $ProjectPath ) { + $local:testPath = Join-Path $path $fileName + if( $Force -or $(Test-Path $testPath) ) { + $editFiles += $testPath + $editFiles += Get-ChildItem $(Join-Path $path '*') -Include $EditBonus -Depth 1 + } + } } + if( -not $editFiles ) { continue } + + + break } + Edit-TextFile ($($editFiles | Sort-Object) + $AdditionalFiles) $editFiles | Select-Object -First 1 | ForEach-Object { docker-compose --file $(Resolve-Path $_) config -q }