mirror of
https://gitlab.com/dslackw/slpkg.git
synced 2024-11-17 07:48:18 +01:00
fix align with no colors
This commit is contained in:
parent
6aec383525
commit
3d60df923b
2 changed files with 17 additions and 15 deletions
|
@ -95,16 +95,16 @@ if os.path.isfile("/etc/slpkg/slpkg.conf"):
|
|||
if line.startswith("USE_COLORS"):
|
||||
use_colors = line[11:].strip()
|
||||
|
||||
if use_colors == "on":
|
||||
color = {
|
||||
'RED': '\x1b[31m',
|
||||
'GREEN': '\x1b[32m',
|
||||
'YELLOW': '\x1b[33m',
|
||||
'CYAN': '\x1b[36m',
|
||||
'GREY': '\x1b[38;5;247m',
|
||||
'ENDC': '\x1b[0m'
|
||||
}
|
||||
else:
|
||||
color = {
|
||||
'RED': '\x1b[31m',
|
||||
'GREEN': '\x1b[32m',
|
||||
'YELLOW': '\x1b[33m',
|
||||
'CYAN': '\x1b[36m',
|
||||
'GREY': '\x1b[38;5;247m',
|
||||
'ENDC': '\x1b[0m'
|
||||
}
|
||||
|
||||
if use_colors == "off":
|
||||
color = {
|
||||
'RED': '',
|
||||
'GREEN': '',
|
||||
|
|
|
@ -55,13 +55,15 @@ class RepoList(object):
|
|||
'Status'))
|
||||
template(78)
|
||||
for repo_id, repo_name in sorted(self.all_repos.iteritems()):
|
||||
status = '{0}disabled{1}'.format(color['RED'], color['ENDC'])
|
||||
status = 'disabled'
|
||||
COLOR = color['RED']
|
||||
if repo_id in repositories:
|
||||
status = '{0}enabled{1}'.format(color['GREEN'], color['ENDC'])
|
||||
print(' {0}{1}{2}{3}{4:>17}'.format(
|
||||
status = 'enabled'
|
||||
COLOR = color['GREEN']
|
||||
print(' {0}{1}{2}{3}{4}{5:>15}{6}'.format(
|
||||
repo_id, ' ' * (17 - len(repo_id)),
|
||||
repo_name, ' ' * (52 - len(repo_name)),
|
||||
status))
|
||||
repo_name, ' ' * (45 - len(repo_name)),
|
||||
COLOR, status, color['ENDC']))
|
||||
print("\nFor enable or disable repositories edit "
|
||||
"'/etc/slpkg/slpkg.conf' file\n")
|
||||
sys.exit(0)
|
||||
|
|
Loading…
Reference in a new issue