Skip to content

Commit

Permalink
Allow disabling colored output in cli
Browse files Browse the repository at this point in the history
  • Loading branch information
mxjp committed Dec 19, 2024
1 parent 155a44a commit 08679af
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -162,3 +162,6 @@ Show verbose information like the effective configuration options.

### `--no-externals`
If specified, external locales are not included in the output.

### `--no-color`
Disable colored command line output.
3 changes: 3 additions & 0 deletions src/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import { Project } from "./project.js";
"watch",
"verbose",
"externals",
"color",
],
string: ["config"],
alias: {
Expand All @@ -27,6 +28,7 @@ import { Project } from "./project.js";
const watch = Boolean(args.watch ?? development);
const verbose = Boolean(args.verbose ?? false);
const externals = Boolean(args.externals ?? true);
const color = Boolean(args.color ?? true);

const configFilename = resolve(args.config ?? "i18n-config.mjs");
if (verbose) {
Expand Down Expand Up @@ -54,6 +56,7 @@ import { Project } from "./project.js";

const config = createConfig(dirname(configFilename), options);
const project = new Project({ config, development });
project.diagnosticFormatter.color = color;
project.reportDiagnosticsToConsole();
await project.run({ watch, externals });
})().catch(error => {
Expand Down

0 comments on commit 08679af

Please sign in to comment.