Factor out shared --color-parsing code

This commit is contained in:
Rangi42
2025-08-12 15:53:57 -04:00
parent 7b405513d9
commit 1bf1219e07
6 changed files with 38 additions and 35 deletions

View File

@@ -392,14 +392,8 @@ int main(int argc, char *argv[]) {
options.is32kMode = true;
break;
case 0: // Long-only options
if (longOpt == 'c') {
if (!strcasecmp(musl_optarg, "always")) {
style_Enable(true);
} else if (!strcasecmp(musl_optarg, "never")) {
style_Enable(false);
} else if (strcasecmp(musl_optarg, "auto")) {
fatal("Invalid argument for option '--color'");
}
if (longOpt == 'c' && !style_Parse(musl_optarg)) {
fatal("Invalid argument for option '--color'");
}
break;
default: