The following patch adds stdin, stdout as optional
arguments to the cmd.Cmd constructor (defaulting to
sys.stdin, sys.stdout), and changes the Cmd methods
throughout to use self.stdout.write() and
self.stdin.foo for output and input. This allows much
greater flexibility for using cmd - for instance,
hooking it into a telnet server. And if the response
is YAGNI, well, actually, IAGNI, because it's in use
today (and for the last year). :)
If this is acceptable, I'll provide a documentation
patch as well.
|