-
Notifications
You must be signed in to change notification settings - Fork 69
Code Blocks in Documentation should not contain the PowerShell prompt #269
Copy link
Copy link
Open
Description
Prerequisites
- Write a descriptive title.
- Make sure you are able to repro it on the latest version
- Search the existing issues.
Steps to reproduce
GitHub provides a 'copy' button on code blocks. Code blocks should only contain code, no prompt strings, since they will get copied as well.
For example, docs/Microsoft.PowerShell.ConsoleGuiTools/Out-ConsoleGridView.md:40-42 has the following:
PS C:\> Get-Process | Out-ConsoleGridViewWhen you click the 'copy' button on this code block, it will copy "PS C:> " in addition to the intended code.
Expected behavior
I expected to be able to click the 'copy' button, paste into PS, hit ENTER and view the results.Actual behavior
The "PS C:\> " prompt got copy-pasted and screwed everything up when I hit ENTER.
PS: 2 C:\> PS C:\> Get-Process | Out-ConsoleGridView
Get-Process: A positional parameter cannot be found that accepts argument 'Get-Process'.Error details
Exception :
Type : System.Management.Automation.ParameterBindingException
Message : A positional parameter cannot be found that accepts argument 'Get-Process'.
ParameterName : Get-Process
TypeSpecified : [System.String]
ErrorId : PositionalParameterNotFound
Line : 1
Offset : 1
CommandInvocation :
MyCommand : Get-Process
BoundParameters :
Name : C:\>
ScriptLineNumber : 1
OffsetInLine : 1
HistoryId : 2
Line : PS C:\> Get-Process | Out-ConsoleGridView
Statement : PS C:\> Get-Process
PositionMessage : At line:1 char:1
+ PS C:\> Get-Process | Out-ConsoleGridView
+ ~~~~~~~~~~~~~~~~~~~
InvocationName : PS
PipelineLength : 2
PipelinePosition : 1
ErrorRecord :
Exception :
Type : System.Management.Automation.ParentContainsErrorRecordException
Message : A positional parameter cannot be found that accepts argument 'Get-Process'.
HResult : -2146233087
CategoryInfo : InvalidArgument: (:) [Get-Process], ParentContainsErrorRecordException
FullyQualifiedErrorId : PositionalParameterNotFound,Microsoft.PowerShell.Commands.GetProcessCommand
InvocationInfo :
MyCommand : Get-Process
ScriptLineNumber : 1
OffsetInLine : 1
HistoryId : 2
Line : PS C:\> Get-Process | Out-ConsoleGridView
Statement : PS C:\> Get-Process
PositionMessage : At line:1 char:1
+ PS C:\> Get-Process | Out-ConsoleGridView
+ ~~~~~~~~~~~~~~~~~~~
CommandOrigin : Internal
ScriptStackTrace : at <ScriptBlock>, <No file>: line 1
TargetSite :
Name : VerifyArgumentsProcessed
DeclaringType : [System.Management.Automation.CmdletParameterBinderController]
MemberType : Method
Module : System.Management.Automation.dll
Data :
System.Management.Automation.Interpreter.InterpretedFrameInfo, System.Management.Automation,
Version=7.6.0.500, Culture=neutral, PublicKeyToken=31bf3856ad364e35 : <ScriptBlock>
Source : System.Management.Automation
HResult : -2146233087
StackTrace :
at System.Management.Automation.CmdletParameterBinderController.VerifyArgumentsProcessed(ParameterBindingException
originalBindingException)
at System.Management.Automation.CmdletParameterBinderController.BindCommandLineParametersNoValidation(Collection`1
arguments)
at System.Management.Automation.CmdletParameterBinderController.BindCommandLineParameters(Collection`1 arguments)
at System.Management.Automation.CommandProcessor.BindCommandLineParameters()
at System.Management.Automation.CommandProcessor.Prepare(IDictionary psDefaultParameterValues)
at System.Management.Automation.CommandProcessorBase.DoPrepare(IDictionary psDefaultParameterValues)
at System.Management.Automation.Internal.PipelineProcessor.Start(Boolean incomingStream)
at System.Management.Automation.Internal.PipelineProcessor.SynchronousExecuteEnumerate(Object input)
--- End of stack trace from previous location ---
at System.Management.Automation.Internal.PipelineProcessor.SynchronousExecuteEnumerate(Object input)
at System.Management.Automation.PipelineOps.InvokePipeline(Object input, Boolean ignoreInput,
CommandParameterInternal[][] pipeElements, CommandBaseAst[] pipeElementAsts, CommandRedirection[][]
commandRedirections, FunctionContext funcContext)
at System.Management.Automation.Interpreter.ActionCallInstruction`6.Run(InterpretedFrame frame)
at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)
CategoryInfo : InvalidArgument: (:) [Get-Process], ParameterBindingException
FullyQualifiedErrorId : PositionalParameterNotFound,Microsoft.PowerShell.Commands.GetProcessCommand
InvocationInfo :
MyCommand : Get-Process
ScriptLineNumber : 1
OffsetInLine : 1
HistoryId : 2
Line : PS C:\> Get-Process | Out-ConsoleGridView
Statement : PS C:\> Get-Process
PositionMessage : At line:1 char:1
+ PS C:\> Get-Process | Out-ConsoleGridView
+ ~~~~~~~~~~~~~~~~~~~
CommandOrigin : Internal
ScriptStackTrace : at <ScriptBlock>, <No file>: line 1Environment data
Name Value
---- -----
PSVersion 7.6.0
PSEdition Core
GitCommitId 7.6.0
OS Microsoft Windows 10.0.26200
Platform Win32NT
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.4
SerializationVersion 1.1.0.1
WSManStackVersion 3.0Version
PS: 7.6.0, ConsoleGuiTools: 0.7.7
Visuals

Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels