changeset 20:dbfabe96187e

start to add types...still have some things to work out here
author Jeff Hammel <jhammel@mozilla.com>
date Mon, 26 Mar 2012 14:03:48 -0700
parents cadc9514f60a
children 0fe74db6a56c
files configuration/config.py
diffstat 1 files changed, 13 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/configuration/config.py	Mon Mar 26 13:54:43 2012 -0700
+++ b/configuration/config.py	Mon Mar 26 14:03:48 2012 -0700
@@ -75,6 +75,19 @@
     ### methods for optparse
     ### XXX could go in a subclass
 
+    @classmethod
+    def bool_cli(cls, value):
+        if value.get('default'):
+            pass
+    @classmethod
+    def list_cli(cls, value):
+        # TODO: could use 'extend'
+        # - http://hg.mozilla.org/build/mozharness/file/5f44ba08f4be/mozharness/base/config.py#l41
+        return dict(action='append')
+
+    types = {bool: bool_cli,
+             list: list_cli}
+
     def optparse_options(self, parser):
         """add optparse options to a OptionParser instance"""
         for key, value in self.items():