This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#region Test-Confirm | |
function Test-Confirm { | |
[CmdletBinding(SupportsShouldProcess, | |
ConfirmImpact = 'High')] | |
param( | |
[int[]]$Numbers | |
) | |
process { | |
foreach ($num in $Numbers) { | |
if ($PSCmdlet.ShouldProcess($num)) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#region Test-YesAllConfirm | |
function Test-YesAllConfirm { | |
[CmdletBinding()] | |
param( | |
[int[]]$Numbers | |
) | |
process { | |
foreach ($num in $Numbers) { | |
if (-not $doAll) { | |
$keepGoing = Read-Host "Are you sure you want to process: [$num] (Yes, No, All (default), Exit)" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#region Test-ListeningConfirm | |
function Test-ListeningConfirm { | |
[CmdletBinding()] | |
param( | |
[int[]]$Numbers | |
) | |
process { | |
foreach ($num in $Numbers) { | |
$keepGoing = Read-Host "Are you sure you want to process: [$num] (Y/N)" | |
if ($keepGoing -eq 'Y') { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#region Test-ManualConfirm | |
function Test-ManualConfirm { | |
[CmdletBinding()] | |
param( | |
[int[]]$Numbers | |
) | |
process { | |
foreach ($num in $Numbers) { | |
Read-Host -Prompt "Are you sure you want to process: [$num]" | |
"Current number: [$num]" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#region Test-ManualPause | |
function Test-ManualPause { | |
[CmdletBinding()] | |
param( | |
[int[]]$Numbers | |
) | |
process { | |
foreach ($num in $Numbers) { | |
Pause | |
"Current number: [$num]" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$Numbers = 1..10 | |
#region Test-ManualPause | |
function Test-ManualPause { | |
[CmdletBinding()] | |
param( | |
[int[]]$Numbers | |
) | |
process { | |
foreach ($num in $Numbers) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[PSCustomObject]@{ | |
Name = '$Stmt' | |
Type = $Stmt.GetType().FullName | |
}, [PSCustomObject]@{ | |
Name = '$ActualStmt' | |
Type = $ActualStmt.GetType().FullName | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$propertyPathProperties | ForEach-Object -Begin { | |
$Stmt = "Get-Content -Path .\BasicJson.json |`n`tConvertFrom-Json" | |
} -Process { | |
$Stmt += " |`n`tSelect-Object -ExpandProperty $_" | |
} -End { | |
$Stmt | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$propertyPath = 'Database.Table.Fruit' | |
($propertyPathProperties = $propertyPath -split '\.') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Get-Content -Path .\BasicJson.json | | |
ConvertFrom-Json | | |
Select-Object -ExpandProperty Database.View.IsYAVowel | |
Get-Content -Path .\BasicJson.json | | |
ConvertFrom-Json | | |
Select-Object -Property Database.View.IsYAVowel |