Esempio n. 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))
Esempio n. 2
0
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
Esempio n. 3
0
 def setUp(self):
     self.parser = CommandParser()
     self.parser.add_commands(testCommands)