]> git.xolatile.top Git - emil-bake.git/commitdiff
Total -c Death; TOTAL NO_COLOR=1 SUPREMACY
authorEmil Williams <emilemilemil@cock.li>
Wed, 10 Sep 2025 21:13:55 +0000 (21:13 +0000)
committerEmil Williams <emilemilemil@cock.li>
Wed, 10 Sep 2025 21:13:55 +0000 (21:13 +0000)
bake.1
bake.l

diff --git a/bake.1 b/bake.1
index 6a12aea1d45b24895cc53bba09644980f34302d9..84f45e975bd9c39da41260c363e24efcfbdaa519 100755 (executable)
--- 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 \<n\>, 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 cff480a927bfab9e47ce10158b8e7bd10ab1f7e8..c821c3fad91a38d68c340c2456dff90153a8cafe 100755 (executable)
--- 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; }