[Aptitude-devel] Bug#775671: aptitude: ignore terminal width if output is not to a terminal
Manuel A. Fernandez Montecelo
manuel.montezelo at gmail.com
Fri Nov 13 22:23:36 UTC 2015
forcemerge 445206 775671
severity 445206 normal
tags 445206 + confirmed
stop
Hi all,
2007-10-04 01:51 Sam Morris:
>Package: aptitude
>Version: 0.4.6.1-1
>Severity: wishlist
>
>-----BEGIN PGP SIGNED MESSAGE-----
>Hash: SHA1
>
>If I run 'aptitude show libxul0d | grep spell' I get the following
>output:
>
> libhunspell-1.1-0 (>= 1.1.6-1), libjpeg62, libmozjs0d (>= 1.8.1.5),
>
>it would be nice if instead I got:
>
>Depends: libatk1.0-0 (>= 1.13.2), libc6 (>= 2.6-1), libcairo2 (>= 1.4.0), libfontconfig1 (>= 2.4.0), libfreetype6 (>= 2.3.5), libgcc1 (>= 1:4.2-20070516), libglib2.0-0 (>= 2.12.9), libgtk2.0-0 (>= 2.10.12-3), libhunspell-1.1-0 (>= 1.1.6-1), libjpeg62, libmozjs0d (>= 1.8.1.5), libnspr4-0d (>= 1.8.0.10), libnss3-0d (>= 3.11.7), libpango1.0-0 (>= 1.16.5), libpng12-0 (>= 1.2.13-4), libstdc++6 (>= 4.2-20070516), libx11-6, libxft2 (>> 2.1.1), libxinerama1, libxrender1, libxt6, zlib1g (>= 1:1.2.3.3.dfsg-1), libxul-common (>= 1.8.1.6)
2008-09-01 01:01 jidanni at jidanni.org:
>Or better yet, do document/implement the use of $COLUMNS, like dpkg -l uses.
The reason for this behaviour is that for the command line, aptitude
reuses code for the curses interface and from the cwidget library,
"column_generator::layout_columns()" and "columnify()".
The way in which it works means that for commands search, show,
versions, etc., it attemps to create columns for the different fields to
be shown, which try to use all the width of the screen.
This is the reason why e.g. with "show" the Depends or Description get
nicely formatted and try to use all of the screen available and with
indentation, instead of dumping the information from apt/dpkg with a
fixed width.
When using a terminal, this works more or less fine (maybe sometimes the
fields are also truncated, e.g. with search). But when using a pipe or
a redirection to a file, it is setting a default width of 80. If we
change to use a very large (~= "unlimited", e.g. 10K) width, the fields
would try to spread over all the available width, and some of them would
be justified to the right as well, so the result when piping/redirecting
would not be any good either -- all lines/rows would try to use all the
available 10K.
"aptitude show aptitude | cat" with "unlimited" width works more or less
fine because it uses only the minimum width or justifies to the right,
but "search" and "versions" don't work well.
So, in short, I agree that it doesn't make much sense when
redirecting/piping, and it's a problem, but it's the way in which all of
aptitude command line works and it will take a very significant effort
to change.
Cheers.
--
Manuel A. Fernandez Montecelo <manuel.montezelo at gmail.com>
More information about the Aptitude-devel
mailing list