Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
itminedu
kamaki
Commits
ddcb2e09
Commit
ddcb2e09
authored
Sep 12, 2013
by
Stavros Sachtouris
Browse files
Implement member versions of utils print methods
Refs: #4292
parent
c49188b7
Changes
2
Hide whitespace changes
Inline
Side-by-side
kamaki/cli/commands/__init__.py
View file @
ddcb2e09
...
@@ -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
)
...
...
kamaki/cli/utils/__init__.py
View file @
ddcb2e09
...
@@ -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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment