Skip to content

Commit bc6da3e

Browse files
the-horoibuclaw
authored andcommitted
Support -color
Signed-off-by: Andrei Horodniceanu <[email protected]>
1 parent 1f25be9 commit bc6da3e

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

dmd-script

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,8 @@ Usage:
112112
-boundscheck=value bounds checks on, in \@safe only, or off
113113
-betterC omit generating some runtime information and helper functions
114114
-c do not link
115+
-color turn colored console output on
116+
-color=[on|off|auto] control colored console output
115117
-cov do code coverage analysis
116118
-D generate documentation
117119
-Dddocdir write documentation file to docdir directory
@@ -346,6 +348,20 @@ while ( $arg_i < scalar(@ARGV) ) {
346348
push @out, "-fbounds-check=$1"
347349
} elsif ($arg =~ m/^-c$/ ) {
348350
$link = 0;
351+
} elsif ( $arg =~ m/^-color(=.*)?$/ ) {
352+
my $value = "";
353+
if ( ! $1 ) {
354+
# ignore
355+
} elsif ( $1 eq "=on" ) {
356+
$value = "=always";
357+
} elsif ( $1 eq "=off" ) {
358+
$value = "=never";
359+
} elsif ( $1 eq "=auto" ) {
360+
$value = "=auto";
361+
} else {
362+
errorExit "Unknown argument passed to -color '$1'";
363+
}
364+
push @out, "-fdiagnostics-color$value"
349365
} elsif ( $arg eq '-cov' ) {
350366
push @out, '-fprofile-arcs', '-ftest-coverage';
351367
} elsif ( $arg =~ m/^-D$/ ) {

dmd-script.1

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,10 @@ bounds checks on, in @safe only, or off
2525
omit generating some runtime information and helper functions
2626
.IP -c
2727
compile only, do not link
28+
.IP -color
29+
turn colored console output on
30+
.IP -color=[on|off|auto]
31+
Force colored console output on or off, or only when not redirected
2832
.IP -cov
2933
do code coverage analysis
3034
.IP -D

0 commit comments

Comments
 (0)