C# Class PowerArgs.Cli.RichTextCommandLineReader

A utility that lets you prompt a console user for input in an interactive way. It provides hooks for tab completion, syntax highlighting, history management via the up and down arrows, etc.
显示文件 Open project: adamabdelhamed/PowerArgs Class Usage Examples

Private Properties

Property Type Description
DoSyntaxHighlighting void

Public Methods

Method Description
IsWriteable ( ConsoleKeyInfo info ) : bool

Determines if the given key is writable text

ReadCommandLine ( ConsoleString initialBuffer = null ) : string[]

Reads a line of text from the console and converts it into a string array that has accounted for escape sequences and quoted string literals.

ReadLine ( ConsoleString initialBuffer = null ) : ConsoleString

Reads a line of text from the console. Any interactions you've configured before calling this method will be in effect.

RegisterHandler ( IKeyHandler handler ) : void

Lets you register a custom key handler. You are responsible for ensuring that each key is only handled by one handler. This method will throw if you try to add a duplicate key handler.

RichTextCommandLineReader ( ) : System

Creates a new reader.

UnregisterHandler ( ConsoleKey key ) : bool

Unregisters the handler for the given key

UnregisterHandler ( IKeyHandler handler ) : void

Unregisters the given key handler from the reader. You should only do this if you're planning on overriding the default handlers, and you should do so with caution.

Private Methods

Method Description
DoSyntaxHighlighting ( RichCommandLineContext context ) : void

Method Details

IsWriteable() public static method

Determines if the given key is writable text
public static IsWriteable ( ConsoleKeyInfo info ) : bool
info System.ConsoleKeyInfo the key info
return bool

ReadCommandLine() public method

Reads a line of text from the console and converts it into a string array that has accounted for escape sequences and quoted string literals.
public ReadCommandLine ( ConsoleString initialBuffer = null ) : string[]
initialBuffer ConsoleString Optionally seed the prompt with an initial value that the end user can modify
return string[]

ReadLine() public method

Reads a line of text from the console. Any interactions you've configured before calling this method will be in effect.
public ReadLine ( ConsoleString initialBuffer = null ) : ConsoleString
initialBuffer ConsoleString Optionally seed the prompt with an initial value that the end user can modify
return ConsoleString

RegisterHandler() public method

Lets you register a custom key handler. You are responsible for ensuring that each key is only handled by one handler. This method will throw if you try to add a duplicate key handler.
public RegisterHandler ( IKeyHandler handler ) : void
handler IKeyHandler The handler to register
return void

RichTextCommandLineReader() public method

Creates a new reader.
public RichTextCommandLineReader ( ) : System
return System

UnregisterHandler() public method

Unregisters the handler for the given key
public UnregisterHandler ( ConsoleKey key ) : bool
key ConsoleKey the key to unregister
return bool

UnregisterHandler() public method

Unregisters the given key handler from the reader. You should only do this if you're planning on overriding the default handlers, and you should do so with caution.
public UnregisterHandler ( IKeyHandler handler ) : void
handler IKeyHandler The handler to unregister
return void