Name
onecmd
Synopsis
c.onecmd(s)
c
.cmdloop calls
c
.onecmd(
s
)
for each command line s that the user
inputs. You can also call onecmd directly, if you
have independently obtained a line s that
you need to process as a command. Normally, subclasses do not
override method onecmd.
Cmd.onecmd unconditionally sets
c
.lastcmd=
s.
Then, onecmd calls
do_
verb if
s starts with the word
verb and if the subclass supplies such a
method, or else methods emptyline or
default, as explained earlier. In any case,
Cmd.onecmd returns the result of whatever other
method it ends up calling, to be interpreted by
postcmd as a termination-request flag.
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access