File tree Expand file tree Collapse file tree 1 file changed +23
-0
lines changed
Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -189,3 +189,26 @@ Exit code to shell
189189The ``self.exit_code `` attribute of your ``cmd2 `` application controls
190190what exit code is sent to the shell when your application exits from
191191``cmdloop() ``.
192+
193+
194+ Asynchronous printing
195+ =====================
196+ ``cmd2 `` provides two functions to provide asynchronous feedback to the user without interfering with
197+ the command line. This means the feedback is provided to the user when they are still entering text at
198+ the prompt. To use this functionality, the application must be running in any terminal that supports
199+ VT100 control characters and readline. Linux, Mac, and Windows 10 and greater all support these.
200+
201+ _async_alert()
202+ Used to display an important message to the user while they are at the prompt in between commands.
203+ To the user it appears as if an alert message is printed above the prompt and their current input
204+ text and cursor location is left alone.
205+
206+ _async_update_prompt()
207+ Updates the prompt while the user is still typing at it. This is good for alerting the user to system
208+ changes dynamically in between commands. For instance you could alter the color of the prompt to indicate
209+ a system status or increase a counter to report an event.
210+
211+
212+ The easiest way to understand these function is to see the AsyncPrinting _ example for a demonstration.
213+
214+ .. _AsyncPrinting : https://github.com/python-cmd2/cmd2/blob/master/examples/async_printing.py
You can’t perform that action at this time.
0 commit comments