Switching between cmd.CMD instances

Josh English Joshua.R.English at gmail.com
Wed Apr 2 01:03:33 EDT 2014


I have a program with several cmd.Cmd instances. I am trying to figure out what the best way to organize them should be.

I've got my BossCmd, SubmissionCmd, and StoryCmd objects.

The BossCmd object can start either of the other two, and this module allows the user switch back and forth between them. Exiting either of the sub-command objects returns back to the BossCmd.

I have defined both a do_done and do_exit method on the sub-commands.

Is it possible to flag BossCmd so when either of the other two process do_exit, the BossCmd will also exit?

Josh








More information about the Python-list mailing list