New submission from Ben Franksen <[email protected]>: 1 patch for repository https://darcs.net/screened:
patch f5c898ae646ad951f046aa6d71cb5d4324192ba7 Author: Ben Franksen <[email protected]> Date: Sun Jul 14 20:00:50 CEST 2024 * use colored output when piping it through a pager I previously had to set DARCS_ALWAYS_COLOR=1 to get colored output when a pager is invoked, which has become the rule rather than the exception. But that makes darcs output color codes even when the user redirects the output to a file, which is not something anybody wants to happen. The trick is to pass the printers the stdout /before/ we invoke the pager (and ignore the handle it gets passed later when stdout is the write end of the pipe). ---------- files: patch-preview.txt, use-colored-output-when-piping-it-through-a-pager.dpatch messages: 24144 nosy: bfrk status: needs-screening title: use colored output when piping it through a pager __________________________________ Darcs bug tracker <[email protected]> <https://bugs.darcs.net/patch2440> __________________________________
[use colored output when piping it through a pager Ben Franksen <[email protected]>**20240714180050 Ignore-this: 852bf6abf2c24076675d1a77b0893f01bf72f9e91e45686a31a7391433d3d3d37f316fd570c87611 I previously had to set DARCS_ALWAYS_COLOR=1 to get colored output when a pager is invoked, which has become the rule rather than the exception. But that makes darcs output color codes even when the user redirects the output to a file, which is not something anybody wants to happen. The trick is to pass the printers the stdout /before/ we invoke the pager (and ignore the handle it gets passed later when stdout is the write end of the pipe). ] hunk ./src/Darcs/UI/External.hs 418 - hunk ./src/Darcs/UI/External.hs 421 - -pipeDocToPager c args pr inp = pipeDocInternal (PipeToOther pr) c args inp +pipeDocToPager c args pr inp = + -- Evaluate pr with the current stdout, not the pipe's write end, + -- so we get colored output with less. Note that we pass it -R so + -- that it doesn't escape color codes. + pipeDocInternal (PipeToOther (const (pr stdout))) c args inp
use-colored-output-when-piping-it-through-a-pager.dpatch
Description: application/darcs-patch
_______________________________________________ darcs-devel mailing list [email protected] https://lists.darcs.net/mailman/listinfo/darcs-devel
