C# Class PowerArgs.Cli.RichCommandLineContext

A class that provides context for consumers of the RichTextCommandLineReader
Show file Open project: adamabdelhamed/PowerArgs Class Usage Examples

Private Properties

Property Type Description
GetQuoteStatus QuoteStatus
IsCursorOnToken bool
Reset void
RichCommandLineContext System

Public Methods

Method Description
ClearConsole ( ) : void

Clears the console

CompleteCurrentToken ( Token currentToken, ConsoleString completion ) : void

Performs an auto complete of the given token.

GetBufferSubstringFromToken ( Token t ) : ConsoleString

Returns the portion of the buffer represented by the given token

RefreshConsole ( int leftAdjust, int topAdjust ) : void

Rewrites the console using the latest values in the Buffer, preserving the cursor position with an optional adjustment.

RefreshTokenInfo ( bool force = false ) : void

Runs the tokenizer if it hasn't already been run on the current key press. You can pass a force flag if you want to force the tokenizer to run. You would need to do this only if you've manually changed the buffer within your handler.

ReplaceConsole ( ConsoleString newBuffer ) : void

Rewrites the console using the latest values in the Buffer and moves the cursor to the end of the line.

WriteCharacterForPressedKey ( ) : void

Takes the value of KeyPressed.KeyChar and writes it to the console in the current buffer position.

Private Methods

Method Description
GetQuoteStatus ( List chars, int startPosition ) : QuoteStatus
IsCursorOnToken ( Token t ) : bool
Reset ( ) : void
RichCommandLineContext ( ConsoleHistoryManager historyManager ) : System

Method Details

ClearConsole() public method

Clears the console
public ClearConsole ( ) : void
return void

CompleteCurrentToken() public method

Performs an auto complete of the given token.
public CompleteCurrentToken ( Token currentToken, ConsoleString completion ) : void
currentToken Token the token to complete
completion ConsoleString the completed token. Note that it is not required that the completion string starts with the current token value, though it usually does.
return void

GetBufferSubstringFromToken() public method

Returns the portion of the buffer represented by the given token
public GetBufferSubstringFromToken ( Token t ) : ConsoleString
t Token the token whose position to use to look into the buffer
return ConsoleString

RefreshConsole() public method

Rewrites the console using the latest values in the Buffer, preserving the cursor position with an optional adjustment.
public RefreshConsole ( int leftAdjust, int topAdjust ) : void
leftAdjust int Adjusts the left cursor position by the desired amound. If you want the cursor to stay where it was then use 0.
topAdjust int Adjusts the top cursor position by the desired amound. If you want the cursor to stay where it was then use 0.
return void

RefreshTokenInfo() public method

Runs the tokenizer if it hasn't already been run on the current key press. You can pass a force flag if you want to force the tokenizer to run. You would need to do this only if you've manually changed the buffer within your handler.
public RefreshTokenInfo ( bool force = false ) : void
force bool If true, then the tokenizer is run no matter what. If false, the tokenizer only runs if it hasn't yet run on this keystroke.
return void

ReplaceConsole() public method

Rewrites the console using the latest values in the Buffer and moves the cursor to the end of the line.
public ReplaceConsole ( ConsoleString newBuffer ) : void
newBuffer ConsoleString The new line of text that will replace the current buffer.
return void

WriteCharacterForPressedKey() public method

Takes the value of KeyPressed.KeyChar and writes it to the console in the current buffer position.
public WriteCharacterForPressedKey ( ) : void
return void