Advanced interactive input - adambajguz/Typin GitHub Wiki
In interactive mode by default advanced command input with command history and auto-completion is used.
Note: Auto-completion is not supported in normal/tool mode.
History
Command history is provided by InputHistoryProvider
that (if needed) can be accessed with InputHistory
property from ICliContext
.
Access to InputHistoryProvider
is useful when you want to, e.g., disable history, clear it manually, or get all entries.
Entries from the history are accessed using up/down arrows in interactive mode. Escape key clears the input and resets history selection.
Auto-completion
To used command auto-completion simply press Tab
or Shift + Tab
as in normal terminal like bash or cmd.
Shortcuts handling
When advanced interactive input is used builder.UseInteractiveMode(useAdvancedInput: true);
the default behavior of the terminal is lost, e.g., Ctrl + Delete won't delete a word on the left side of the cursor. To overcome this problem, Typin comes with its own shortcut/key/input handling system.
Key/Shortcut | Action |
---|---|
Home |
Moves cursor to the beginning of the line. |
End |
Moves cursor to the end of the line. |
Escape |
Clear line. |
Enter |
Line feed. |
Backspace |
Delete previous character. |
Delete |
Delete next word or whitespace. |
Ctrl + Delete |
Delete next character. |
Ctrl + Backspace |
Delete previous word or whitespace. |
Tab |
Start forward or next command line completion. |
Shift + Tab |
Start backward or previous command line completion. |
Insert |
currently not supported :( |
← |
Go backward one character. |
→ |
Go forward one character. |
Ctrl + ← |
Move cursor to the next word on the left. |
Ctrl + → |
Move cursor to the next word on the right. |
Ctrl + ↑ |
Move backward in the history. |
Ctrl + ↓ |
Move forward in the history. |
Acknowledgments: ReadLine library was an inspiration for history and auto-completion in Typin. Its source code was partially used and modified to fit into Typin.