Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

running wily with more than 5 metrics cause problem with printing #81

Closed
chakib-belgaid opened this issue Sep 8, 2019 · 2 comments · Fixed by #201
Closed

running wily with more than 5 metrics cause problem with printing #81

chakib-belgaid opened this issue Sep 8, 2019 · 2 comments · Fixed by #201
Labels
bug Something isn't working

Comments

@chakib-belgaid
Copy link

when running willy with multiple metrics it causes them to overlap

@tonybaloney tonybaloney added the bug Something isn't working label Sep 13, 2019
@tonybaloney
Copy link
Owner

thanks for reporting. I've seen this on smaller terminal sizes as well. The tabulate module is the one that renders the tables. So hopefully it offers a solution

@devdanzin
Copy link
Collaborator

Tabulate does offer a solution, in the maxcolwidths and maxheadercolwidths parameters to tabulate.tabulate(). We can then figure out the terminals width with shutil.get_terminal_size(), divide the width by the number of columns and pass that to report's call of tabulate. Except...

Except there's a variable amount of padding being added to the cells, so I can either get perfect sizing for narrow terminals or use all available width in wide terminals. Not both.

Still, it's an improvement to readability when too many metrics or too small a terminal size are chosen.

Wide:

╒════════════╤══════════════╤════════════╤══════════════════╤═══════════════════╤═══════════════════╤══════════════════╕
│ Revision   │ Author       │ Date       │ Cyclomatic       │ Unique Operands   │ Maintainability   │ Lines of Code    │
│            │              │            │ Complexity       │                   │ Index             │                  │
╞════════════╪══════════════╪════════════╪══════════════════╪═══════════════════╪═══════════════════╪══════════════════╡
│ f1e8225    │ Anthony Shaw │ 2023-03-12 │ Not found '.\\sr │ Not found '.\\sr  │ Not found '.\\sr  │ Not found '.\\sr │
│            │              │            │ c\\wily\\command │ c\\wily\\command  │ c\\wily\\command  │ c\\wily\\command │
│            │              │            │ s\\report.py'    │ s\\report.py'     │ s\\report.py'     │ s\\report.py'    │
╘════════════╧══════════════╧════════════╧══════════════════╧═══════════════════╧═══════════════════╧══════════════════╛

Narrower:

╒════════╤════════╤════════╤════════╤════════╤════════╤════════╕
│ Revi   │ Auth   │ Date   │ Cycl   │ Uniq   │ Main   │ Line   │
│ sion   │ or     │        │ omat   │ ue O   │ tain   │ s of   │
│        │        │        │ ic C   │ pera   │ abil   │ Code   │
│        │        │        │ ompl   │ nds    │ ity    │        │
│        │        │        │ exit   │        │ Inde   │        │
│        │        │        │ y      │        │ x      │        │
╞════════╪════════╪════════╪════════╪════════╪════════╪════════╡
│ f1e8   │ Anth   │ 2023   │ Not    │ Not    │ Not    │ Not    │
│ 225    │ ony    │ -03-   │ foun   │ foun   │ foun   │ foun   │
│        │ Shaw   │ 12     │ d '.   │ d '.   │ d '.   │ d '.   │
│        │        │        │ \\sr   │ \\sr   │ \\sr   │ \\sr   │
│        │        │        │ c\\w   │ c\\w   │ c\\w   │ c\\w   │
│        │        │        │ ily\   │ ily\   │ ily\   │ ily\   │
│        │        │        │ \com   │ \com   │ \com   │ \com   │
│        │        │        │ mand   │ mand   │ mand   │ mand   │
│        │        │        │ s\\r   │ s\\r   │ s\\r   │ s\\r   │
│        │        │        │ epor   │ epor   │ epor   │ epor   │
│        │        │        │ t.py   │ t.py   │ t.py   │ t.py   │
│        │        │        │ '      │ '      │ '      │ '      │
╘════════╧════════╧════════╧════════╧════════╧════════╧════════╛

Narrowest:

╒═════╤═════╤═════╤═════╤═════╤═════╤═════╕
│ R   │ A   │ D   │ C   │ U   │ M   │ L   │
│ e   │ u   │ a   │ y   │ n   │ a   │ i   │
│ v   │ t   │ t   │ c   │ i   │ i   │ n   │
│ i   │ h   │ e   │ l   │ q   │ n   │ e   │
│ s   │ o   │     │ o   │ u   │ t   │ s   │
│ i   │ r   │     │ m   │ e   │ a   │ o   │
│ o   │     │     │ a   │ O   │ i   │ f   │
│ n   │     │     │ t   │ p   │ n   │ C   │
│     │     │     │ i   │ e   │ a   │ o   │
│     │     │     │ c   │ r   │ b   │ d   │
│     │     │     │ C   │ a   │ i   │ e   │
│     │     │     │ o   │ n   │ l   │     │
│     │     │     │ m   │ d   │ i   │     │
│     │     │     │ p   │ s   │ t   │     │
│     │     │     │ l   │     │ y   │     │
│     │     │     │ e   │     │ I   │     │
│     │     │     │ x   │     │ n   │     │
│     │     │     │ i   │     │ d   │     │
│     │     │     │ t   │     │ e   │     │
│     │     │     │ y   │     │ x   │     │
╞═════╪═════╪═════╪═════╪═════╪═════╪═════╡
│ f   │ A   │ 2   │ N   │ N   │ N   │ N   │
│ 1   │ n   │ 0   │ o   │ o   │ o   │ o   │
│ e   │ t   │ 2   │ t   │ t   │ t   │ t   │
│ 8   │ h   │ 3   │ f   │ f   │ f   │ f   │
│ 2   │ o   │ -   │ o   │ o   │ o   │ o   │
│ 2   │ n   │ 0   │ u   │ u   │ u   │ u   │
│ 5   │ y   │ 3   │ n   │ n   │ n   │ n   │
│     │ S   │ -   │ d   │ d   │ d   │ d   │
│     │ h   │ 1   │ '   │ '   │ '   │ '   │
│     │ a   │ 2   │ .   │ .   │ .   │ .   │
│     │ w   │     │ \   │ \   │ \   │ \   │
│     │     │     │ \   │ \   │ \   │ \   │
│     │     │     │ s   │ s   │ s   │ s   │
│     │     │     │ r   │ r   │ r   │ r   │
│     │     │     │ c   │ c   │ c   │ c   │
│     │     │     │ \   │ \   │ \   │ \   │
│     │     │     │ \   │ \   │ \   │ \   │
│     │     │     │ w   │ w   │ w   │ w   │
│     │     │     │ i   │ i   │ i   │ i   │
│     │     │     │ l   │ l   │ l   │ l   │
│     │     │     │ y   │ y   │ y   │ y   │
│     │     │     │ \   │ \   │ \   │ \   │
│     │     │     │ \   │ \   │ \   │ \   │
│     │     │     │ c   │ c   │ c   │ c   │
│     │     │     │ o   │ o   │ o   │ o   │
│     │     │     │ m   │ m   │ m   │ m   │
│     │     │     │ m   │ m   │ m   │ m   │
│     │     │     │ a   │ a   │ a   │ a   │
│     │     │     │ n   │ n   │ n   │ n   │
│     │     │     │ d   │ d   │ d   │ d   │
│     │     │     │ s   │ s   │ s   │ s   │
│     │     │     │ \   │ \   │ \   │ \   │
│     │     │     │ \   │ \   │ \   │ \   │
│     │     │     │ r   │ r   │ r   │ r   │
│     │     │     │ e   │ e   │ e   │ e   │
│     │     │     │ p   │ p   │ p   │ p   │
│     │     │     │ o   │ o   │ o   │ o   │
│     │     │     │ r   │ r   │ r   │ r   │
│     │     │     │ t   │ t   │ t   │ t   │
│     │     │     │ .   │ .   │ .   │ .   │
│     │     │     │ p   │ p   │ p   │ p   │
│     │     │     │ y   │ y   │ y   │ y   │
│     │     │     │ '   │ '   │ '   │ '   │
╘═════╧═════╧═════╧═════╧═════╧═════╧═════╛

I'll keep trying to figure out a way to get both benefits at once, then send a PR.

tonybaloney added a commit that referenced this issue Jul 29, 2023
Allow output from commands to be wrapped to terminal width (fix #81)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
3 participants