From d5df0424f545a8bcbc64d390a2e0e897cf09006f Mon Sep 17 00:00:00 2001 From: Emil Williams Date: Wed, 10 Sep 2025 21:13:55 +0000 Subject: [PATCH] Total -c Death; TOTAL NO_COLOR=1 SUPREMACY --- bake.1 | 3 ++- bake.l | 8 ++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/bake.1 b/bake.1 index 6a12aea..84f45e9 100755 --- a/bake.1 +++ b/bake.1 @@ -22,7 +22,6 @@ Options must always be put before the filename, and short options may be merged .HP \-h \-\-help, Help message \fB\-n \-\-dry\-run\fP, don't execute or remove anything - \fB\-c \-\-color\fP, disables color \fB\-l \-\-list\fP, lists available bake blocks \fB\-q \-\-quiet\fP, Mutes all stderr output from bake itself, does not effect execution output in any way \fB\-s \-\-select\fP \, selects Nth bake block @@ -63,6 +62,8 @@ Expunge removes exactly one file specified in the @{FILENAME} format, and the action is nonrecursive. Expunge simply outputs rm 'FILENAME...', where the FILENAME expands any instance of ' to \\'. +If NO_COLOR is defined in the environment colors will not be implemented. https://no-color.org/ + .PP Other Implementations (NONDEFAULT) diff --git a/bake.l b/bake.l index cff480a..c821c3f 100755 --- a/bake.l +++ b/bake.l @@ -164,7 +164,7 @@ int main (int ac, char ** av) { if (av[0][1] == '-') { if (av[0][2] == '\0') { ++av, --ac; goto start; } if (!strcmp(av[0]+2, "dry-run")) { i = strlen(av[0]); goto opt_dry_run; } - if (!strcmp(av[0]+2, "color")) { i = strlen(av[0]); goto opt_color; } + /* if (!strcmp(av[0]+2, "color")) { i = strlen(av[0]); goto opt_color; } */ if (!strcmp(av[0]+2, "expunge")) { i = strlen(av[0]); goto opt_expunge; } if (!strcmp(av[0]+2, "select" )) { if (!(ac-1) || !isdigit(av[1][0])) { goto opt_arg; } ++av, --ac; i = strlen(av[0]); goto opt_select; } @@ -189,7 +189,7 @@ int main (int ac, char ** av) { opt_list: case 'l': run = 0; g_select = -1; break; opt_help: case 'h': help(); return 0; opt_quiet: case 'q': stderr = fopen("/dev/null", "w"); if (!stderr) { stderr = stderr_quiet; perror(av0); return 1; } break; - opt_color: case 'c': g_color = 0; break; + /* opt_color: case 'c': g_color = 0; break; */ opt_expunge: case 'x': if (g_select > 0) { g_rm = 1; } break; opt_default: default: fprintf(stderr, "%s: Unknown option '%s'\n", av0, av[0]); return 1; opt_arg: fprintf(stderr, "%s: Argument missing for '%s'\n", av0, av[0]); return 1; @@ -198,6 +198,10 @@ int main (int ac, char ** av) { } start: + { + char *no_color = getenv("NO_COLOR"); + if (no_color != NULL && no_color[0] != '\0') { g_color = 0; } + } if (!ac) { fprintf(stderr, "%s: Missing filename\n", av0); return 1; } if (!g_select) { goto out_of_range; } -- 2.47.3