Revision 6514457a kamaki/cli/utils.py

b/kamaki/cli/utils.py
107 107
            print print_str + ' ' + unicode(val).strip()
108 108

  
109 109

  
110
def print_list(l, exclude=(), ident=0):
110
def print_list(l, exclude=(), ident=0, rjust=True):
111 111
    if not isinstance(l, list):
112 112
        raise CLIError(message='Cannot list_print a non-list object')
113 113
    try:
......
122 122
        if item in exclude:
123 123
            continue
124 124
        if isinstance(item, dict):
125
            print('{'.rjust(margin))
125
            print '{'.rjust(margin) if rjust else '{'
126 126
            print_dict(item, exclude=exclude, ident=margin + 6)
127
            print '}'.rjust(margin)
127
            print '}'.rjust(margin) if rjust else '}'
128 128
        elif isinstance(item, list):
129
            print '['.rjust(margin)
129
            print '['.rjust(margin) if rjust else ']'
130 130
            print_list(item, exclude=exclude, ident=margin + 6)
131
            print ']'.rjust(margin)
131
            print ']'.rjust(margin) if rjust else ']'
132 132
        else:
133
            print unicode(item).rjust(margin)
133
            print unicode(item).rjust(margin) if rjust else unicode(item)
134 134

  
135 135

  
136 136
def print_items(items, title=('id', 'name')):

Also available in: Unified diff