Revision 0399ac7e kamaki/cli/commands/pithos.py
b/kamaki/cli/commands/pithos.py | ||
---|---|---|
40 | 40 |
from kamaki.cli.errors import raiseCLIError, CLISyntaxError |
41 | 41 |
from kamaki.cli.utils import ( |
42 | 42 |
format_size, to_bytes, print_dict, print_items, pretty_keys, |
43 |
page_hold, bold, ask_user, get_path_size) |
|
43 |
page_hold, bold, ask_user, get_path_size, print_json)
|
|
44 | 44 |
from kamaki.cli.argument import FlagArgument, ValueArgument, IntArgument |
45 | 45 |
from kamaki.cli.argument import KeyValueArgument, DateArgument |
46 | 46 |
from kamaki.cli.argument import ProgressBarArgument |
... | ... | |
329 | 329 |
exact_match=FlagArgument( |
330 | 330 |
'Show only objects that match exactly with path', |
331 | 331 |
'--exact-match'), |
332 |
enum=FlagArgument('Enumerate results', '--enumerate') |
|
332 |
enum=FlagArgument('Enumerate results', '--enumerate'), |
|
333 |
json_output=FlagArgument('show output in json', ('-j', '--json')) |
|
333 | 334 |
) |
334 | 335 |
|
335 | 336 |
def print_objects(self, object_list): |
337 |
if self['json_output']: |
|
338 |
print_json(object_list) |
|
339 |
return |
|
336 | 340 |
limit = int(self['limit']) if self['limit'] > 0 else len(object_list) |
337 | 341 |
for index, obj in enumerate(object_list): |
338 | 342 |
if self['exact_match'] and self.path and not ( |
... | ... | |
362 | 366 |
page_hold(index, limit, len(object_list)) |
363 | 367 |
|
364 | 368 |
def print_containers(self, container_list): |
369 |
if self['json_output']: |
|
370 |
print_json(container_list) |
|
371 |
return |
|
365 | 372 |
limit = int(self['limit']) if self['limit'] > 0\ |
366 | 373 |
else len(container_list) |
367 | 374 |
for index, container in enumerate(container_list): |
Also available in: Unified diff