humblebundle
humblebundle copied to clipboard
The --list-bundles/-L option does not handle --json/-j option
When asking for the list of bought bundles, we always get the flat list even if --json option is passed.
Since the normal dump would be pretty big, I tried to produce a simpler output (maybe not the cleanest possible but it might proves useful to some besides me).
Here is the added code from line 779 (GitHub does not accept the patch file and I don't want to bother with a fork & pull-request):
elif args.list_bundles:
bundles = hb.bundles.items()
if args.json:
print ('[')
for bundle in sorted(bundles):
print (' [')
print (' "%s",' % bundle[1]['machine_name'])
print (' {')
print (' "machine_name": "%s"' % bundle[1]['machine_name'])
print (' "human_name": "%s"' % bundle[1]['human_name']).encode('utf-8')
print (' }')
print (' ],')
print (']')
return
for bundle in sorted(bundles):
Hope it will help.
Thanks, that's a nice suggestion!
And by the way, --json
also does not work with --list
Maybe an even simpler format is better? I'm thinking about this:
[
["machine_name_A", "human_name_A"],
["machine_name_B", "human_name_B"],
...
]
What do you think?
Seems reasonable enough. In fact, I choose the slightly more complex format only to be a subset of the full version but when we call with these options, we obviously search for a simple answer so it makes perfect sense.