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

Add paging to --list-themes #3239

Merged

Conversation

einfachIrgendwer0815
Copy link
Contributor

This allows to use --list-themes with paging by passing all theme sample outputs to the pager as a whole.

Alternative to #3238
(Closes #3238)

Copy link
Collaborator

@keith-hall keith-hall left a comment

Choose a reason for hiding this comment

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

Thanks, looks good. Is it possible to write an integration test for this, I wonder? 🤔

@einfachIrgendwer0815
Copy link
Contributor Author

I do not think integration testing is possible here. A real pager cannot be used when testing because that would cause the test to hang and there would be no way to access the piped data. When using a "dummy" pager (e. g cat) that simply passes through what is piped into its stdin, both bat and that pager would share the same stdout, so stdout would receive the same content as before. There would be no difference observable for testing.

@einfachIrgendwer0815
Copy link
Contributor Author

einfachIrgendwer0815 commented Mar 26, 2025

(Sorry for closing and reopening, I intended to make this a draft but that does not seem possible on the mobile app)

Looking at this once more, I think it is kinda hacky to write to an intermediate buffer and to just tell the Controller not to call the pager itself. I would like to look for a better solution before merging if you do not mind.

@einfachIrgendwer0815 einfachIrgendwer0815 marked this pull request as draft March 26, 2025 13:07
@einfachIrgendwer0815 einfachIrgendwer0815 marked this pull request as ready for review March 28, 2025 14:08
@keith-hall keith-hall requested a review from Enselic April 2, 2025 19:20
@Enselic
Copy link
Collaborator

Enselic commented Apr 4, 2025

I wouldn't call myself an expert on this area of the code, but when I skim the code over I can't see anything that looks scary.

I haven't looked close enough to mark as Approved, but if both of you think this code is the right approach, I don't mind you merging it. If something breaks it can always be fixed afterwards.

@keith-hall keith-hall merged commit 57629bc into sharkdp:master Apr 5, 2025
24 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants