command: Move override parsing into module

This commit is contained in:
Stein Magnus Jodal 2013-04-30 23:25:02 +02:00
parent 5e4f22bd17
commit 69caea2ef9
2 changed files with 3 additions and 8 deletions

View File

@ -13,7 +13,9 @@ def config_files_type(value):
def config_override_type(value):
try:
return config_lib.parse_override(value)
section, remainder = value.split(b'/', 1)
key, value = remainder.split(b'=', 1)
return (section.strip(), key.strip(), value.strip())
except ValueError:
raise argparse.ArgumentTypeError(
'%s must have the format section/key=value' % value)

View File

@ -140,13 +140,6 @@ def _format(config, comments, schemas, display):
return b'\n'.join(output)
def parse_override(override):
"""Parse ``section/key=value`` command line overrides"""
section, remainder = override.split(b'/', 1)
key, value = remainder.split(b'=', 1)
return (section.strip(), key.strip(), value.strip())
class Proxy(collections.Mapping):
def __init__(self, data):
self._data = data