* pisi/cli/listavailable.py (print_packages): Resize the first column

dynamically according to the longest package name (#9021) and fix some
other displaying issues concerning 'listavailable' command.

* pisi/cli/listinstalled.py (run): Resize the first column dynamically
according to the longest package name.

BUG:FIXED:9021
This commit is contained in:
Ozan Çağlayan
2009-01-14 13:23:42 +00:00
parent cdd84da6e5
commit e7576a76de
3 changed files with 26 additions and 3 deletions
+7
View File
@@ -1,3 +1,10 @@
2009-01-14 Ozan Çağlayan <ozan@pardus.org.tr>
* pisi/cli/listavailable.py (print_packages): Resize the first column
dynamically according to the longest package name (#9021) and fix some
other displaying issues concerning 'listavailable' command.
* pisi/cli/listinstalled.py (run): Resize the first column
dynamically according to the longest package name.
2009-01-09 Gökçen Eraslan <gokcen@pardus.org.tr>
* pisi/actionsapi/cmaketools.py: If both -v and -d parameters are
given, pass VERBOSE=1 parameter to make command. This results printing
+12 -2
View File
@@ -78,16 +78,26 @@ all repositories.
else:
l = pisi.api.list_available(repo)
installed_list = pisi.api.list_installed()
# maxlen is defined dynamically from the longest package name (#9021)
if l:
maxlen = max([len(_p) for _p in l])
l.sort()
for p in l:
package = self.packagedb.get_package(p, repo)
if self.options.long:
ctx.ui.info(unicode(package))
if p in installed_list:
package.name = util.colorize(package.name, 'green')
else:
package.name = util.colorize(package.name, 'brightwhite')
ctx.ui.info(unicode(package)+'\n')
else:
lenp = len(p)
if p in installed_list:
if ctx.config.get_option('uninstalled'):
continue
p = util.colorize(p, 'green')
p = p + ' ' * max(0, 15 - lenp)
p = util.colorize(p, 'brightwhite')
p = p + ' ' * max(0, maxlen - lenp)
ctx.ui.info('%s - %s ' % (p, unicode(package.summary)))
+7 -1
View File
@@ -67,6 +67,11 @@ Usage: list-installed
installed = list(set(installed) & set(component_pkgs))
installed.sort()
# Resize the first column according to the longest package name
if installed:
maxlen = max([len(_p) for _p in installed])
if self.options.install_info:
ctx.ui.info(_('Package Name |St| Version| Rel.| Build| Distro| Date'))
print '========================================================================'
@@ -79,4 +84,5 @@ Usage: list-installed
elif self.options.install_info:
ctx.ui.info('%-15s |%s' % (package.name, inst_info.one_liner()))
else:
ctx.ui.info('%15s - %s' % (package.name, unicode(package.summary)))
package.name = package.name + ' ' * (maxlen - len(package.name))
ctx.ui.info('%s - %s' % (package.name, unicode(package.summary)))