better array parsing
This commit is contained in:
parent
178d935ca4
commit
bc8dbbd2f6
1 changed files with 6 additions and 4 deletions
|
@ -59,19 +59,21 @@ def main():
|
|||
print('\ninvalid metadata argument, format is -m "key=value"')
|
||||
sys.exit(1)
|
||||
k, v = m.split('=', 1)
|
||||
if v[0] == '[' and v[-1] == ']':
|
||||
v = [v[1:-1]]
|
||||
if k in meta:
|
||||
if isinstance(meta[k], str):
|
||||
meta[k] = [meta[k]]
|
||||
meta[k].append(v)
|
||||
elif v[0] == '[' and v[-1] == ']':
|
||||
meta[k] = v[1:-1]
|
||||
if isinstance(v, list):
|
||||
meta[k].update(v)
|
||||
else:
|
||||
meta[k].append(v)
|
||||
else:
|
||||
meta[k] = v
|
||||
files = opts.files
|
||||
if not files:
|
||||
parser.print_help()
|
||||
sys.exit(1)
|
||||
|
||||
id = upload(opts.api_url, files, meta)
|
||||
print(id)
|
||||
|
||||
|
|
Loading…
Reference in a new issue