Mercurial > hg > octave-avbm
changeset 6698:6d366791e132
[project @ 2007-06-10 21:13:01 by dbateman]
author | dbateman |
---|---|
date | Sun, 10 Jun 2007 21:13:01 +0000 |
parents | 851c4afa8aa7 |
children | 3f4ccca05612 |
files | scripts/ChangeLog scripts/pkg/pkg.m |
diffstat | 2 files changed, 21 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/scripts/ChangeLog +++ b/scripts/ChangeLog @@ -1,3 +1,8 @@ +2007-06-10 David Bateman <dbateman@free.fr> + + * pkg/pkg.m (pkg:installed_packages): truncate start of package + directory if need to, so that it fits on a line. + 2007-06-07 David Bateman <dbateman@free.fr> * pkg/pkg.m (pkg): For rebuild target, force package order in
--- a/scripts/pkg/pkg.m +++ b/scripts/pkg/pkg.m @@ -1623,6 +1623,12 @@ length (installed_packages{i}.version)); names{i} = installed_packages{i}.name; endfor + max_dir_length = terminal_size()(2) - max_name_length - ... + max_version_length - 7; + if (max_dir_length < 20) + max_dir_length = Inf; + endif + h1 = postpad (h1, max_name_length + 1, " "); h2 = postpad (h2, max_version_length, " ");; @@ -1642,6 +1648,16 @@ cur_name = installed_packages{idx(i)}.name; cur_version = installed_packages{idx(i)}.version; cur_dir = installed_packages{idx(i)}.dir; + if (length (cur_dir) > max_dir_length) + first_char = length (cur_dir) - max_dir_length + 4; + first_filesep = strfind (cur_dir(first_char:end), filesep()); + if (! isempty (first_filesep)) + cur_dir = strcat ("...", + cur_dir((first_char + first_filesep(1) - 1):end)); + else + cur_dir = strcat ("...", cur_dir(first_char:end)); + endif + endif if (installed_packages{idx(i)}.loaded) cur_loaded = "*"; else