aboutsummaryrefslogtreecommitdiff
path: root/src/libutil/terminal.hh
diff options
context:
space:
mode:
authorjade <lix@jade.fyi>2024-08-07 00:50:30 +0000
committerGerrit Code Review <gerrit@localhost>2024-08-07 00:50:30 +0000
commit529eed74c477eee8567f28379210cd47f0b4e18f (patch)
tree4c82036a43a1c1f627cacf2316f708afb6835389 /src/libutil/terminal.hh
parent2c48460850186e5fb8152e7882baf9e29bb5e884 (diff)
parentca9d3e6e00ec452701d9d3b7e909eff61799f739 (diff)
Merge changes I0fc80718,Ia182b86f,I355f82cb,I8a9b58fa,Id89f8a1f, ... into main
* changes: tree-wide: fix various lint warnings flake & doxygen: update tagline nix flake metadata: print modified dates for input flakes cli: eat terminal codes from stdout also Implement forcing CLI colour on, and document it better manual: fix a syntax error in redirects.js that made it not do anything misc docs/meson tidying build: implement clang-tidy using our plugin
Diffstat (limited to 'src/libutil/terminal.hh')
-rw-r--r--src/libutil/terminal.hh12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/libutil/terminal.hh b/src/libutil/terminal.hh
index 43df5bd70..2c422ecff 100644
--- a/src/libutil/terminal.hh
+++ b/src/libutil/terminal.hh
@@ -9,6 +9,15 @@ namespace nix {
/**
* Determine whether ANSI escape sequences are appropriate for the
* present output.
+ *
+ * This follows the rules described on https://bixense.com/clicolors/
+ * with CLICOLOR defaulted to enabled (and thus ignored).
+ *
+ * That is to say, the following procedure is followed in order:
+ * - NO_COLOR or NOCOLOR set -> always disable colour
+ * - CLICOLOR_FORCE or FORCE_COLOR set -> enable colour
+ * - The output is a tty; TERM != "dumb" -> enable colour
+ * - Otherwise -> disable colour
*/
bool shouldANSI();
@@ -21,7 +30,8 @@ bool shouldANSI();
*/
std::string filterANSIEscapes(std::string_view s,
bool filterAll = false,
- unsigned int width = std::numeric_limits<unsigned int>::max());
+ unsigned int width = std::numeric_limits<unsigned int>::max(),
+ bool eatTabs = true);
/**
* Recalculate the window size, updating a global variable. Used in the