Revision 65fe4693 lib/cli.py
b/lib/cli.py | ||
---|---|---|
195 | 195 |
|
196 | 196 |
|
197 | 197 |
def check_unit(option, opt, value): |
198 |
"""OptParsers custom converter for units. |
|
199 |
|
|
200 |
""" |
|
198 | 201 |
try: |
199 | 202 |
return utils.ParseUnit(value) |
200 | 203 |
except errors.UnitParseError, err: |
... | ... | |
202 | 205 |
|
203 | 206 |
|
204 | 207 |
class CliOption(Option): |
208 |
"""Custom option class for optparse. |
|
209 |
|
|
210 |
""" |
|
205 | 211 |
TYPES = Option.TYPES + ("unit",) |
206 | 212 |
TYPE_CHECKER = copy.copy(Option.TYPE_CHECKER) |
207 | 213 |
TYPE_CHECKER["unit"] = check_unit |
Also available in: Unified diff