August 2018
Intermediate to advanced
366 pages
10h 14m
English
The cmd.Cmd loop prints the prompt we provided through the prompt class property and awaits a command. Anything we write after prompt is split and the first part is looked up against the list of methods provided by our own subclass.
Whenever a command is provided, cmd.Cmd.cmdloop calls the associated method and then starts again.
Any method starting with do_* is a command, and the part after do_ is the command name. Any docstring of the method implementing the command is then reported in our tool's documentation if the help command is used within the interactive prompt.
The Cmd class provides no facility to parse arguments for a command, so if your command has more than a single argument, your have to split them yourself. ...