projects
/
kamaki
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
8e8af8c
)
Make container/object listing even more pretty!!!
author
Stavros Sachtouris
<saxtouri@admin.grnet.gr>
Wed, 8 Aug 2012 14:29:07 +0000
(17:29 +0300)
committer
Stavros Sachtouris
<saxtouri@admin.grnet.gr>
Wed, 8 Aug 2012 14:29:07 +0000
(17:29 +0300)
kamaki/clients/pithos_cli.py
patch
|
blob
|
history
diff --git
a/kamaki/clients/pithos_cli.py
b/kamaki/clients/pithos_cli.py
index
7a103a0
..
e3bac6c
100644
(file)
--- a/
kamaki/clients/pithos_cli.py
+++ b/
kamaki/clients/pithos_cli.py
@@
-141,24
+141,34
@@
class store_list(_store_container_command):
def print_objects(self, object_list):
for obj in object_list:
def print_objects(self, object_list):
for obj in object_list:
+ pretty_obj = obj.copy()
if obj['content_type'] == 'application/directory':
if obj['content_type'] == 'application/directory':
- size = ''
+ isDir = True
+ size = 'D'
else:
else:
+ isDir = False
size = format_size(obj['bytes'])
size = format_size(obj['bytes'])
+ pretty_obj['bytes'] = '%s (%s)'%(obj['bytes'],size)
oname = bold(obj['name'])
if getattr(self.args, 'detail'):
print(oname)
oname = bold(obj['name'])
if getattr(self.args, 'detail'):
print(oname)
- print_dict(pretty_keys(obj), exclude=('name'), ident=18)
+ print_dict(pretty_keys(pretty_obj), exclude=('name'))
print
else:
oname = '%6s %s'%(size, oname)
print
else:
oname = '%6s %s'%(size, oname)
- oname += '/' if len(size) == 0 else ''
+ oname += '/' if isDir else ''
print(oname)
def print_containers(self, container_list):
for container in container_list:
size = format_size(container['bytes'])
print(oname)
def print_containers(self, container_list):
for container in container_list:
size = format_size(container['bytes'])
- print('%s (%s, %s objects)' % (container['name'], size, container['count']))
+ if getattr(self.args, 'detail'):
+ print(bold(container['name']))
+ pretty_c = container.copy()
+ pretty_c['bytes'] = '%s (%s)'%(container['bytes'], size)
+ print_dict(pretty_keys(pretty_c), exclude=('name'))
+ else:
+ print('%s (%s, %s objects)' % (bold(container['name']), size, container['count']))
def main(self, container____path__=None):
def main(self, container____path__=None):