Reader Settings
In case you want to set things up
The reader currently has a global settings instance session-wide. However, it can get overridden if you make a new instance of TermReaderSettings with some available properties mentioned below set. They get read each time you call this function or you activate a keybinding that uses one of these settings.
Here are the available settings that you can set:
PasswordMaskCharSets the password masking character.
HistoryEnabledWhether the history is enabled or not.
HistoryNameSelect what history to use
LeftMarginSets the left margin of the input.
RightMarginSets the right margin of the input.
InputForegroundColorThe foreground color for the input text, as well as the input prompt.
InputBackgroundColorThe background color for the input text, as well as the input prompt.
SuggestionsSets a function that you could use to return an array of strings containing auto completion data.
SuggestionsDelimitersDelimiters to split the current input within a function that returns a list of suggestions.
TreatCtrlCAsInputWhether to treat
Ctrl+Cas input or not. If enabled, TermRead will process this keybinding as aborting the current input.
PlaceholderTextThis is the text that the terminal reader shows when there is no input text. This is used to give users hints on what they should write to the prompt.
PrintDefaultValueWhether to print the default value or not.
DefaultValueFormatThe default value format to print if
PrintDefaultValueis enabled and there is a prompt.
You can copy the above settings in one line using the overload of the TermReaderSettings constructor that allows you to specify another TermReaderSettings instance to copy the settings from that instance to the new one. This is useful if you want to use the global settings without affecting future reads. This is a simple example of how to copy the global settings and to set the password mask without affecting the global password mask: