Revision 90c22848 kamaki/cli/commands/__init__.py
b/kamaki/cli/commands/__init__.py | ||
---|---|---|
116 | 116 |
|
117 | 117 |
@DontRaiseUnicodeError |
118 | 118 |
def write(self, s): |
119 |
self._out.write('%s' % s)
|
|
119 |
self._out.write(s) |
|
120 | 120 |
self._out.flush() |
121 | 121 |
|
122 | 122 |
@DontRaiseUnicodeError |
... | ... | |
133 | 133 |
return print_list(*args, **kwargs) |
134 | 134 |
|
135 | 135 |
def print_dict(self, *args, **kwargs): |
136 |
kwargs.setdefault('out', self._out)
|
|
136 |
kwargs.setdefault('out', self) |
|
137 | 137 |
return print_dict(*args, **kwargs) |
138 | 138 |
|
139 | 139 |
def print_json(self, *args, **kwargs): |
140 |
kwargs.setdefault('out', self._out)
|
|
140 |
kwargs.setdefault('out', self) |
|
141 | 141 |
return print_json(*args, **kwargs) |
142 | 142 |
|
143 | 143 |
def print_items(self, *args, **kwargs): |
144 |
kwargs.setdefault('out', self._out)
|
|
144 |
kwargs.setdefault('out', self) |
|
145 | 145 |
return print_items(*args, **kwargs) |
146 | 146 |
|
147 | 147 |
def ask_user(self, *args, **kwargs): |
148 | 148 |
kwargs.setdefault('user_in', self._in) |
149 |
kwargs.setdefault('out', self._out)
|
|
149 |
kwargs.setdefault('out', self) |
|
150 | 150 |
return ask_user(*args, **kwargs) |
151 | 151 |
|
152 | 152 |
@DontRaiseKeyError |
... | ... | |
298 | 298 |
|
299 | 299 |
def _optional_output(self, r): |
300 | 300 |
if self['json_output']: |
301 |
print_json(r, out=self._out)
|
|
301 |
print_json(r, out=self) |
|
302 | 302 |
elif self['with_output']: |
303 |
print_items([r] if isinstance(r, dict) else r, out=self._out)
|
|
303 |
print_items([r] if isinstance(r, dict) else r, out=self) |
|
304 | 304 |
|
305 | 305 |
|
306 | 306 |
class _optional_json(object): |
... | ... | |
317 | 317 |
|
318 | 318 |
def _print(self, output, print_method=print_items, **print_method_kwargs): |
319 | 319 |
if self['json_output'] or self['output_format']: |
320 |
print_json(output, out=self._out)
|
|
320 |
print_json(output, out=self) |
|
321 | 321 |
else: |
322 |
print_method_kwargs.setdefault('out', self._out)
|
|
322 |
print_method_kwargs.setdefault('out', self) |
|
323 | 323 |
print_method(output, **print_method_kwargs) |
324 | 324 |
|
325 | 325 |
|
Also available in: Unified diff