Mercurial > hg > configuration
comparison configuration/configuration.py @ 80:35416ad14098
notes to self about how to make this better; still needs a little thought
author | Jeff Hammel <jhammel@mozilla.com> |
---|---|
date | Mon, 09 Apr 2012 15:47:08 -0700 |
parents | 348451576d84 |
children | f3b2563b2a91 |
comparison
equal
deleted
inserted
replaced
79:fe31a57ac577 | 80:35416ad14098 |
---|---|
113 """add the parsed option to the set of things parsed""" | 113 """add the parsed option to the set of things parsed""" |
114 optparse.Option.take_action(self, action, dest, opt, value, values, parser) | 114 optparse.Option.take_action(self, action, dest, opt, value, values, parser) |
115 if not hasattr(parser, 'parsed'): | 115 if not hasattr(parser, 'parsed'): |
116 parser.parsed = set() | 116 parser.parsed = set() |
117 parser.parsed.add(dest) | 117 parser.parsed.add(dest) |
118 # TODO (see following comment) | |
119 # if self.type in ... | |
118 | 120 |
119 ### plugins for option types | 121 ### plugins for option types |
120 ### TODO: this could use a bit of thought | 122 ### TODO: this could use a bit of thought |
121 ### They should probably be classes | 123 ### They should probably be classes |
124 # class Option(object): | |
125 # def arguments(self, name, value): | |
126 # """return arguments appropriate for construction of an optparse.Option | |
127 # def take_action(self, ...): | |
128 # """do something appropriate based on type""" | |
129 | |
122 def base_cli(name, value): | 130 def base_cli(name, value): |
131 """base_cli for all option types""" | |
132 | |
123 # CLI arguments | 133 # CLI arguments |
124 args = value.get('flags', ['--%s' % name]) | 134 args = value.get('flags', ['--%s' % name]) |
125 if not args: | 135 if not args: |
126 # No CLI interface | 136 # No CLI interface |
127 return (), {} | 137 return (), {} |