Commit 37ce8a25 authored by Stavros Sachtouris's avatar Stavros Sachtouris
Browse files

Do not suggest ansicolors if colors == off

Refs: #3978
parent 2063ef10
......@@ -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)
......
......@@ -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, suggest[miss]) if miss else suggest.items():
for k, v in (miss, sgs[miss]) if miss else sgs.items():
if v['active'] and stdout.isatty():
print('Suggestion: for better user experience install %s' % k)
print('\t%s' % v['description'])
......
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