comparison example/example.py @ 334:99dd71cb477a

run() folded into app.cmdloop()
author cat@eee
date Fri, 12 Feb 2010 23:29:19 -0500
parents e9eea93c777c
children f16f444a4d10
comparison
equal deleted inserted replaced
333:45e70737791f 334:99dd71cb477a
1 '''A sample application for cmd2.''' 1 '''A sample application for cmd2.'''
2 2
3 from cmd2 import Cmd, make_option, options, run 3 from cmd2 import Cmd, make_option, options
4 import unittest, optparse, sys 4 import unittest, optparse, sys
5 5
6 class CmdLineApp(Cmd): 6 class CmdLineApp(Cmd):
7 multilineCommands = ['orate'] 7 multilineCommands = ['orate']
8 Cmd.shortcuts.update({'&': 'speak'}) 8 Cmd.shortcuts.update({'&': 'speak'})
29 29
30 do_say = do_speak # now "say" is a synonym for "speak" 30 do_say = do_speak # now "say" is a synonym for "speak"
31 do_orate = do_speak # another synonym, but this one takes multi-line input 31 do_orate = do_speak # another synonym, but this one takes multi-line input
32 32
33 c = CmdLineApp() 33 c = CmdLineApp()
34 run(c) 34 c.cmdloop()