mirror of
https://github.com/PowerShell/PowerShell
synced 2026-06-08 12:12:50 +00:00
build.psm1: Add Copy-MappedFiles -WhatIf switch
This commit is contained in:
+7
-9
@@ -670,7 +670,8 @@ function Copy-MappedFiles {
|
||||
[string[]]$Path = "$PSScriptRoot",
|
||||
[Parameter(Mandatory=$true)]
|
||||
[string]$PslMonadRoot,
|
||||
[switch]$Force
|
||||
[switch]$Force,
|
||||
[switch]$WhatIf
|
||||
)
|
||||
|
||||
begin
|
||||
@@ -683,6 +684,10 @@ function Copy-MappedFiles {
|
||||
{
|
||||
Write-Warning "$Message : ignoring (-Force)"
|
||||
}
|
||||
elseif ($WhatIf)
|
||||
{
|
||||
Write-Warning "$Message : ignoring (-WhatIf)"
|
||||
}
|
||||
else
|
||||
{
|
||||
throw "$Message : use -Force to ignore"
|
||||
@@ -745,14 +750,7 @@ function Copy-MappedFiles {
|
||||
$map.GetEnumerator() | % {
|
||||
New-Item -ItemType Directory (Split-Path $_.Value) -ErrorAction SilentlyContinue > $null
|
||||
|
||||
if ($PSBoundParameters['Verbose'])
|
||||
{
|
||||
Copy-Item $_.Key $_.Value -Verbose
|
||||
}
|
||||
else
|
||||
{
|
||||
Copy-Item $_.Key $_.Value
|
||||
}
|
||||
Copy-Item $_.Key $_.Value -Verbose:([bool]$PSBoundParameters['Verbose']) -WhatIf:$WhatIf
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user