Correct case of $PSCmdlet special variable
This commit is contained in:
parent
a051666baf
commit
42d50434f8
10
build.psm1
10
build.psm1
|
@ -289,7 +289,7 @@ function Start-PSBuild {
|
|||
[switch]$Detailed
|
||||
)
|
||||
|
||||
if ($PsCmdlet.ParameterSetName -eq "Default" -and !$NoPSModuleRestore)
|
||||
if ($PSCmdlet.ParameterSetName -eq "Default" -and !$NoPSModuleRestore)
|
||||
{
|
||||
$PSModuleRestore = $true
|
||||
}
|
||||
|
@ -1393,14 +1393,14 @@ function Show-PSPesterError
|
|||
[PSCustomObject]$testFailureObject
|
||||
)
|
||||
|
||||
if ($PSCmdLet.ParameterSetName -eq 'xml')
|
||||
if ($PSCmdlet.ParameterSetName -eq 'xml')
|
||||
{
|
||||
$description = $testFailure.description
|
||||
$name = $testFailure.name
|
||||
$message = $testFailure.failure.message
|
||||
$StackTrace = $testFailure.failure."stack-trace"
|
||||
}
|
||||
elseif ($PSCmdLet.ParameterSetName -eq 'object')
|
||||
elseif ($PSCmdlet.ParameterSetName -eq 'object')
|
||||
{
|
||||
$description = $testFailureObject.Describe + '/' + $testFailureObject.Context
|
||||
$name = $testFailureObject.Name
|
||||
|
@ -1488,7 +1488,7 @@ function Test-PSPesterResults
|
|||
[switch] $CanHaveNoResult
|
||||
)
|
||||
|
||||
if($PSCmdLet.ParameterSetName -eq 'file')
|
||||
if($PSCmdlet.ParameterSetName -eq 'file')
|
||||
{
|
||||
if(!(Test-Path $TestResultsFile))
|
||||
{
|
||||
|
@ -1515,7 +1515,7 @@ function Test-PSPesterResults
|
|||
throw "$($x.'test-results'.failures) tests in $TestArea failed"
|
||||
}
|
||||
}
|
||||
elseif ($PSCmdLet.ParameterSetName -eq 'PesterPassThruObject')
|
||||
elseif ($PSCmdlet.ParameterSetName -eq 'PesterPassThruObject')
|
||||
{
|
||||
if ($ResultObject.TotalCount -le 0 -and -not $CanHaveNoResult)
|
||||
{
|
||||
|
|
|
@ -125,7 +125,7 @@ function Remove-CronJob {
|
|||
$e = New-Object System.Exception -ArgumentList "Job not found"
|
||||
throw $e
|
||||
}
|
||||
if ($Force -or $pscmdlet.ShouldProcess($Job.Command,"Remove")) {
|
||||
if ($Force -or $PSCmdlet.ShouldProcess($Job.Command,"Remove")) {
|
||||
Import-CronTab -user $UserName -crontab $newcrontab
|
||||
}
|
||||
}
|
||||
|
|
|
@ -28,7 +28,7 @@ function Invoke-Msiexec {
|
|||
[HashTable] $Properties
|
||||
|
||||
)
|
||||
$action = "$($PsCmdlet.ParameterSetName)ing"
|
||||
$action = "$($PSCmdlet.ParameterSetName)ing"
|
||||
if ($Install.IsPresent) {
|
||||
$switch = '/I'
|
||||
} else {
|
||||
|
|
|
@ -154,7 +154,7 @@ Describe "Common parameters support for script cmdlets" -Tags "CI" {
|
|||
[CmdletBinding(SupportsShouldProcess=$true)]
|
||||
param()
|
||||
|
||||
if($pscmdlet.shouldprocess("foo", "foo action"))
|
||||
if($PSCmdlet.shouldprocess("foo", "foo action"))
|
||||
{
|
||||
write-output "foo action"
|
||||
}
|
||||
|
@ -205,7 +205,7 @@ Describe "Common parameters support for script cmdlets" -Tags "CI" {
|
|||
[CmdletBinding(supportsshouldprocess=$true, ConfirmImpact="none")]
|
||||
param()
|
||||
|
||||
if($pscmdlet.shouldprocess("foo", "foo action"))
|
||||
if($PSCmdlet.shouldprocess("foo", "foo action"))
|
||||
{
|
||||
write-output "foo action"
|
||||
}
|
||||
|
@ -239,7 +239,7 @@ Describe "Common parameters support for script cmdlets" -Tags "CI" {
|
|||
[CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact="low")]
|
||||
param()
|
||||
|
||||
if($pscmdlet.shouldprocess("foo", "foo action"))
|
||||
if($PSCmdlet.shouldprocess("foo", "foo action"))
|
||||
{
|
||||
write-output "foo action"
|
||||
}
|
||||
|
@ -274,7 +274,7 @@ Describe "Common parameters support for script cmdlets" -Tags "CI" {
|
|||
[CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact="medium")]
|
||||
param()
|
||||
|
||||
if($pscmdlet.shouldprocess("foo", "foo action"))
|
||||
if($PSCmdlet.shouldprocess("foo", "foo action"))
|
||||
{
|
||||
write-output "foo action"
|
||||
}
|
||||
|
@ -310,7 +310,7 @@ Describe "Common parameters support for script cmdlets" -Tags "CI" {
|
|||
[CmdletBinding(SupportsShouldProcess=$true, ConfirmImpact="high")]
|
||||
param()
|
||||
|
||||
if($pscmdlet.shouldprocess("foo", "foo action"))
|
||||
if($PSCmdlet.shouldprocess("foo", "foo action"))
|
||||
{
|
||||
write-output "foo action"
|
||||
}
|
||||
|
@ -346,7 +346,7 @@ Describe "Common parameters support for script cmdlets" -Tags "CI" {
|
|||
[CmdletBinding()]
|
||||
param()
|
||||
|
||||
if($pscmdlet.shouldcontinue("foo", "foo action"))
|
||||
if($PSCmdlet.shouldcontinue("foo", "foo action"))
|
||||
{
|
||||
write-output "foo action"
|
||||
}
|
||||
|
|
|
@ -16,7 +16,7 @@ Describe "Tests OutVariable only" -Tags "CI" {
|
|||
[CmdletBinding()]
|
||||
param()
|
||||
|
||||
$pscmdlet.writeobject("foo")
|
||||
$PSCmdlet.writeobject("foo")
|
||||
}
|
||||
|
||||
function get-bar
|
||||
|
@ -35,7 +35,7 @@ Describe "Tests OutVariable only" -Tags "CI" {
|
|||
OutVariable = 'a';
|
||||
Expected = 'foo'
|
||||
},
|
||||
@{ Name = 'Updating OutVariable Case 2: $pscmdlet.writeobject';
|
||||
@{ Name = 'Updating OutVariable Case 2: $PSCmdlet.writeobject';
|
||||
Command = "get-foo2";
|
||||
OutVariable = 'a';
|
||||
Expected = 'foo'
|
||||
|
@ -46,7 +46,7 @@ Describe "Tests OutVariable only" -Tags "CI" {
|
|||
PreSet = 'a','b';
|
||||
Expected = @("a", "b", "foo")
|
||||
},
|
||||
@{ Name = 'Appending OutVariable Case 2: $pscmdlet.writeobject';
|
||||
@{ Name = 'Appending OutVariable Case 2: $PSCmdlet.writeobject';
|
||||
Command = "get-foo2";
|
||||
OutVariable = 'a';
|
||||
PreSet = 'a','b';
|
||||
|
@ -92,7 +92,7 @@ Describe "Test ErrorVariable only" -Tags "CI" {
|
|||
[CmdletBinding()]
|
||||
param()
|
||||
|
||||
$pscmdlet.WriteError($script:foo[0])
|
||||
$PSCmdlet.WriteError($script:foo[0])
|
||||
}
|
||||
|
||||
function get-bar
|
||||
|
@ -111,7 +111,7 @@ Describe "Test ErrorVariable only" -Tags "CI" {
|
|||
ErrorVariable = 'a';
|
||||
Expected = 'foo'
|
||||
},
|
||||
@{ Name = 'Updating ErrorVariable Case 2: $pscmdlet.WriteError';
|
||||
@{ Name = 'Updating ErrorVariable Case 2: $PSCmdlet.WriteError';
|
||||
Command = "get-foo1";
|
||||
ErrorVariable = 'a';
|
||||
Expected = 'foo'
|
||||
|
@ -140,7 +140,7 @@ Describe "Test ErrorVariable only" -Tags "CI" {
|
|||
$a | Should -BeExactly $Expected
|
||||
}
|
||||
|
||||
It 'Appending ErrorVariable Case 2: $pscmdlet.writeerror' {
|
||||
It 'Appending ErrorVariable Case 2: $PSCmdlet.writeerror' {
|
||||
write-error "foo" -errorVariable script:foo 2> $null
|
||||
$a = 'a','b'
|
||||
|
||||
|
@ -193,7 +193,7 @@ Describe "Update both OutVariable and ErrorVariable" -Tags "CI" {
|
|||
[CmdletBinding()]
|
||||
param()
|
||||
|
||||
$pscmdlet.WriteError($script:foo[0])
|
||||
$PSCmdlet.WriteError($script:foo[0])
|
||||
}
|
||||
|
||||
function get-bar
|
||||
|
|
|
@ -1079,7 +1079,7 @@ function Wait-PSWinEvent
|
|||
|
||||
foreach ($thisRecord in (get-winevent -FilterHashtable $filterHashtable -Oldest 2> $null))
|
||||
{
|
||||
if($PsCmdlet.ParameterSetName -eq "ByPropertyName")
|
||||
if($PSCmdlet.ParameterSetName -eq "ByPropertyName")
|
||||
{
|
||||
if ($thisRecord."$propertyName" -like "*$propertyValue*")
|
||||
{
|
||||
|
@ -1094,7 +1094,7 @@ function Wait-PSWinEvent
|
|||
}
|
||||
}
|
||||
|
||||
if($PsCmdlet.ParameterSetName -eq "ByPropertyIndex")
|
||||
if($PSCmdlet.ParameterSetName -eq "ByPropertyIndex")
|
||||
{
|
||||
if ($thisRecord.Properties[$propertyIndex].Value -eq $propertyValue)
|
||||
{
|
||||
|
|
|
@ -65,7 +65,7 @@ function Add-UserToGroup
|
|||
|
||||
$userAD = [ADSI] "WinNT://$env:computername/${username},user"
|
||||
|
||||
if($PsCmdlet.ParameterSetName -eq "SID")
|
||||
if($PSCmdlet.ParameterSetName -eq "SID")
|
||||
{
|
||||
$ntAccount=ConvertTo-NtAccount $groupSid
|
||||
$group =$ntAccount.Split("\\")[1]
|
||||
|
|
|
@ -774,7 +774,7 @@ function New-UnixPackage {
|
|||
|
||||
# Setup staging directory so we don't change the original source directory
|
||||
$Staging = "$PSScriptRoot/staging"
|
||||
if ($pscmdlet.ShouldProcess("Create staging folder")) {
|
||||
if ($PSCmdlet.ShouldProcess("Create staging folder")) {
|
||||
New-StagingFolder -StagingPath $Staging
|
||||
}
|
||||
|
||||
|
@ -793,7 +793,7 @@ function New-UnixPackage {
|
|||
}
|
||||
$linkSource = "/tmp/pwsh"
|
||||
|
||||
if ($pscmdlet.ShouldProcess("Create package file system"))
|
||||
if ($PSCmdlet.ShouldProcess("Create package file system"))
|
||||
{
|
||||
# refers to executable, does not vary by channel
|
||||
New-Item -Force -ItemType SymbolicLink -Path $linkSource -Target "$Destination/pwsh" > $null
|
||||
|
@ -833,7 +833,7 @@ function New-UnixPackage {
|
|||
if ($Type -eq "osxpkg")
|
||||
{
|
||||
Write-Log "Adding macOS launch application..."
|
||||
if ($pscmdlet.ShouldProcess("Add macOS launch application"))
|
||||
if ($PSCmdlet.ShouldProcess("Add macOS launch application"))
|
||||
{
|
||||
# Generate launcher app folder
|
||||
$AppsFolder = New-MacOSLauncher -Version $Version
|
||||
|
@ -870,14 +870,14 @@ function New-UnixPackage {
|
|||
|
||||
# Build package
|
||||
try {
|
||||
if ($pscmdlet.ShouldProcess("Create $type package")) {
|
||||
if ($PSCmdlet.ShouldProcess("Create $type package")) {
|
||||
Write-Log "Creating package with fpm..."
|
||||
$Output = Start-NativeExecution { fpm $Arguments }
|
||||
}
|
||||
} finally {
|
||||
if ($Environment.IsMacOS) {
|
||||
Write-Log "Starting Cleanup for mac packaging..."
|
||||
if ($pscmdlet.ShouldProcess("Cleanup macOS launcher"))
|
||||
if ($PSCmdlet.ShouldProcess("Cleanup macOS launcher"))
|
||||
{
|
||||
Clear-MacOSLauncher
|
||||
}
|
||||
|
@ -901,7 +901,7 @@ function New-UnixPackage {
|
|||
$createdPackage = Get-Item (Join-Path $PWD (($Output[-1] -split ":path=>")[-1] -replace '["{}]'))
|
||||
|
||||
if ($Environment.IsMacOS) {
|
||||
if ($pscmdlet.ShouldProcess("Add distribution information and Fix PackageName"))
|
||||
if ($PSCmdlet.ShouldProcess("Add distribution information and Fix PackageName"))
|
||||
{
|
||||
$createdPackage = New-MacOsDistributionPackage -FpmPackage $createdPackage -IsPreview:$IsPreview
|
||||
}
|
||||
|
@ -1469,7 +1469,7 @@ function New-ZipPackage
|
|||
|
||||
if (Get-Command Compress-Archive -ErrorAction Ignore)
|
||||
{
|
||||
if ($pscmdlet.ShouldProcess("Create zip package"))
|
||||
if ($PSCmdlet.ShouldProcess("Create zip package"))
|
||||
{
|
||||
Compress-Archive -Path $PackageSourcePath\* -DestinationPath $zipLocationPath
|
||||
}
|
||||
|
@ -2270,7 +2270,7 @@ function New-NugetContentPackage
|
|||
# Setup staging directory so we don't change the original source directory
|
||||
$stagingRoot = New-SubFolder -Path $PSScriptRoot -ChildPath 'nugetStaging' -Clean
|
||||
$contentFolder = Join-Path -path $stagingRoot -ChildPath 'content'
|
||||
if ($pscmdlet.ShouldProcess("Create staging folder")) {
|
||||
if ($PSCmdlet.ShouldProcess("Create staging folder")) {
|
||||
New-StagingFolder -StagingPath $contentFolder
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue