PSReadLine icon indicating copy to clipboard operation
PSReadLine copied to clipboard

Consider allowing use of PSConsoleHostReadLine for general-purpose prompting

Open mklement0 opened this issue 6 years ago • 0 comments

PSReadLine offers great flexibility and customizability for editing of user input that is PowerShell code.

It would be great to offer the same for general-purpose, end user prompting, possibly by adding parameters to the PSConsoleHostReadLine function, notably by allowing opt-out of the following features:

  • parsing the input as PowerShell code, notably to prevent accidental continuation of the prompt on the next line, if the input is a syntactically incomplete PowerShell statement.

  • (and therefore) syntax coloring

  • adding the submitted input to the command history.

A real-life use case is this Stack Overflow question, which asks for implementing custom key bindings in a prompt presented to the end user.

Scripts could implement such and more sophisticated customizations in order to enhance the end-user input experience, including tab-completion.

Additionally, it would make sense for the Read-Host cmdlet to use this enhanced PSConsoleHostReadLine function either by default or on request.

Environment data

PSReadline version: 2.0.0-beta3

mklement0 avatar Apr 05 '19 19:04 mklement0