Bug 728049 - Add a way to set column width in yum
Summary: Add a way to set column width in yum
Alias: None
Product: Fedora
Classification: Fedora
Component: yum
Version: 15
Hardware: Unspecified
OS: Unspecified
Target Milestone: ---
Assignee: Seth Vidal
QA Contact: Fedora Extras Quality Assurance
Depends On:
TreeView+ depends on / blocked
Reported: 2011-08-04 02:17 UTC by G. Michael Carter
Modified: 2014-01-21 23:18 UTC (History)
6 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Last Closed: 2011-08-04 19:18:36 UTC
Type: ---

Attachments (Terms of Use)

Description G. Michael Carter 2011-08-04 02:17:06 UTC
Can we add:

import os

def _term_width():
    """ Simple terminal width, limit to 20 chars. and make 0 == 80. """
    if not hasattr(urlgrabber.progress, 'terminal_width_cached'):
        return 80
    ret = urlgrabber.progress.terminal_width_cached()
    if ret == 0:
        return 80
    if ret < 20:
        return 20
+    if os.environ.get("YUM_WIDTH") > 0:
+        return int(os.environ.get("YUM_WIDTH"))
    return ret

To the /usr/share/yum-cli/output.py file.

When I do yum list > /tmp/yum_mylist.list  the column width goes to 80.  I want to be able to set it.

I'm not a python programmer so the above was just a quick hack.

Comment 1 James Antill 2011-08-04 19:18:36 UTC
 You almost certainly want to use:

repoquery --installed -a --qf '%{ui_nevra} %{ui_from_repo}'

...instead of grepping yum output.

Note You need to log in before you can comment on or make changes to this bug.