Skip to content

Commit ac985fa

Browse files
committed
Add comments to PSCommandExtensions
1 parent 529c54d commit ac985fa

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

src/PowerShellEditorServices/Services/PowerShell/Utility/PSCommandExtensions.cs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,22 +21,26 @@ public static PSCommand AddDebugOutputCommand(this PSCommand psCommand)
2121

2222
public static PSCommand MergePipelineResults(this PSCommand psCommand)
2323
{
24+
// We need to do merge errors and output before rendering with an Out- cmdlet
2425
Command lastCommand = psCommand.Commands[psCommand.Commands.Count - 1];
2526
lastCommand.MergeMyResults(PipelineResultTypes.Error, PipelineResultTypes.Output);
2627
lastCommand.MergeMyResults(PipelineResultTypes.Information, PipelineResultTypes.Output);
2728
return psCommand;
2829
}
2930

31+
/// <summary>
32+
/// Get a representation of the PSCommand, for logging purposes.
33+
/// </summary>
3034
public static string GetInvocationText(this PSCommand command)
3135
{
32-
Command lastCommand = command.Commands[0];
36+
Command currentCommand = command.Commands[0];
3337
var sb = new StringBuilder().AddCommandText(command.Commands[0]);
3438

3539
for (int i = 1; i < command.Commands.Count; i++)
3640
{
37-
sb.Append(lastCommand.IsEndOfStatement ? "; " : " | ");
38-
lastCommand = command.Commands[i];
39-
sb.AddCommandText(lastCommand);
41+
sb.Append(currentCommand.IsEndOfStatement ? "; " : " | ");
42+
currentCommand = command.Commands[i];
43+
sb.AddCommandText(currentCommand);
4044
}
4145

4246
return sb.ToString();

0 commit comments

Comments
 (0)