changeset 62:2a5fa6876e48

update template to conform to the new CLI
author Jeff Hammel <jhammel@mozilla.com>
date Tue, 11 Jan 2011 09:18:33 -0800
parents 59bbfa7e67bb
children 04e41ee436c3
files autobot/template.py
diffstat 1 files changed, 8 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- 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()