mirror of
https://github.com/mikf/gallery-dl.git
synced 2024-11-22 02:32:33 +01:00
update -K output to include quotes around keys
This commit is contained in:
parent
fe41a2b159
commit
2ab66ad899
@ -633,7 +633,7 @@ class KeywordJob(Job):
|
||||
def print_kwdict(self, kwdict, prefix="", markers=None):
|
||||
"""Print key-value pairs in 'kwdict' with formatting"""
|
||||
write = sys.stdout.write
|
||||
suffix = "]" if prefix else ""
|
||||
suffix = "']" if prefix else ""
|
||||
|
||||
markerid = id(kwdict)
|
||||
if markers is None:
|
||||
@ -650,13 +650,13 @@ class KeywordJob(Job):
|
||||
key = prefix + key + suffix
|
||||
|
||||
if isinstance(value, dict):
|
||||
self.print_kwdict(value, key + "[", markers)
|
||||
self.print_kwdict(value, key + "['", markers)
|
||||
|
||||
elif isinstance(value, list):
|
||||
if not value:
|
||||
pass
|
||||
elif isinstance(value[0], dict):
|
||||
self.print_kwdict(value[0], key + "[N][", markers)
|
||||
self.print_kwdict(value[0], key + "[N]['", markers)
|
||||
else:
|
||||
fmt = (" {:>%s} {}\n" % len(str(len(value)))).format
|
||||
write(key + "[N]\n")
|
||||
|
@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env python3
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Copyright 2021 Mike Fährmann
|
||||
# Copyright 2021-2023 Mike Fährmann
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License version 2 as
|
||||
@ -91,9 +91,9 @@ tags[N]
|
||||
0 foo
|
||||
1 bar
|
||||
2 テスト
|
||||
user[id]
|
||||
user['id']
|
||||
123
|
||||
user[name]
|
||||
user['name']
|
||||
test
|
||||
""")
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user