feat: add color option to CLI and configuration file

The option is used to force enable/disable color output and is passed to the reporter which should respect it
This commit is contained in:
Joakim Carlstein 2023-12-20 09:06:13 +01:00 committed by Joakim Carlstein
parent 7bae76f496
commit f9a16d87a1
14 changed files with 112 additions and 11 deletions

View file

@ -91,3 +91,7 @@ The name can be either a path to a module or a package name. For package names E
And then try to load the module/package with the given name.
For example, if you want to use the `emigrate-reporter-somereporter` package, you can specify either `emigrate-reporter-somereporter` or just `somereporter` as the name.
### `--color`, `--no-color`
Force enable/disable colored output, option is passed to the reporter which should respect it.

View file

@ -108,3 +108,7 @@ The name can be either a path to a module or a package name. For package names E
And then try to load the module/package with the given name.
For example, if you want to use the `emigrate-reporter-somereporter` package, you can specify either `emigrate-reporter-somereporter` or just `somereporter` as the name.
### `--color`, `--no-color`
Force enable/disable colored output, option is passed to the reporter which should respect it.

View file

@ -98,3 +98,7 @@ The name can be either a path to a module or a package name. For package names E
And then try to load the module/package with the given name.
For example, if you want to use the `emigrate-reporter-somereporter` package, you can specify either `emigrate-reporter-somereporter` or just `somereporter` as the name.
### `--color`, `--no-color`
Force enable/disable colored output, option is passed to the reporter which should respect it.

View file

@ -112,3 +112,7 @@ The name can be either a path to a module or a package name. For package names E
And then try to load the module/package with the given name.
For example, if you want to use the `emigrate-reporter-somereporter` package, you can specify either `emigrate-reporter-somereporter` or just `somereporter` as the name.
### `--color`, `--no-color`
Force enable/disable colored output, option is passed to the reporter which should respect it.

View file

@ -46,6 +46,7 @@ Set the directory where your migrations are located, relative to the project roo
### `reporter`
**type:** `string | EmigrateReporter | Promise<EmigrateReporter> | (() => Promise<EmigrateReporter>)`
**default:** `"default"` - the default reporter
Set the reporter to use for the different commands. Specifying a <Link href="/plugins/reporters/">reporter</Link> is most useful in a CI or production environment where you either ship logs or want to have a machine-readable format.
@ -74,6 +75,20 @@ Commands that are not specified will use the default reporter.
The default reporter automatically detects if the current environment is an interactive terminal or not, and will only render animations and similar if it is.
:::
### `color`
**type:** `boolean | undefined`
**default:** `undefined`
Set whether to force colors in the output or not. This option is passed to the reporter which should respect it.
```js title="emigrate.config.js" {2}
export default {
color: false,
};
```
### `storage`
**type:** `string | EmigrateStorage | Promise<EmigrateStorage> | (() => Promise<EmigrateStorage>)`