Make ; parsing optional

This commit is contained in:
tengqm
2015-03-05 09:35:04 +08:00
parent 073ee16378
commit 0c0a85fd3e

View File

@@ -107,13 +107,16 @@ def print_dict(d, formatters=None):
print(pt.get_string(sortby='Property'))
def format_parameters(params):
def format_parameters(params, parse_semicolon=True):
'''Reformat parameters into dict of format expected by the API.'''
if not params:
return {}
if len(params) == 1:
params = params[0].split(';')
if parse_semicolon:
# expect multiple invocations of --parameters but fall back to ';'
# delimited if only one --parameters is specified
if len(params) == 1:
params = params[0].split(';')
parameters = {}
for p in params: