+ ConvertTo-Zip: Added -MuteSkipped
* sz-df sorting fixed + -PassThru added, defaulting output to
  Format-Table unless -PassThru switch is specified which will output
  the objects raw.
* Edit-DockerCompose fixed duplicate 'AdditionalFiles'
* dcup and dcreup fixed: added --remove-orphans
This commit is contained in:
lksz 2021-02-03 19:43:12 -05:00
parent 3d57308616
commit e2fe1a8f06
5 changed files with 35 additions and 16 deletions

View File

@ -7,6 +7,7 @@
[string]$ZipOptions="-mm=Deflate -mfb=258 -mpass=15", [string]$ZipOptions="-mm=Deflate -mfb=258 -mpass=15",
[string]$MoveProcessedTo="done", [string]$MoveProcessedTo="done",
[switch]$Flatten, [switch]$Flatten,
[switch]$MuteSkipped,
[switch]$Force [switch]$Force
) )
@ -115,6 +116,7 @@ foreach( $local:srcFile in $srcSet ) {
Move-Item @moveParams Move-Item @moveParams
} }
if( $ActionStatus -eq 'Skipped' -and $MuteSkipped ) { continue }
[PSCustomObject]([ordered]@{ [PSCustomObject]([ordered]@{
Action = $ActionStatus Action = $ActionStatus
SrcMoved = $(if($DonePath){ $true } else {$false}) SrcMoved = $(if($DonePath){ $true } else {$false})

View File

@ -1,4 +1,4 @@
param([ValidateSet('KB','GB','TB')]$SizeUnitName = 'GB') param([ValidateSet('KB','GB','TB')]$SizeUnitName = 'GB',[switch]$NoFilter,[switch]$PassThru)
$local:zpool_cmd = $null $local:zpool_cmd = $null
$local:excludeType = '' $local:excludeType = ''
@ -21,16 +21,33 @@ function NewDataRow{param($Size,$Used,$Available,$Percent,$Source,$FSType,$Targe
} }
} }
Set-Alias Out-Default Format-Table
if( $PassThru ) {
Get-Item alias:/Out-Default | Remove-Item
}
$local:filterParam = [ordered]@{}
if( -not $NoFilter ) { $filterParam.First = 1 }
$local:df = @() $local:df = @()
$(
& df '--output=size,used,avail,pcent,source,fstype,target' | & df '--output=size,used,avail,pcent,source,fstype,target' |
Select-Object -Skip 1 | ForEach-Object { Select-Object -Skip 1 | ForEach-Object {
$local:df = $_.Split(' ', [StringSplitOptions]::RemoveEmptyEntries) $local:df = $_.Split(' ', [StringSplitOptions]::RemoveEmptyEntries)
NewDataRow $df[0] $df[1] $df[2] $df[3] $df[4] $df[5] $df[6] NewDataRow $df[0] $df[1] $df[2] $df[3] $df[4] $df[5] $df[6]
} | } |
Sort-Object -Property FSType,Target |
Group-Object -Property FSType | Group-Object -Property FSType |
ForEach-Object { ForEach-Object {
if( $_.Name -eq 'zfs' ) { $_.Group | Group-Object -Property Group | ForEach-Object { $_.Group | Select-Object -First 1 } } if( $_.Name -eq 'zfs' ) {
$_.Group |
Group-Object -Property Group |
ForEach-Object {
$_.Group | Sort-Object -Property Source | Select-Object @filterParam
}
}
else { $_.Group } else { $_.Group }
} | } |
Select-Object -Property "Size$SizeUnitName","Used$SizeUnitName","Available$SizeUnitName",'Used%',Source,FSType,Target | Select-Object -Property "Size$SizeUnitName","Used$SizeUnitName","Available$SizeUnitName",'Used%',Source,FSType,Target
Sort-Object -Property FSType,Target ) |
Out-Default

View File

@ -47,7 +47,7 @@ $local:FinalEditList = $editFiles | Where-Object {$_} | Sort-Object {
$local:n = [System.IO.Path]::GetFileName($_) $local:n = [System.IO.Path]::GetFileName($_)
Join-Path [PSystem.IO.ath]::GetDirectoryName($_) "$(if( $n[0] -eq '.' ) { "9" } else { "1" })$n" Join-Path [PSystem.IO.ath]::GetDirectoryName($_) "$(if( $n[0] -eq '.' ) { "9" } else { "1" })$n"
} }
$FinalEditList = @() + $FinalEditList + @() + $AdditionalFiles $FinalEditList = (@() + $FinalEditList + @() + $AdditionalFiles) | Select-Object -Unique
Edit-TextFile $FinalEditList Edit-TextFile $FinalEditList

View File

@ -15,7 +15,7 @@
[switch]$NoPull, [switch]$NoPull,
[array]$PullParams, [array]$PullParams,
[array]$LogsParams, [array]$LogsParams,
[array]$UpParams=@('-d'), [array]$UpParams=@('-d','--remove-orphans'),
[Parameter(Position = 0, ValueFromRemainingArguments = $true)] [Parameter(Position = 0, ValueFromRemainingArguments = $true)]
[array]$Containers [array]$Containers
) )

View File

@ -15,7 +15,7 @@
[switch]$NoPull, [switch]$NoPull,
[array]$PullParams, [array]$PullParams,
[array]$LogsParams, [array]$LogsParams,
[array]$UpParams=@('-d'), [array]$UpParams=@('-d','--remove-orphans'),
[Parameter(Position = 0, ValueFromRemainingArguments = $true)] [Parameter(Position = 0, ValueFromRemainingArguments = $true)]
[array]$Containers [array]$Containers
) )