-
Notifications
You must be signed in to change notification settings - Fork 819
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
feat: add short table output #1292
Conversation
@craigbox I've added the ability to automatically detect the terminal width, and formatted the table as discussed. |
@craigbox I've made the required changes and now the table format is decided based on whether the large output tables are able to be displayed on the current terminal or not, if not then the smaller table is displayed ;) |
Can you please fix the conflicts, and we can get this merged soon I hope. |
@craigbox done! |
@XDRAGON2002 I see there are still conflicts. |
Signed-off-by: DRAGON <anantvijay3@gmail.com>
@XDRAGON2002 Here is the issue. I recommend you run before you push the following commands:
and
|
Signed-off-by: DRAGON2002 <81813720+XDRAGON2002@users.noreply.github.com> Signed-off-by: DRAGON <anantvijay3@gmail.com>
Sorry for that! I had actually used the GitHub web UI to fix merge conflicts which is where I messed up a variable! Thanks for that! I'll make sure to get in the habit of ensuring tests and builds before pushing. The only reason I forget to do that every now and then is because I keep forgetting we do not have a |
It works as expected, I will merge it as soon as the tests pass :) |
@dwertent this one is good to go now. |
Overview
As mentioned in the issue, the extremely wide tabular output doesn't fit in smaller terminals in a representable manner, hence a smaller more compact tabular format has been added which automatically infers based on the given terminal if the wider output needs to be rendered or the smaller.
Additional Information
In order to detect the terminal size a new dependency has been used, and automatically displays the smaller output tables if the terminal width is not able to support the original table output.
It does so by pivoting the table hence decreasing the width but instead increasing the height. A tradeoff made depending on the available width.
How to Test
On a smaller terminal screen with width less than 120, run any of:
kubescape list controls
kubescape scan resource.yaml
kubescape scan resource.yaml -v
Examples/Screenshots
Before:
After:
Related issues/PRs:
Resolved #933
Checklist before requesting a review