File tree Expand file tree Collapse file tree
PSModuleDevelopment/functions/utility Expand file tree Collapse file tree Original file line number Diff line number Diff line change 9898
9999 if (-not ($null -eq $inputParameterMatch )) {
100100 $inputParameterNames = $inputParameterMatch.Value.Trim (" -" , " " )
101+ Write-PSFMessage - Level Verbose - Message " All input parameters - $ ( $inputParameterNames -join " ," ) " - Target ($inputParameterNames -join " ," )
101102 }
102103 else {
103104 Write-PSFMessage - Level Host - Message " The function was unable to extract any parameters from the supplied command text. Please try again."
106107 }
107108
108109 $availableParameterNames = (Get-Command $commandName ).Parameters.keys | Where-Object {$commonParameters -NotContains $_ }
110+ Write-PSFMessage - Level Verbose - Message " Available parameters - $ ( $availableParameterNames -join " ," ) " - Target ($availableParameterNames -join " ," )
111+
109112 $inputParameterNotFound = $inputParameterNames | Where-Object {$availableParameterNames -NotContains $_ }
110113
111- $null = $sbParmsNotFound.AppendLine (" Parameters that <c='em'>don't exists</c>" )
112- $inputParameterNotFound | ForEach-Object {
113- $null = $sbParmsNotFound.AppendLine (" <c='$colorParmsNotFound '>$ ( $_ ) </c>" )
114+ if ($inputParameterNotFound.Length -gt 0 ) {
115+ $null = $sbParmsNotFound.AppendLine (" Parameters that <c='em'>don't exists</c>" )
116+ $inputParameterNotFound | ForEach-Object {
117+ $null = $sbParmsNotFound.AppendLine (" <c='$colorParmsNotFound '>$ ( $_ ) </c>" )
118+ }
114119 }
115-
120+
116121 foreach ($parmSet in (Get-Command $commandName ).ParameterSets) {
117122 $sb = New-Object System.Text.StringBuilder
118123 $null = $sb.AppendLine (" ParameterSet Name: <c='em'>$ ( $parmSet.Name ) </c> - Validated List" )
193198 Default {}
194199 }
195200
196- if ($sbParmsNotFound.Length -gt 0 ) {
201+ if ($sbParmsNotFound.ToString ().Trim(). Length -gt 0 ) {
197202 Write-PSFHostColor - String " $ ( $sbParmsNotFound.ToString ()) "
198203 }
199204
You can’t perform that action at this time.
0 commit comments