summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrian Dolbec <brian.dolbec@gmail.com>2011-02-18 20:06:51 -0800
committerBrian Dolbec <brian.dolbec@gmail.com>2011-02-18 20:06:51 -0800
commitf2dd98035ee2c90bb01174d6f816a4866b1c0f7d (patch)
tree9fc158dac9787a93e02591328b37f17d773a6643
parent3eaca0340384122c5d83e0aa2d0a8b6dc1165487 (diff)
downloadlayman-f2dd98035ee2c90bb01174d6f816a4866b1c0f7d.tar.gz
layman-f2dd98035ee2c90bb01174d6f816a4866b1c0f7d.tar.bz2
layman-f2dd98035ee2c90bb01174d6f816a4866b1c0f7d.zip
add nocolr to BareConfig and improve quiet/quietness handling
-rw-r--r--layman/config.py11
1 files changed, 10 insertions, 1 deletions
diff --git a/layman/config.py b/layman/config.py
index a2b9377..6c3677c 100644
--- a/layman/config.py
+++ b/layman/config.py
@@ -119,7 +119,8 @@ class BareConfig(object):
'stdin': stdin if stdin else sys.stdin,
'stderr': stderr if stderr else sys.stderr,
'output': output if output else OUT,
- 'quietness': '4',
+ 'quietness': 4,
+ 'nocolor': False,
'width': 0,
'verbose': False,
'quiet': False,
@@ -157,7 +158,15 @@ class BareConfig(object):
"""Sets an option to the value """
self._options[option] = value
# handle quietness
+ if option == 'quiet':
+ if self._option['quiet']:
+ self._set_quietness(1)
+ else:
+ self._set_quietness(4)
if option == 'quietness':
+ self._set_quietness()
+
+ def _set_quietness(self, value)
self._option['output'].set_info_level(int(self['quietness']))
self._option['output'].set_warn_level(int(self['quietness']))