Bug 928195 - Part 5: mach command for generating WebIDL example files; r=froydnj
authorGregory Szorc <gps@mozilla.com>
Thu, 14 Nov 2013 10:34:55 -0800
changeset 170573 0d9f8da0806ee18af8561672dc2998821099e246
parent 170572 67fa1478308ebe2874cf965cd240d8aebf0ebde7
child 170574 65061e971eb8daf5818d437f989f7774b49088be
push idunknown
push userunknown
push dateunknown
reviewersfroydnj
bugs928195
milestone29.0a1
Bug 928195 - Part 5: mach command for generating WebIDL example files; r=froydnj
dom/bindings/mach_commands.py
--- a/dom/bindings/mach_commands.py
+++ b/dom/bindings/mach_commands.py
@@ -13,16 +13,27 @@ from mach.decorators import (
     Command,
 )
 
 from mozbuild.base import MachCommandBase
 
 
 @CommandProvider
 class WebIDLProvider(MachCommandBase):
+    @Command('webidl-example', category='misc',
+        description='Generate example files for a WebIDL interface.')
+    @CommandArgument('interface', nargs='+',
+        help='Interface(s) whose examples to generate.')
+    def webidl_example(self, interface):
+        from mozwebidlcodegen import BuildSystemWebIDL
+
+        manager = self._spawn(BuildSystemWebIDL).manager
+        for i in interface:
+            manager.generate_example_files(i)
+
     @Command('webidl-parser-test', category='testing',
         description='Run WebIDL tests.')
     @CommandArgument('--verbose', '-v', action='store_true',
         help='Run tests in verbose mode.')
     def webidl_test(self, verbose=False):
         sys.path.insert(0, os.path.join(self.topsrcdir, 'other-licenses',
             'ply'))