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
69691087
Commit
69691087
authored
Jun 12, 2013
by
Stavros Sachtouris
Browse files
Do not suggest ansicolors if colors == off
Refs: #3978
parent
031ca67d
Changes
2
Hide whitespace changes
Inline
Side-by-side
kamaki/cli/__init__.py
View file @
69691087
...
...
@@ -482,7 +482,9 @@ def main():
auth_base
,
cloud
=
_init_session
(
parser
.
arguments
,
is_non_API
(
parser
))
from
kamaki.cli.utils
import
suggest_missing
suggest_missing
()
global
_colors
exclude
=
[
'ansicolors'
]
if
not
_colors
==
'on'
else
[]
suggest_missing
(
exclude
=
exclude
)
if
parser
.
unparsed
:
run_one_cmd
(
exe
,
parser
,
auth_base
,
cloud
)
...
...
kamaki/cli/utils.py
View file @
69691087
...
...
@@ -51,6 +51,8 @@ except ImportError:
def
dummy
(
val
):
return
val
red
=
yellow
=
magenta
=
bold
=
dummy
#from kamaki.cli import _colors
#if _colors.lower() == 'on':
suggest
[
'ansicolors'
][
'active'
]
=
True
try
:
...
...
@@ -59,10 +61,16 @@ except ImportError:
suggest
[
'progress'
][
'active'
]
=
True
def
suggest_missing
(
miss
=
None
):
def
suggest_missing
(
miss
=
None
,
exclude
=
[]
):
global
suggest
sgs
=
dict
(
suggest
)
for
exc
in
exclude
:
try
:
sgs
.
pop
(
exc
)
except
KeyError
:
pass
kamaki_docs
=
'http://www.synnefo.org/docs/kamaki/latest'
for
k
,
v
in
(
miss
,
s
uggest
[
miss
])
if
miss
else
s
uggest
.
items
():
for
k
,
v
in
(
miss
,
s
gs
[
miss
])
if
miss
else
s
gs
.
items
():
if
v
[
'active'
]
and
stdout
.
isatty
():
print
(
'Suggestion: for better user experience install %s'
%
k
)
print
(
'
\t
%s'
%
v
[
'description'
])
...
...
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