From 6aca930cc95031058bf6aaef5e76b569eef7f1de Mon Sep 17 00:00:00 2001 From: Michele Angrisano Date: Fri, 23 Oct 2026 17:51:10 +0200 Subject: [PATCH] gh-58083: Expand the introduction of the `cmd` module (GH-155738) (cherry picked from commit fd8f475c7eff783495de765b7981dd803094c589) Co-authored-by: Michele Angrisano Co-authored-by: Stan Ulbrych --- Doc/library/cmd.rst | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Doc/library/cmd.rst b/Doc/library/cmd.rst index 1757dedabbf633f..8636fecb8323a4f 100644 --- a/Doc/library/cmd.rst +++ b/Doc/library/cmd.rst @@ -15,6 +15,13 @@ command interpreters. These are often useful for test harnesses, administrative tools, and prototypes that will later be wrapped in a more sophisticated interface. +A command interpreter built with :class:`Cmd` typically presents the user +with an interactive prompt, reads input one line at a time, and dispatches each +command to a method named ``do_`` followed by the command name. For example, +the ``help`` command is handled by the :meth:`~Cmd.do_help` method. Apart from +the built-in ``help`` command, most of the interpreter's behavior is defined by +the ``do_*`` methods you add in your own subclass. + .. class:: Cmd(completekey='tab', stdin=None, stdout=None) A :class:`Cmd` instance or subclass instance is a line-oriented interpreter