예제 #1
0
class testCmdparse(unittest.TestCase):
    def setUp(self):
        self.parser = CommandParser()
        self.parser.add_commands(testCommands)

    def tearDown(self):
        del self.parser

    def testEcho(self):
        (command, options, args) = self.parser.parse_args("echo foo".split())

        self.assert_(isinstance(command, testCommands.EchoCommand))
예제 #2
0
파일: script.py 프로젝트: jmoiron/chapman
def main():
    parser = CommandParser(usage="%prog [command]", version='0.1')
    parser.add_command(ListCommand())
    command, opts, args = parser.parse_args()
    if command is None:
        parser.print_help()
        return 1
    return command.run(opts, args)
    return 0
예제 #3
0
 def setUp(self):
     self.parser = CommandParser()
     self.parser.add_commands(testCommands)