Skip to content

Instantly share code, notes, and snippets.

@SimonWahlin
Last active November 11, 2015 19:51
Show Gist options
  • Save SimonWahlin/bff697aeab9c0d807108 to your computer and use it in GitHub Desktop.
Save SimonWahlin/bff697aeab9c0d807108 to your computer and use it in GitHub Desktop.
[cmdletbinding(DefaultParameterSetName='Default')]
param
(
[Parameter(ParameterSetName = 'Default',
Mandatory=$true,
Position = 0)]
[String[]]$Word,
[Parameter(ParameterSetName = 'Default',
Position = 1)]
[int]$Number = 1,
[Parameter(ParameterSetName = 'Default',
Position = 2)]
[ValidateSet('true','false')]
[String]$AddSpace,
[Parameter(ParameterSetName = 'Help',
Mandatory=$true,
Position = 0)]
[String]$Help
)
$PSCmdlet.ParameterSetName
PS C:\Temp> Trace-Command -Expression {.\New-WordTree.ps1 Help} -Name ParameterBinderController, ParameterBinding -PSHost
DEBUG: ParameterBinderController Information: 0 : WriteLine Argument count: 1
DEBUG: ParameterBinding Information: 0 : BIND NAMED cmd line args [New-WordTree.ps1]
DEBUG: ParameterBinding Information: 0 : BIND POSITIONAL cmd line args [New-WordTree.ps1]
DEBUG: ParameterBinding Information: 0 : BIND arg [Help] to parameter [Word]
DEBUG: ParameterBinding Information: 0 : Executing DATA GENERATION metadata: [System.Management.Automation.ArgumentTypeConverterAttribute]
DEBUG: ParameterBinding Information: 0 : result returned from DATA GENERATION: Help
DEBUG: ParameterBinding Information: 0 : Binding collection parameter Word: argument type [String], parameter type [System.String[]], collection
type Array, element type [System.String], no coerceElementType
DEBUG: ParameterBinding Information: 0 : Creating array with element type [System.String] and 1 elements
DEBUG: ParameterBinding Information: 0 : Argument type String is not IList, treating this as scalar
DEBUG: ParameterBinding Information: 0 : Adding scalar element of type String to array position 0
DEBUG: ParameterBinding Information: 0 : BIND arg [System.String[]] to param [Word] SUCCESSFUL
DEBUG: ParameterBinderController Information: 0 : WriteLine CurrentParameterSetName = Default
DEBUG: ParameterBinderController Information: 0 : WriteLine CurrentParameterSetName = Default
DEBUG: ParameterBinding Information: 0 : MANDATORY PARAMETER CHECK on cmdlet [New-WordTree.ps1]
DEBUG: ParameterBinding Information: 0 : BIND arg [1] to parameter [Number]
DEBUG: ParameterBinding Information: 0 : Executing DATA GENERATION metadata: [System.Management.Automation.ArgumentTypeConverterAttribute]
DEBUG: ParameterBinding Information: 0 : result returned from DATA GENERATION: 1
DEBUG: ParameterBinding Information: 0 : COERCE arg to [System.Int32]
DEBUG: ParameterBinding Information: 0 : Parameter and arg types the same, no coercion is needed.
DEBUG: ParameterBinding Information: 0 : BIND arg [1] to param [Number] SUCCESSFUL
DEBUG: ParameterBinding Information: 0 : BIND arg [] to parameter [AddSpace]
DEBUG: ParameterBinding Information: 0 : Executing DATA GENERATION metadata: [System.Management.Automation.ArgumentTypeConverterAttribute]
DEBUG: ParameterBinding Information: 0 : result returned from DATA GENERATION:
DEBUG: ParameterBinding Information: 0 : COERCE arg to [System.String]
DEBUG: ParameterBinding Information: 0 : Parameter and arg types the same, no coercion is needed.
DEBUG: ParameterBinding Information: 0 : BIND arg [] to param [AddSpace] SUCCESSFUL
DEBUG: ParameterBinding Information: 0 : BIND arg [] to parameter [Help]
DEBUG: ParameterBinding Information: 0 : Executing DATA GENERATION metadata: [System.Management.Automation.ArgumentTypeConverterAttribute]
DEBUG: ParameterBinding Information: 0 : result returned from DATA GENERATION:
DEBUG: ParameterBinding Information: 0 : COERCE arg to [System.String]
DEBUG: ParameterBinding Information: 0 : Parameter and arg types the same, no coercion is needed.
DEBUG: ParameterBinding Information: 0 : BIND arg [] to param [Help] SUCCESSFUL
DEBUG: ParameterBinding Information: 0 : CALLING BeginProcessing
DEBUG: ParameterBinding Information: 0 : CALLING EndProcessing
Default
**********************
Windows PowerShell transcript start
Start time: 20151111202617
Username: SIMONS\simon
RunAs User: SIMONS\simon
Machine: SIMONS (Microsoft Windows NT 10.0.10240.0)
Host Application: C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe
Process ID: 17520
PSVersion: 5.0.10240.16384
WSManStackVersion: 3.0
SerializationVersion: 1.1.0.1
CLRVersion: 4.0.30319.42000
BuildVersion: 10.0.10240.16384
PSCompatibleVersions: 1.0, 2.0, 3.0, 4.0, 5.0.10240.16384
PSRemotingProtocolVersion: 2.3
**********************
Transcript started, output file is .\Transcript.txt
>
C:\TempGet-Content -Path .\New-WordTree.ps1
[cmdletbinding(DefaultParameterSetName='Default')]
param
(
[Parameter(ParameterSetName = 'Default',
Mandatory=$true,
Position = 0)]
[String[]]$Word,
[Parameter(ParameterSetName = 'Default',
Position = 1)]
[int]$Number = 1,
[Parameter(ParameterSetName = 'Default',
Position = 2)]
[ValidateSet('true','false')]
[String]$AddSpace,
[Parameter(ParameterSetName = 'Help',
Mandatory=$true,
Position = 0)]
[String]$Help
)
$PSCmdlet.ParameterSetName
>
C:\Temp.\New-WordTree.ps1 Help
Default
>
C:\Temp.\New-WordTree.ps1 /?
Default
>
C:\Temp.\New-WordTree.ps1 PowerShell
Default
>
C:\TempStop-Transcript
**********************
Windows PowerShell transcript end
End time: 20151111202702
**********************
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment