use convertto-bool for rm and recurse params
This commit is contained in:
parent
2d1189dee8
commit
01b36130a8
1 changed files with 8 additions and 9 deletions
|
@ -62,16 +62,15 @@ Else {
|
||||||
Fail-Json $result "missing required argument: dest"
|
Fail-Json $result "missing required argument: dest"
|
||||||
}
|
}
|
||||||
|
|
||||||
If ($params.recurse -eq "true" -Or $params.recurse -eq "yes") {
|
If ($params.recurse) {
|
||||||
$recurse = $true
|
$recurse = ConvertTo-Bool ($params.recurse)
|
||||||
}
|
}
|
||||||
Else {
|
Else {
|
||||||
$recurse = $false
|
$recurse = $false
|
||||||
}
|
}
|
||||||
|
|
||||||
If ($params.rm -eq "true" -Or $params.rm -eq "yes"){
|
If ($params.rm) {
|
||||||
$rm = $true
|
$rm = ConvertTo-Bool ($params.rm)
|
||||||
Set-Attr $result.win_unzip "rm" "true"
|
|
||||||
}
|
}
|
||||||
Else {
|
Else {
|
||||||
$rm = $false
|
$rm = $false
|
||||||
|
@ -111,7 +110,7 @@ Else {
|
||||||
If ($recurse) {
|
If ($recurse) {
|
||||||
Expand-Archive -Path $src -OutputPath $dest -Force
|
Expand-Archive -Path $src -OutputPath $dest -Force
|
||||||
|
|
||||||
If ($rm) {
|
If ($rm -eq $true) {
|
||||||
Get-ChildItem $dest -recurse | Where {$_.extension -eq ".gz" -Or $_.extension -eq ".zip" -Or $_.extension -eq ".bz2" -Or $_.extension -eq ".tar" -Or $_.extension -eq ".msu"} | % {
|
Get-ChildItem $dest -recurse | Where {$_.extension -eq ".gz" -Or $_.extension -eq ".zip" -Or $_.extension -eq ".bz2" -Or $_.extension -eq ".tar" -Or $_.extension -eq ".msu"} | % {
|
||||||
Expand-Archive $_.FullName -OutputPath $dest -Force
|
Expand-Archive $_.FullName -OutputPath $dest -Force
|
||||||
Remove-Item $_.FullName -Force
|
Remove-Item $_.FullName -Force
|
||||||
|
|
Loading…
Reference in a new issue