Skip to content

Commit 293b2e7

Browse files
Merge pull request #69 from dreamer-coding/main
2 parents 6ca5162 + e21b9b1 commit 293b2e7

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

code/logic/parser.c

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -423,6 +423,37 @@ void fossil_io_parser_parse(fossil_io_parser_palette_t *palette, int argc, char
423423
break;
424424
}
425425

426+
if (strcmp(arg, "--color") == 0) {
427+
FOSSIL_IO_COLOR_ENABLE = 1;
428+
global_flags_processed = 1;
429+
break;
430+
}
431+
else if (strcmp(arg, "--no-color") == 0) {
432+
FOSSIL_IO_COLOR_ENABLE = 0;
433+
global_flags_processed = 1;
434+
break;
435+
}
436+
else if (strcmp(arg, "--color=auto") == 0) {
437+
FOSSIL_IO_COLOR_ENABLE = -1; // let runtime decide
438+
global_flags_processed = 1;
439+
break;
440+
}
441+
else if (strncmp(arg, "--color=", 8) == 0) {
442+
const char *mode = arg + 8;
443+
if (strcmp(mode, "enable") == 0) {
444+
FOSSIL_IO_COLOR_ENABLE = 1;
445+
} else if (strcmp(mode, "disable") == 0) {
446+
FOSSIL_IO_COLOR_ENABLE = 0;
447+
} else if (strcmp(mode, "auto") == 0) {
448+
FOSSIL_IO_COLOR_ENABLE = -1;
449+
} else {
450+
fprintf(stderr, "Unknown --color option: %s\n", mode);
451+
exit(EXIT_FAILURE);
452+
}
453+
global_flags_processed = 1;
454+
break;
455+
}
456+
426457
if (strcmp(arg, "--version") == 0) {
427458
show_version();
428459
global_flags_processed = 1;

0 commit comments

Comments
 (0)