UNPKG

1.52 kBJavaScriptView Raw
1"use strict";
2Object.defineProperty(exports, "__esModule", { value: true });
3const deps_1 = require("./deps");
4class Config {
5 static get debug() {
6 return !!Config._globals.debug;
7 }
8 static set debug(debug) {
9 Config._globals.debug = debug;
10 }
11 static get mock() {
12 return !!Config._globals.mock;
13 }
14 static set mock(mock) {
15 if (mock) {
16 deps_1.default.chalk.enabled = false;
17 Config.stdout = '';
18 Config.stderr = '';
19 }
20 Config._globals.mock = mock;
21 }
22 static get displayTimestamps() {
23 return !!Config._globals.displayTimestamps;
24 }
25 static set displayTimestamps(displayTimestamps) {
26 Config._globals.displayTimestamps = displayTimestamps;
27 }
28 static get errlog() {
29 return Config._globals.errlog;
30 }
31 static set errlog(errlog) {
32 Config._globals.errlog = errlog;
33 }
34 static get stdout() {
35 return Config._globals.stdout || '';
36 }
37 static set stdout(stdout) {
38 Config._globals.stdout = stdout;
39 }
40 static get stderr() {
41 return Config._globals.stderr || '';
42 }
43 static set stderr(stderr) {
44 Config._globals.stderr = stderr;
45 }
46 static get windows() {
47 return process.platform === 'win32';
48 }
49 static get _globals() {
50 const globals = (global['cli-ux'] = global['cli-ux'] || {});
51 globals.action = globals.action || {};
52 return globals;
53 }
54}
55exports.default = Config;