diff options
author | kmvanbrunt <kmvanbrunt@gmail.com> | 2018-09-25 23:03:32 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-09-25 23:03:32 -0400 |
commit | dcd79f34466f0fa31734bbbcfcd0fb7b44bca98d (patch) | |
tree | bbf9a315b4c36a8f3789bc07f700e11cf2194424 /docs | |
parent | d63f5673cfa5441cc4dddfb02c1bda89978d4f26 (diff) | |
parent | 151c67e74211465aa93e31e130fea19a4e32f320 (diff) | |
download | cmd2-git-dcd79f34466f0fa31734bbbcfcd0fb7b44bca98d.tar.gz |
Merge pull request #539 from python-cmd2/alert_printer
Alert printer
Diffstat (limited to 'docs')
-rw-r--r-- | docs/unfreefeatures.rst | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/docs/unfreefeatures.rst b/docs/unfreefeatures.rst index cd27745d..b5f9415d 100644 --- a/docs/unfreefeatures.rst +++ b/docs/unfreefeatures.rst @@ -189,3 +189,33 @@ Exit code to shell The ``self.exit_code`` attribute of your ``cmd2`` application controls what exit code is sent to the shell when your application exits from ``cmdloop()``. + + +Asynchronous Feedback +===================== +``cmd2`` provides two functions to provide asynchronous feedback to the user without interfering with +the command line. This means the feedback is provided to the user when they are still entering text at +the prompt. To use this functionality, the application must be running in a terminal that supports +VT100 control characters and readline. Linux, Mac, and Windows 10 and greater all support these. + +async_alert() + Used to display an important message to the user while they are at the prompt in between commands. + To the user it appears as if an alert message is printed above the prompt and their current input + text and cursor location is left alone. + +async_update_prompt() + Updates the prompt while the user is still typing at it. This is good for alerting the user to system + changes dynamically in between commands. For instance you could alter the color of the prompt to indicate + a system status or increase a counter to report an event. + +``cmd2`` also provides a function to change the title of the terminal window. This feature requires the +application be running in a terminal that supports VT100 control characters. Linux, Mac, and Windows 10 and +greater all support these. + +set_window_title() + Sets the terminal window title + + +The easiest way to understand these functions is to see the AsyncPrinting_ example for a demonstration. + +.. _AsyncPrinting: https://github.com/python-cmd2/cmd2/blob/master/examples/async_printing.py |