Table of Contents

Class CommonFormatters

Namespace
InteractiveReadLine.Formatting
Assembly
InteractiveReadLine.dll

Provides ready-made formatters that add a prompt, hide text, or apply colors before displaying a line. A formatter does not alter the text that the user is editing.

public static class CommonFormatters
Inheritance
CommonFormatters
Inherited Members

Properties

PasswordBar

A formatter that displays a variable-length bar based on the first and tenth bytes of a SHA256 hash of the entered password's UTF-8 bytes. The bar provides repeatable visual feedback without revealing the password itself.

public static Func<LineState, LineDisplayState> PasswordBar { get; }

Property Value

Func<LineState, LineDisplayState>

PasswordBlank

A formatter that blanks out the entered characters, and has no prefix or suffix

public static Func<LineState, LineDisplayState> PasswordBlank { get; }

Property Value

Func<LineState, LineDisplayState>

PasswordStars

A formatter that converts the password characters to stars

public static Func<LineState, LineDisplayState> PasswordStars { get; }

Property Value

Func<LineState, LineDisplayState>

Methods

FixedPrompt(FormattedText, Func<LineState, LineDisplayState>?)

Provides a formatter that displays a fixed prompt in front of the input line, or wraps another formatter overwriting its prefix with the supplied prompt

public static Func<LineState, LineDisplayState> FixedPrompt(FormattedText prompt, Func<LineState, LineDisplayState>? formatter = null)

Parameters

prompt FormattedText

the prompt text to display

formatter Func<LineState, LineDisplayState>

Returns

Func<LineState, LineDisplayState>

WithFixedPrompt(Func<LineState, LineDisplayState>, FormattedText)

Adds a fixed prompt to the given formatter, overwriting the prefix

public static Func<LineState, LineDisplayState> WithFixedPrompt(this Func<LineState, LineDisplayState> formatter, FormattedText prompt)

Parameters

formatter Func<LineState, LineDisplayState>
prompt FormattedText

Returns

Func<LineState, LineDisplayState>