@ -2,6 +2,7 @@
Small code to handle colored text
"""
bold = '\033[1m'
end = '\033[0m'
@ -30,9 +31,9 @@ _dye = dye
def _nodye(s, **kwargs):
return s
def color_setup(config):
def setup(enable = True):
global dye
if config.getboolean(configs.MAIN_SECTION, 'color'):
if enable:
dye = _dye
else:
dye = _nodye
@ -4,7 +4,7 @@ import os
from ..repo import Repository
from .. import configs
from .. import color
def parser(subparsers, config):
parser = subparsers.add_parser('init',
@ -1,5 +1,5 @@
from .. import repo
import color
parser = subparsers.add_parser('remove', help='removes a paper')
@ -49,11 +49,11 @@ def get_plugins(cfg):
return cfg.get(MAIN_SECTION, 'plugins').split()
def get_boolean(value, default):
def get_boolean(value, default = False):
value = str(value).lower()
if value in ('yes', 'true', 't', 'y', '1'):
return True
elif value in ('no', 'false', 'f', 'n', '0'):
return False
return 0
return default
@ -12,7 +12,8 @@ class UI:
def __init__(self, config):
self.encoding = _encoding(config)
color.setup(config)
color_enable = configs.get_boolean(config.get('papers', 'color'))
color.setup(color_enable)
def print_(self, *strings):
"""Like print, but rather than raising an error when a character
@ -4,7 +4,7 @@ from setuptools import setup, find_packages
setup(name='papers',
version='1',
author='Fabien Benureau, Olivier Mangin',
author='Fabien Benureau, Olivier Mangin, Jonathan Grizou',
author_email='fabien.benureau+inria@gmail.com',
url='',
description='research papers manager',