Redirect some Nix commands output to a pager
Make nix search, nix flake show and nix flake metadata pipe their
output into a pager to make their result easier to visualise.
Fix #4548
So the reason I didn't enable paging yet is that it can interact badly with the progress indicator. Maybe what we should do is show the progress indicator until the first output is written, then disable the progress indicator and start the pager.
So the reason I didn't enable paging yet is that it can interact badly with the progress indicator. Maybe what we should do is show the progress indicator until the first output is written, then disable the progress indicator and start the pager.
I’ve actually disabled the progress indicator altogether when using the pager (here). But waiting for the first output might be nicer (I’ve no idea how to do that though :) ).
Ideally we would use logger->writeToStdout / logger->cout everywhere (instead of std::cout), and then the progress bar logger can disable itself and start the pager the first time writeToStdout is called.
@edolstra I’ve rewritten the proxy mechanism in 8ad1ed5fb66b9443997aac761c1baf6771b30160 to wrap a logger rather than being its own different thing. That way we can nicely intercept writeToStdout to start the pager as needed and tell the underlying pager not to dump arbitrary stuff on stdeer anymore
Does less -R support the progress bar?
Does less -R support the progress bar?
-R wouldn’t. -r might, but it’s a bit hacky (and explicitly not recommended), so I’d rather not rely on that
@edolstra friendly ping :)
This pull request has been mentioned on NixOS Discourse. There might be relevant details there:
https://discourse.nixos.org/t/2023-08-04-nix-team-meeting-minutes-77/31487/1
Marking it as draft since it has a bunch of conflicts. Anybody want to pick this up?