Skip to content

Instantly share code, notes, and snippets.

@DBremen
Last active August 16, 2022 00:47
Show Gist options
  • Save DBremen/c5ffad6e6e80411275f4 to your computer and use it in GitHub Desktop.
Save DBremen/c5ffad6e6e80411275f4 to your computer and use it in GitHub Desktop.
Show-Command for custom functions
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