Last active
August 16, 2022 00:47
-
-
Save DBremen/c5ffad6e6e80411275f4 to your computer and use it in GitHub Desktop.
Show-Command for custom functions
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
function Out-Stuff{ | |
[CmdletBinding(DefaultParameterSetName='Basic')] | |
param( | |
[Parameter(Mandatory)] | |
[ValidateSet('choice1','choice2','choice3')] | |
$myChoice, | |
[Parameter(ParameterSetName='Basic')] | |
$text, | |
[Parameter(ParameterSetName='Advanced')] | |
[switch]$switch1, | |
[Parameter(ParameterSetName='Advanced')] | |
[switch]$switch2 | |
) | |
"Choice: $myChoice" | |
"Switch1: $(if($switch1.IsPresent){'On'}else{'Off'})" | |
"Switch2: $(if($switch2.IsPresent){'On'}else{'Off'})" | |
"Text: $text" | |
} | |
Show-Command Out-Stuff -NoCommonParameter -PassThru -Height 300 | Invoke-Expression |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment