command: Move override parsing into module
This commit is contained in:
parent
5e4f22bd17
commit
69caea2ef9
@ -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)
|
||||
|
||||
@ -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
|
||||
|
||||
Loading…
Reference in New Issue
Block a user