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

feat: Use pager for showing logs #414

Merged
merged 1 commit into from
Jan 6, 2022
Merged

feat: Use pager for showing logs #414

merged 1 commit into from
Jan 6, 2022

Conversation

msvticket
Copy link
Contributor

When showing long logs the terminal buffer might not be enough and using a pager would be practical. But to pipe a log to pager you need to add enough filters to get only the required log and this can be cumbersome. With this fix a pager is used if in a terminal, not in batch mode and if a pager is available.

The reason I don't implement the same feature for grid is that executing a sub command is interfering with bubbletea (See charmbracelet/bubbletea#171)

@jenkins-x-bot
Copy link
Contributor

Hi @msvticket. Thanks for your PR.

I'm waiting for a jenkins-x-plugins or todo member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the jenkins-x/lighthouse repository.

@sonarqubecloud
Copy link

sonarqubecloud bot commented Jan 4, 2022

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 1 Code Smell

No Coverage information No Coverage information
0.0% 0.0% Duplication

@msvticket
Copy link
Contributor Author

/assign @ankitm123

@ankitm123
Copy link
Contributor

/ok-to-test

@@ -6,6 +6,7 @@ require (
github.com/charmbracelet/bubbletea v0.13.1
github.com/cpuguy83/go-md2man v1.0.10
github.com/fatih/color v1.10.0
github.com/gerow/pager v0.0.0-20190420205801-6d4a2327822f
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there an alternative to this package? It seems the last modification was done in April 2019, is it maintained?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The only alternative I've found was updated even longer ago: github.com/sean-/pager
Well, there is a fork of that with a couple of later commits that might be an alternative: github.com/peloy/pager
But the drawback is that for that library a separate check is needed to know if a terminal is attached.

No, I don't get the impression it is maintained.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will take a look at the source code of the pager package tonight (after work), and then get back to this PR. I think we can merge this tonight with gerow/pager, but may be long term we can add similar functionality to jx-helper (since u mentioned there are no go pager packages which are maintained) to ensure this part is maintained. wdyt?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure. Also the functionality is isolated and while convenient it's not crucial. So in the worst case it can simply be removed.

@ankitm123
Copy link
Contributor

/lgtm

@jenkins-x-bot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: ankitm123

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@jenkins-x-bot jenkins-x-bot merged commit 2a85a7f into jenkins-x-plugins:main Jan 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants