# HG changeset patch # User Jeff Hammel # Date 1294766313 28800 # Node ID 2a5fa6876e48cd06e4bcbcc30d43a8065cd52a62 # Parent 59bbfa7e67bb738e727e9d6d94114894de8b02d3 update template to conform to the new CLI diff -r 59bbfa7e67bb -r 2a5fa6876e48 autobot/template.py --- a/autobot/template.py Tue Jan 11 08:26:30 2011 -0800 +++ b/autobot/template.py Tue Jan 11 09:18:33 2011 -0800 @@ -19,7 +19,7 @@ except ImportError: from subprocess import call -def factory_descriptions(): +def print_descriptions(): """print factory descriptions""" buffer = StringIO() @@ -45,7 +45,7 @@ if factory: assert factory in factories, 'Factory must be one of: ' % ', '.join(factories.keys()) elif self.interactive: - print factory_descriptions() + print print_descriptions() sys.stdout.write('Enter factory: ') factory = raw_input() assert factory in factories, 'Factory must be one of: ' % ', '.join(factories.keys()) @@ -112,7 +112,7 @@ help="list available factories") return parser - def parse(self, parser=None, options=None, args=None): + def parse(self, args=None, parser=None, options=None): # parse the command line if not parser or not options or not args: @@ -121,29 +121,26 @@ # list the factories if options._list_factories: - print factory_descriptions() + print print_descriptions() parser.exit() # call the parent - return MakeItSoCLI.parse(self, parser, options, args) + return MakeItSoCLI.parse(self, args, parser, options) ### console_script front-ends def create_master(args=sys.argv[1:]): cli = AutobotMasterCLI(AutobotMasterTemplate) - template = cli.parse() - template.substitute() + cli(*args) def create_slave(args=sys.argv[1:]): cli = MakeItSoCLI(AutobotSlaveTemplate) - template = cli.parse() - template.substitute() + cli(*args) def create_autobot(args=sys.argv[1:]): cli = AutobotMasterCLI(AutobotTemplate) - template = cli.parse() - template.substitute() + cli(*args) if __name__ == '__main__': create_master()