Skip to content

Consider allowing use of PSConsoleHostReadLine for general-purpose prompting #881

@mklement0

Description

@mklement0

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions