dcsw defaults to nochange, dcl fixed
This commit is contained in:
parent
c395c28e01
commit
5e76d5a0ba
|
@ -3,8 +3,8 @@
|
||||||
[switch]$On,
|
[switch]$On,
|
||||||
[Parameter(ParameterSetName="Off",Mandatory)]
|
[Parameter(ParameterSetName="Off",Mandatory)]
|
||||||
[switch]$Off,
|
[switch]$Off,
|
||||||
[Parameter(ParameterSetName="Query",Mandatory)]
|
[Parameter(ParameterSetName="Toggle",Mandatory)]
|
||||||
[switch]$NoChange,
|
[switch]$Toggle,
|
||||||
[switch]$Recurse,
|
[switch]$Recurse,
|
||||||
[int]$Depth=1,
|
[int]$Depth=1,
|
||||||
[Parameter(ParameterSetName="On",Position = 0, ValueFromRemainingArguments)]
|
[Parameter(ParameterSetName="On",Position = 0, ValueFromRemainingArguments)]
|
||||||
|
@ -42,24 +42,35 @@ $ProjectPath | ForEach-Object {
|
||||||
}
|
}
|
||||||
if( -not $dcPathList ) { return }
|
if( -not $dcPathList ) { return }
|
||||||
|
|
||||||
|
$local:QueryOnly = -not $On -and -not $Off -and -not $Toggle
|
||||||
|
|
||||||
$dcPathList | ForEach-Object {
|
$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:NoAutoPath = $(Join-Path $_ '.noauto.all')
|
||||||
$local:NoAutoOffPath = "${NoAutoPath}.off"
|
$local:NoAutoOffPath = "${NoAutoPath}.off"
|
||||||
$local:IsNoAuto = Test-Path $NoAutoPath
|
$local:IsOff = Test-Path $NoAutoPath
|
||||||
$local:IsNoAutoOff = Test-Path $NoAutoOffPath
|
$local:IsExplicitOn = Test-Path $NoAutoOffPath
|
||||||
|
|
||||||
if( ($NoChange -and $IsNoAuto) -or (-not $NoChange -and ($Off -or (-not $On -and -not $IsNoAuto)) ) ) {
|
$local:SetOff = $Off -or ($Toggle -and -not $IsOff)
|
||||||
if( $IsNoAutoOff ) {
|
$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
|
Move-Item $NoAutoOffPath $NoAutoPath
|
||||||
} elseif( -not $IsNoAuto -and -not $NoChange ) {
|
} elseif( -not $QueryOnly -and -not $IsOff ) {
|
||||||
$null = New-Item -ItemType File -Path $NoAutoPath -Value ""
|
$null = New-Item -ItemType File -Path $NoAutoPath -Value ""
|
||||||
}
|
}
|
||||||
Write-Host -ForegroundColor Magenta -NoNewline "Off"
|
Write-Host -ForegroundColor Magenta -NoNewline "Off"
|
||||||
} elseif( $NoChange -or $On -or (-not $Off -and $IsNoAuto) ) {
|
} elseif( ($QueryOnly -and -not $IsOff) -or (-not $QueryOnly -and $SetOn) ) {
|
||||||
if( $IsNoAuto -and -not $NoChange ) {
|
if( -not $QueryOnly -and $IsOff ) {
|
||||||
Move-Item $NoAutoPath $NoAutoOffPath
|
Move-Item $NoAutoPath $NoAutoOffPath
|
||||||
}
|
}
|
||||||
Write-Host -ForegroundColor Gree -NoNewline "On "
|
Write-Host -ForegroundColor Gree -NoNewline "On "
|
||||||
}
|
}
|
||||||
Write-Host -ForegroundColor Cyan " $("$_".Replace($PWD.Path,'').Substring(1))"
|
Write-Host -ForegroundColor Cyan " $name"
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,6 +7,6 @@
|
||||||
)
|
)
|
||||||
|
|
||||||
if( -not $CliParams -or $CliParams[0] -is [string] ) { $CliParams = @($CliParams,@($null)) }
|
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
|
Invoke-DockerCompose -ProjectPath $ProjectPath -CliParams $CliParams
|
||||||
|
|
Loading…
Reference in New Issue