[yum-git] 2 commits - output.py yumcommands.py
James Antill
james at linux.duke.edu
Tue Apr 1 22:07:02 UTC 2008
output.py | 1 +
yumcommands.py | 44 +++++++++++++++++++++++++++++++++++---------
2 files changed, 36 insertions(+), 9 deletions(-)
New commits:
commit 871d933a0ca88cc0be6c7804514fbbeea9c58c45
Author: James Antill <james at and.org>
Date: Tue Apr 1 18:05:21 2008 -0400
Fix repolist disabled.
Add colour to: repolist all
Add verbose option, for long id's/names
diff --git a/yumcommands.py b/yumcommands.py
index e260526..185ac35 100644
--- a/yumcommands.py
+++ b/yumcommands.py
@@ -643,18 +643,44 @@ class RepoListCommand(YumCommand):
arg = 'enabled'
format_string = "%-20.20s %-40.40s %s"
- if base.repos.repos.values():
- base.verbose_logger.log(logginglevels.INFO_2, format_string,
- _('repo id'), _('repo name'), _('status'))
repos = base.repos.repos.values()
repos.sort()
+ enabled_repos = base.repos.listEnabled()
+ done = False
+ verbose = base.verbose_logger.isEnabledFor(logginglevels.DEBUG_3)
+ if arg == 'all':
+ ehibeg = base.term.FG_COLOR['green'] + base.term.MODE['bold']
+ dhibeg = base.term.FG_COLOR['red']
+ hiend = base.term.MODE['normal']
+ else:
+ ehibeg = ''
+ dhibeg = ''
+ hiend = ''
for repo in repos:
- if repo in base.repos.listEnabled() and arg in ('all', 'enabled'):
- base.verbose_logger.log(logginglevels.INFO_2, format_string,
- repo, repo.name, _('enabled'))
- elif arg in ('all', 'disabled'):
- base.verbose_logger.log(logginglevels.INFO_2, format_string,
- repo, repo.name, _('disabled'))
+ if repo in enabled_repos:
+ enabled = True
+ ui_enabled = ehibeg + _('enabled') + hiend
+ else:
+ enabled = False
+ ui_enabled = dhibeg + _('disabled') + hiend
+
+ if (arg == 'all' or
+ (arg == 'enabled' and enabled) or
+ (arg == 'disabled' and not enabled)):
+ if not done and not verbose:
+ base.verbose_logger.log(logginglevels.INFO_2,
+ format_string, _('repo id'),
+ _('repo name'), _('status'))
+ done = True
+ if verbose:
+ line1 = base.fmtKeyValFill(_("Repo-id : "), repo)
+ line2 = base.fmtKeyValFill(_("Repo-name : "), repo.name)
+ line3 = base.fmtKeyValFill(_("Repo-enabled: "), ui_enabled)
+ base.verbose_logger.log(logginglevels.DEBUG_3,
+ "%s\n%s\n%s\n", line1, line2, line3)
+ else:
+ base.verbose_logger.log(logginglevels.INFO_2, format_string,
+ repo, repo.name, ui_enabled)
return 0, []
commit 6b45e309e796fc33752a0c8811f1661f89eea934
Author: James Antill <james at and.org>
Date: Tue Apr 1 18:05:03 2008 -0400
Make sure val is a string, so textwrap isn't confused
diff --git a/output.py b/output.py
index 1f0d59e..532a06e 100644
--- a/output.py
+++ b/output.py
@@ -253,6 +253,7 @@ class YumOutput:
def fmtKeyValFill(self, key, val):
""" Return a key value pair in the common two column output format. """
+ val = str(val)
keylen = len(key)
cols = self.term.columns
nxt = ' ' * (keylen - 2) + ': '
More information about the Yum-cvs-commits
mailing list