hare

[hare] The Hare programming language
git clone https://git.torresjrjr.com/hare.git
Log | Files | Refs | README | LICENSE

commit e6a496014da5f4d5ad921983351b495b8bc43f92
parent 3dff5c250c5a8574a76b6b2c666162d9f2ff6e3e
Author: Autumn! <autumnull@posteo.net>
Date:   Thu, 16 Feb 2023 01:19:03 +0000

Add color to harec when appropriate

Signed-off-by: Autumn! <autumnull@posteo.net>

Diffstat:
Mcmd/hare/schedule.ha | 8++++++++
1 file changed, 8 insertions(+), 0 deletions(-)

diff --git a/cmd/hare/schedule.ha b/cmd/hare/schedule.ha @@ -17,6 +17,7 @@ use path; use shlex; use strings; use strio; +use unix::tty; fn getenv(var: str) []str = { let vals: []str = []; @@ -252,6 +253,13 @@ fn sched_hare_object( module = strings::dup(ns), }); + if (len(os::tryenv("NO_COLOR", "")) == 0 + && os::getenv("HAREC_COLOR") is void + && tty::isatty(os::stderr_file)) { + append(plan.environ, + (strings::dup("HAREC_COLOR"), strings::dup("1"))); + }; + for (let i = 0z; i < len(plan.context.tags); i += 1) { if (plan.context.tags[i].mode == module::tag_mode::INCLUSIVE && plan.context.tags[i].name == "test") {