mirror of
https://github.com/DoneJS-Runtime/quickjs-done-nextgen.git
synced 2025-01-09 17:43:15 +00:00
Support the NO_COLOR env variable in the REPL
This commit is contained in:
parent
348d60985d
commit
d0df61d04a
2 changed files with 11 additions and 2 deletions
BIN
gen/repl.c
BIN
gen/repl.c
Binary file not shown.
13
repl.js
13
repl.js
|
@ -1577,7 +1577,9 @@ import * as bjson from "bjson";
|
|||
}
|
||||
|
||||
function print_eval_error(error) {
|
||||
std.puts(colors[styles.error]);
|
||||
if (show_colors) {
|
||||
std.puts(colors[styles.error]);
|
||||
}
|
||||
if (error instanceof Error) {
|
||||
std.puts(error);
|
||||
std.puts('\n');
|
||||
|
@ -1589,7 +1591,10 @@ import * as bjson from "bjson";
|
|||
std.puts(error);
|
||||
std.puts('\n');
|
||||
}
|
||||
std.puts(colors.none);
|
||||
|
||||
if (show_colors) {
|
||||
std.puts(colors.none);
|
||||
}
|
||||
|
||||
handle_cmd_end();
|
||||
}
|
||||
|
@ -1873,6 +1878,10 @@ import * as bjson from "bjson";
|
|||
styles = themes.light;
|
||||
}
|
||||
}
|
||||
s = std.getenv("NO_COLOR"); // https://no-color.org/
|
||||
if (s && +s[0] !== 0) {
|
||||
show_colors = false;
|
||||
}
|
||||
}
|
||||
|
||||
load_config();
|
||||
|
|
Loading…
Reference in a new issue