PromptFormatter¶
Class for formatting a text input prompt, to allow overriding the message as desired.
Default answers will appear in [square brackets] and allow the user to return that answer by simply pressing the Enter button.
If a ‘Quit’ option is desired, set enable_quit to True and provide a quit_string (default is ‘q’) and a quit_message (default is ‘(enter q to Quit)’).
Format the message presented to the user during input prompting.
Parameters: - prompt (str) – The message to ask the user.
- default (str, optional) – The default answer if user does not provide explicit input.
- enable_quit (bool, optional) – Flag to determine whether a Quit option will be presented.
- quit_string (str, optional) – The string the user must input to quit (default is ‘q’).
- quit_message (str, optional) – The message to the user explaining how to Quit.
Returns: The formatted prompt string.
Return type: str