@code-pushup/cli
Version:
A CLI to run all kinds of code quality measurements to align your team with company goals
28 lines • 1.28 kB
JavaScript
import { coerceBooleanValue } from '@code-pushup/utils';
/**
*
* | CP_VERBOSE value | CLI `--verbose` flag | Effect |
* |------------------|-----------------------------|------------|
* | true | Not provided | enabled |
* | false | Not provided | disabled |
* | Not provided | Not provided | disabled |
* | Not provided | Explicitly set (true) | enabled |
* | true | Explicitly set (true) | enabled |
* | false | Explicitly set (true) | enabled |
* | true | Explicitly negated (false) | disabled |
* | false | Explicitly negated (false) | disabled |
*
* @param originalProcessArgs
*/
export function setVerboseMiddleware(originalProcessArgs) {
const envVerbose = coerceBooleanValue(process.env['CP_VERBOSE']);
const cliVerbose = coerceBooleanValue(originalProcessArgs.verbose);
const verboseEffect = cliVerbose ?? envVerbose ?? false;
// eslint-disable-next-line functional/immutable-data
process.env['CP_VERBOSE'] = `${verboseEffect}`;
return {
...originalProcessArgs,
verbose: verboseEffect,
};
}
//# sourceMappingURL=set-verbose.middleware.js.map