sonatype-nexus-community / cargo-pants

Apache License 2.0
28 stars 9 forks source link

#15 Display vulnerabilities in tabular format and add color #25

Closed mobiuscog closed 3 years ago

mobiuscog commented 3 years ago

Added tabular display of vulnerabilities and used suggested format where possible to be consistent.

This pull request makes the following changes: Adds tables to view Adds coloring based on vulnerability level, consistent with Nancy. Adds --no-color (-m) option

It relates to the following issue #s:

bhamail commented 3 years ago

Had you thought about using a "cli table" formatting library, instead of rolling our own? I haven't used any, but here's a few I found (in no particular order): https://crates.io/crates/term-table https://docs.rs/cli-table/0.4.5/cli_table/ https://crates.io/crates/prettytable-rs

I'm not strongly against writing our own table format logic, but it seems like it is always "more trouble" in the long run than using a library.

mobiuscog commented 3 years ago

I had tried a few, and they either failed on supporting differing cell counts, or didn't handle the ansi_term formatting correctly. After spending a few hours trying to make them work (I tried prettytable-rs and comfy-table in the main), I decided the specific need was likely straightforward to approach, and so took that approach. If there is a suitable library that can re-create the look/feel given in the issue, I would gladly look again.

bhamail commented 3 years ago

Sorry for the slow response. Thanks for the PR! Please holler if any issues arise.