Rewrite using cmd

The cmd module provides a Cmd (old-style) class with a nice set of
easy-to-read template methods. Re-write this to use that so it appears
object-oriented.