Commit ddcb2e09 authored by Stavros Sachtouris's avatar Stavros Sachtouris
Browse files

Implement member versions of utils print methods

Refs: #4292
parent c49188b7
...@@ -32,7 +32,9 @@ ...@@ -32,7 +32,9 @@
# or implied, of GRNET S.A.command # or implied, of GRNET S.A.command
from kamaki.cli.logger import get_logger from kamaki.cli.logger import get_logger
from kamaki.cli.utils import print_json, print_items, filter_dicts_by_dict from kamaki.cli.utils import (
print_list, print_dict, print_json, print_items, ask_user,
filter_dicts_by_dict)
from kamaki.cli.argument import FlagArgument, ValueArgument from kamaki.cli.argument import FlagArgument, ValueArgument
from sys import stdin, stdout, stderr from sys import stdin, stdout, stderr
...@@ -99,6 +101,27 @@ class _command_init(object): ...@@ -99,6 +101,27 @@ class _command_init(object):
self._err.write(u'%s\n' % s) self._err.write(u'%s\n' % s)
self._err.flush() self._err.flush()
def print_list(self, *args, **kwargs):
kwargs.setdefault('out', self._out)
return print_list(*args, out=self._out, **kwargs)
def print_dict(self, *args, **kwargs):
kwargs.setdefault('out', self._out)
return print_dict(*args, out=self._out, **kwargs)
def print_json(self, *args, **kwargs):
kwargs.setdefault('out', self._out)
return print_json(*args, out=self._out, **kwargs)
def print_items(self, *args, **kwargs):
kwargs.setdefault('out', self._out)
return print_items(*args, out=self._out, **kwargs)
def ask_user(self, *args, **kwargs):
kwargs.setdefault('user_in', self._in)
kwargs.setdefault('out', self._out)
return print_items(*args, out=self._out, **kwargs)
@DontRaiseKeyError @DontRaiseKeyError
def _custom_url(self, service): def _custom_url(self, service):
return self.config.get_cloud(self.cloud, '%s_url' % service) return self.config.get_cloud(self.cloud, '%s_url' % service)
......
...@@ -35,7 +35,6 @@ from sys import stdout, stdin ...@@ -35,7 +35,6 @@ from sys import stdout, stdin
from re import compile as regex_compile from re import compile as regex_compile
from os import walk, path from os import walk, path
from json import dumps from json import dumps
from pydoc import pager
from kamaki.cli.errors import raiseCLIError from kamaki.cli.errors import raiseCLIError
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment