Revision 0f383dcc kamaki/cli/commands/pithos.py
b/kamaki/cli/commands/pithos.py | ||
---|---|---|
39 | 39 |
from kamaki.cli.command_tree import CommandTree |
40 | 40 |
from kamaki.cli.errors import raiseCLIError, CLISyntaxError, CLIBaseUrlError |
41 | 41 |
from kamaki.cli.utils import ( |
42 |
format_size, to_bytes, print_dict, print_items, pretty_keys, pretty_dict,
|
|
43 |
page_hold, bold, ask_user, get_path_size, print_json, guess_mime_type)
|
|
42 |
format_size, to_bytes, print_dict, print_items, page_hold, bold, ask_user,
|
|
43 |
get_path_size, print_json, guess_mime_type) |
|
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 |
... | ... | |
388 | 388 |
prfx = ('%s%s. ' % (empty_space, index)) if self['enum'] else '' |
389 | 389 |
if self['detail']: |
390 | 390 |
print('%s%s' % (prfx, oname)) |
391 |
print_dict(pretty_keys(pretty_obj), exclude=('name'))
|
|
391 |
print_dict(pretty_obj, exclude=('name'))
|
|
392 | 392 |
|
393 | 393 |
else: |
394 | 394 |
oname = '%s%9s %s' % (prfx, size, oname) |
... | ... | |
413 | 413 |
pretty_c = container.copy() |
414 | 414 |
if 'bytes' in container: |
415 | 415 |
pretty_c['bytes'] = '%s (%s)' % (container['bytes'], size) |
416 |
print_dict(pretty_keys(pretty_c), exclude=('name'))
|
|
416 |
print_dict(pretty_c, exclude=('name'))
|
|
417 | 417 |
|
418 | 418 |
else: |
419 | 419 |
if 'count' in container and 'bytes' in container: |
... | ... | |
1761 | 1761 |
until = self['until'] |
1762 | 1762 |
r = None |
1763 | 1763 |
if self.container is None: |
1764 |
if self['detail']: |
|
1765 |
r = self.client.get_account_info(until=until) |
|
1766 |
else: |
|
1767 |
r = self.client.get_account_meta(until=until) |
|
1768 |
r = pretty_keys(r, '-') |
|
1764 |
r = self.client.get_account_info(until=until) |
|
1769 | 1765 |
elif self.path is None: |
1770 | 1766 |
if self['detail']: |
1771 | 1767 |
r = self.client.get_container_info(until=until) |
... | ... | |
1774 | 1770 |
ometa = self.client.get_container_object_meta(until=until) |
1775 | 1771 |
r = {} |
1776 | 1772 |
if cmeta: |
1777 |
r['container-meta'] = pretty_keys(cmeta, '-')
|
|
1773 |
r['container-meta'] = cmeta
|
|
1778 | 1774 |
if ometa: |
1779 |
r['object-meta'] = pretty_keys(ometa, '-')
|
|
1775 |
r['object-meta'] = ometa
|
|
1780 | 1776 |
else: |
1781 | 1777 |
if self['detail']: |
1782 | 1778 |
r = self.client.get_object_info( |
... | ... | |
1786 | 1782 |
r = self.client.get_object_meta( |
1787 | 1783 |
self.path, |
1788 | 1784 |
version=self['object_version']) |
1789 |
r = pretty_keys(pretty_keys(r, '-')) |
|
1790 | 1785 |
if r: |
1791 | 1786 |
self._print(r, print_dict) |
1792 | 1787 |
|
... | ... | |
1859 | 1854 |
if not self['in_bytes']: |
1860 | 1855 |
for k in output: |
1861 | 1856 |
output[k] = format_size(output[k]) |
1862 |
pretty_dict(output, '-')
|
|
1857 |
print_dict(output, '-')
|
|
1863 | 1858 |
|
1864 | 1859 |
self._print(self.client.get_account_quota(), pretty_print) |
1865 | 1860 |
|
... | ... | |
1889 | 1884 |
if not self['in_bytes']: |
1890 | 1885 |
for k, v in output.items(): |
1891 | 1886 |
output[k] = 'unlimited' if '0' == v else format_size(v) |
1892 |
pretty_dict(output, '-')
|
|
1887 |
print_dict(output, '-')
|
|
1893 | 1888 |
|
1894 | 1889 |
self._print( |
1895 | 1890 |
self.client.get_container_limit(self.container), pretty_print) |
... | ... | |
2006 | 2001 |
@errors.generic.all |
2007 | 2002 |
@errors.pithos.connection |
2008 | 2003 |
def _run(self): |
2009 |
self._print(self.client.get_account_group(), pretty_dict, delim='-')
|
|
2004 |
self._print(self.client.get_account_group(), print_dict, delim='-')
|
|
2010 | 2005 |
|
2011 | 2006 |
def main(self): |
2012 | 2007 |
super(self.__class__, self)._run() |
Also available in: Unified diff