@oclif/core 3.0.0-beta.7 → 3.0.0-beta.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/index.d.ts +1 -1
- package/lib/index.js +2 -2
- package/lib/ux/index.d.ts +24 -7
- package/lib/ux/index.js +51 -16
- package/package.json +2 -4
package/lib/index.d.ts
CHANGED
|
@@ -13,7 +13,7 @@ import * as Parser from './parser';
|
|
|
13
13
|
import { Hook } from './interfaces/hooks';
|
|
14
14
|
import settings, { Settings } from './settings';
|
|
15
15
|
import { HelpSection, HelpSectionRenderer, HelpSectionKeyValueTable } from './help/formatter';
|
|
16
|
-
import ux from './ux';
|
|
16
|
+
import * as ux from './ux';
|
|
17
17
|
import { stderr, stdout } from './ux/stream';
|
|
18
18
|
import Performance from './performance';
|
|
19
19
|
import flush from './ux/flush';
|
package/lib/index.js
CHANGED
|
@@ -34,8 +34,8 @@ const Parser = require("./parser");
|
|
|
34
34
|
exports.Parser = Parser;
|
|
35
35
|
const settings_1 = require("./settings");
|
|
36
36
|
exports.settings = settings_1.default;
|
|
37
|
-
const
|
|
38
|
-
exports.ux =
|
|
37
|
+
const ux = require("./ux");
|
|
38
|
+
exports.ux = ux;
|
|
39
39
|
const stream_1 = require("./ux/stream");
|
|
40
40
|
Object.defineProperty(exports, "stderr", { enumerable: true, get: function () { return stream_1.stderr; } });
|
|
41
41
|
Object.defineProperty(exports, "stdout", { enumerable: true, get: function () { return stream_1.stdout; } });
|
package/lib/ux/index.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import * as Errors from '../errors';
|
|
1
2
|
import { ActionBase } from './action/base';
|
|
2
3
|
import { config, Config } from './config';
|
|
3
4
|
import { ExitError } from './exit';
|
|
@@ -31,11 +32,27 @@ export default class ux {
|
|
|
31
32
|
static url(text: string, uri: string, params?: {}): void;
|
|
32
33
|
static annotation(text: string, annotation: string): void;
|
|
33
34
|
static flush(ms?: number): Promise<void>;
|
|
34
|
-
static error(err: Error | string, options?: {
|
|
35
|
-
code?: string;
|
|
36
|
-
exit?: number;
|
|
37
|
-
}): never;
|
|
38
|
-
static exit(code?: number): never;
|
|
39
|
-
static warn(err: Error | string): void;
|
|
40
35
|
}
|
|
41
|
-
|
|
36
|
+
declare const action: ActionBase;
|
|
37
|
+
declare const annotation: typeof ux.annotation;
|
|
38
|
+
declare const anykey: typeof uxPrompt.anykey;
|
|
39
|
+
declare const confirm: typeof uxPrompt.confirm;
|
|
40
|
+
declare const debug: typeof ux.debug;
|
|
41
|
+
declare const done: typeof ux.done;
|
|
42
|
+
declare const error: typeof Errors.error;
|
|
43
|
+
declare const exit: typeof Errors.exit;
|
|
44
|
+
declare const flush: typeof ux.flush;
|
|
45
|
+
declare const info: typeof ux.info;
|
|
46
|
+
declare const log: typeof ux.log;
|
|
47
|
+
declare const progress: typeof styled.progress;
|
|
48
|
+
declare const prompt: typeof uxPrompt.prompt;
|
|
49
|
+
declare const styledHeader: typeof ux.styledHeader;
|
|
50
|
+
declare const styledJSON: typeof styled.styledJSON;
|
|
51
|
+
declare const styledObject: typeof ux.styledObject;
|
|
52
|
+
declare const table: typeof styled.Table.table;
|
|
53
|
+
declare const trace: typeof ux.trace;
|
|
54
|
+
declare const tree: typeof styled.tree;
|
|
55
|
+
declare const url: typeof ux.url;
|
|
56
|
+
declare const wait: (ms?: number) => Promise<void>;
|
|
57
|
+
declare const warn: typeof Errors.warn;
|
|
58
|
+
export { action, annotation, anykey, confirm, debug, done, error, exit, flush, info, log, progress, prompt, styledHeader, styledJSON, styledObject, table, trace, tree, url, wait, warn, ActionBase, config, Config, ExitError, IPromptOptions, Table, };
|
package/lib/ux/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Table = exports.ExitError = exports.Config = exports.config = exports.ActionBase = void 0;
|
|
3
|
+
exports.Table = exports.ExitError = exports.Config = exports.config = exports.ActionBase = exports.warn = exports.wait = exports.url = exports.tree = exports.trace = exports.table = exports.styledObject = exports.styledJSON = exports.styledHeader = exports.prompt = exports.progress = exports.log = exports.info = exports.flush = exports.exit = exports.error = exports.done = exports.debug = exports.confirm = exports.anykey = exports.annotation = exports.action = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const Errors = require("../errors");
|
|
6
6
|
const util = require("util");
|
|
@@ -19,7 +19,7 @@ tslib_1.__exportStar(require("./styled/table"), exports);
|
|
|
19
19
|
const uxPrompt = require("./prompt");
|
|
20
20
|
const wait_1 = require("./wait");
|
|
21
21
|
const stream_1 = require("./stream");
|
|
22
|
-
const
|
|
22
|
+
const _flush = require("./flush");
|
|
23
23
|
const hyperlinker = require('hyperlinker');
|
|
24
24
|
class ux {
|
|
25
25
|
static get prompt() {
|
|
@@ -39,10 +39,10 @@ class ux {
|
|
|
39
39
|
}
|
|
40
40
|
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
|
|
41
41
|
static styledObject(obj, keys) {
|
|
42
|
-
this.
|
|
42
|
+
this.info(styled.styledObject(obj, keys));
|
|
43
43
|
}
|
|
44
44
|
static styledHeader(header) {
|
|
45
|
-
this.
|
|
45
|
+
this.info(chalk.dim('=== ') + chalk.bold(header) + '\n');
|
|
46
46
|
}
|
|
47
47
|
static get styledJSON() {
|
|
48
48
|
return styled.styledJSON;
|
|
@@ -63,12 +63,12 @@ class ux {
|
|
|
63
63
|
config_1.config.action.stop();
|
|
64
64
|
}
|
|
65
65
|
static trace(format, ...args) {
|
|
66
|
-
if (
|
|
66
|
+
if (this.config.outputLevel === 'trace') {
|
|
67
67
|
stream_1.stdout.write(util.format(format, ...args) + '\n');
|
|
68
68
|
}
|
|
69
69
|
}
|
|
70
70
|
static debug(format, ...args) {
|
|
71
|
-
if (['trace', 'debug'].includes(
|
|
71
|
+
if (['trace', 'debug'].includes(this.config.outputLevel)) {
|
|
72
72
|
stream_1.stdout.write(util.format(format, ...args) + '\n');
|
|
73
73
|
}
|
|
74
74
|
}
|
|
@@ -98,20 +98,55 @@ class ux {
|
|
|
98
98
|
}
|
|
99
99
|
}
|
|
100
100
|
static async flush(ms = 10000) {
|
|
101
|
-
await
|
|
102
|
-
}
|
|
103
|
-
static error(err, options = {}) {
|
|
104
|
-
throw Errors.error(err, options);
|
|
105
|
-
}
|
|
106
|
-
static exit(code = 0) {
|
|
107
|
-
throw Errors.exit(code);
|
|
108
|
-
}
|
|
109
|
-
static warn(err) {
|
|
110
|
-
Errors.warn(err);
|
|
101
|
+
await _flush.default(ms);
|
|
111
102
|
}
|
|
112
103
|
}
|
|
113
104
|
exports.default = ux;
|
|
114
105
|
ux.config = config_1.config;
|
|
106
|
+
const action = ux.action;
|
|
107
|
+
exports.action = action;
|
|
108
|
+
const annotation = ux.annotation;
|
|
109
|
+
exports.annotation = annotation;
|
|
110
|
+
const anykey = ux.anykey;
|
|
111
|
+
exports.anykey = anykey;
|
|
112
|
+
const confirm = ux.confirm;
|
|
113
|
+
exports.confirm = confirm;
|
|
114
|
+
const debug = ux.debug;
|
|
115
|
+
exports.debug = debug;
|
|
116
|
+
const done = ux.done;
|
|
117
|
+
exports.done = done;
|
|
118
|
+
const error = Errors.error;
|
|
119
|
+
exports.error = error;
|
|
120
|
+
const exit = Errors.exit;
|
|
121
|
+
exports.exit = exit;
|
|
122
|
+
const flush = ux.flush;
|
|
123
|
+
exports.flush = flush;
|
|
124
|
+
const info = ux.info;
|
|
125
|
+
exports.info = info;
|
|
126
|
+
const log = ux.log;
|
|
127
|
+
exports.log = log;
|
|
128
|
+
const progress = ux.progress;
|
|
129
|
+
exports.progress = progress;
|
|
130
|
+
const prompt = ux.prompt;
|
|
131
|
+
exports.prompt = prompt;
|
|
132
|
+
const styledHeader = ux.styledHeader;
|
|
133
|
+
exports.styledHeader = styledHeader;
|
|
134
|
+
const styledJSON = ux.styledJSON;
|
|
135
|
+
exports.styledJSON = styledJSON;
|
|
136
|
+
const styledObject = ux.styledObject;
|
|
137
|
+
exports.styledObject = styledObject;
|
|
138
|
+
const table = ux.table;
|
|
139
|
+
exports.table = table;
|
|
140
|
+
const trace = ux.trace;
|
|
141
|
+
exports.trace = trace;
|
|
142
|
+
const tree = ux.tree;
|
|
143
|
+
exports.tree = tree;
|
|
144
|
+
const url = ux.url;
|
|
145
|
+
exports.url = url;
|
|
146
|
+
const wait = ux.wait;
|
|
147
|
+
exports.wait = wait;
|
|
148
|
+
const warn = Errors.warn;
|
|
149
|
+
exports.warn = warn;
|
|
115
150
|
const uxProcessExitHandler = async () => {
|
|
116
151
|
try {
|
|
117
152
|
await ux.done();
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oclif/core",
|
|
3
3
|
"description": "base library for oclif CLIs",
|
|
4
|
-
"version": "3.0.0-beta.
|
|
4
|
+
"version": "3.0.0-beta.9",
|
|
5
5
|
"author": "Salesforce",
|
|
6
6
|
"bugs": "https://github.com/oclif/core/issues",
|
|
7
7
|
"dependencies": {
|
|
@@ -96,10 +96,8 @@
|
|
|
96
96
|
"./execute": "./lib/execute.js",
|
|
97
97
|
"./flush": "./lib/ux/flush.js",
|
|
98
98
|
"./handle": "./lib/errors/handle.js",
|
|
99
|
-
"./interfaces": "./lib/interfaces/index.js",
|
|
100
99
|
"./run": "./lib/main.js",
|
|
101
|
-
"./settings": "./lib/settings.js"
|
|
102
|
-
"./ux": "./lib/ux/index.js"
|
|
100
|
+
"./settings": "./lib/settings.js"
|
|
103
101
|
},
|
|
104
102
|
"repository": "oclif/core",
|
|
105
103
|
"oclif": {
|