dcsw defaults to nochange, dcl fixed

This commit is contained in:
lksz 2021-09-23 21:56:01 -04:00
parent c395c28e01
commit 5e76d5a0ba
2 changed files with 22 additions and 11 deletions

View File

@ -3,8 +3,8 @@
[switch]$On,
[Parameter(ParameterSetName="Off",Mandatory)]
[switch]$Off,
[Parameter(ParameterSetName="Query",Mandatory)]
[switch]$NoChange,
[Parameter(ParameterSetName="Toggle",Mandatory)]
[switch]$Toggle,
[switch]$Recurse,
[int]$Depth=1,
[Parameter(ParameterSetName="On",Position = 0, ValueFromRemainingArguments)]
@ -42,24 +42,35 @@ $ProjectPath | ForEach-Object {
}
if( -not $dcPathList ) { return }
$local:QueryOnly = -not $On -and -not $Off -and -not $Toggle
$dcPathList | ForEach-Object {
$local:name = "$_"
if( $PWD -like $name ) {
$name = Split-Path -Leaf $name
} else {
$name = $($name.Replace($PWD.Path,'').Substring(1))
}
$local:NoAutoPath = $(Join-Path $_ '.noauto.all')
$local:NoAutoOffPath = "${NoAutoPath}.off"
$local:IsNoAuto = Test-Path $NoAutoPath
$local:IsNoAutoOff = Test-Path $NoAutoOffPath
$local:IsOff = Test-Path $NoAutoPath
$local:IsExplicitOn = Test-Path $NoAutoOffPath
if( ($NoChange -and $IsNoAuto) -or (-not $NoChange -and ($Off -or (-not $On -and -not $IsNoAuto)) ) ) {
if( $IsNoAutoOff ) {
$local:SetOff = $Off -or ($Toggle -and -not $IsOff)
$local:SetOn = $On -or ($Toggle -and $IsOff)
if( ($QueryOnly -and $IsOff) -or (-not $QueryOnly -and $SetOff) ) {
if( -not $QueryOnly -and $IsExplicitOn ) {
Move-Item $NoAutoOffPath $NoAutoPath
} elseif( -not $IsNoAuto -and -not $NoChange ) {
} elseif( -not $QueryOnly -and -not $IsOff ) {
$null = New-Item -ItemType File -Path $NoAutoPath -Value ""
}
Write-Host -ForegroundColor Magenta -NoNewline "Off"
} elseif( $NoChange -or $On -or (-not $Off -and $IsNoAuto) ) {
if( $IsNoAuto -and -not $NoChange ) {
} elseif( ($QueryOnly -and -not $IsOff) -or (-not $QueryOnly -and $SetOn) ) {
if( -not $QueryOnly -and $IsOff ) {
Move-Item $NoAutoPath $NoAutoOffPath
}
Write-Host -ForegroundColor Gree -NoNewline "On "
}
Write-Host -ForegroundColor Cyan " $("$_".Replace($PWD.Path,'').Substring(1))"
Write-Host -ForegroundColor Cyan " $name"
}

View File

@ -7,6 +7,6 @@
)
if( -not $CliParams -or $CliParams[0] -is [string] ) { $CliParams = @($CliParams,@($null)) }
$CliParams[0] = @('logs','--tail=40','follow') + $CliParams[0]
$CliParams[0] = @('logs','--tail=40','--follow') + $CliParams[0]
Invoke-DockerCompose -ProjectPath $ProjectPath -CliParams $CliParams