@oclif/core 3.0.0-beta.2 → 3.0.0-beta.21
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/README.md +10 -6
- package/flush.js +1 -1
- package/handle.js +1 -1
- package/lib/args.d.ts +1 -1
- package/lib/args.js +17 -18
- package/lib/cli-ux/action/base.d.ts +3 -5
- package/lib/cli-ux/action/base.js +32 -26
- package/lib/cli-ux/action/simple.js +13 -18
- package/lib/cli-ux/action/spinner.d.ts +4 -2
- package/lib/cli-ux/action/spinner.js +27 -19
- package/lib/cli-ux/action/spinners.js +1 -1
- package/lib/cli-ux/action/types.d.ts +5 -0
- package/lib/cli-ux/action/types.js +2 -0
- package/lib/cli-ux/config.d.ts +0 -1
- package/lib/cli-ux/config.js +17 -21
- package/lib/cli-ux/exit.d.ts +1 -1
- package/lib/cli-ux/exit.js +4 -1
- package/lib/cli-ux/flush.d.ts +1 -0
- package/lib/cli-ux/flush.js +28 -0
- package/lib/cli-ux/index.d.ts +10 -30
- package/lib/cli-ux/index.js +32 -75
- package/lib/cli-ux/list.js +3 -3
- package/lib/cli-ux/prompt.js +32 -22
- package/lib/cli-ux/stream.js +1 -0
- package/lib/cli-ux/styled/index.d.ts +5 -6
- package/lib/cli-ux/styled/index.js +11 -11
- package/lib/cli-ux/styled/json.js +8 -5
- package/lib/cli-ux/styled/object.js +7 -9
- package/lib/cli-ux/styled/table.d.ts +4 -4
- package/lib/cli-ux/styled/table.js +61 -64
- package/lib/cli-ux/styled/tree.js +1 -3
- package/lib/cli-ux/wait.js +3 -5
- package/lib/command.d.ts +15 -19
- package/lib/command.js +117 -96
- package/lib/config/config.d.ts +16 -23
- package/lib/config/config.js +180 -334
- package/lib/config/index.d.ts +1 -1
- package/lib/config/index.js +1 -2
- package/lib/config/plugin-loader.d.ts +30 -0
- package/lib/config/plugin-loader.js +145 -0
- package/lib/config/plugin.d.ts +6 -11
- package/lib/config/plugin.js +112 -78
- package/lib/config/ts-node.d.ts +2 -1
- package/lib/config/ts-node.js +64 -51
- package/lib/config/util.d.ts +1 -11
- package/lib/config/util.js +6 -59
- package/lib/errors/config.js +1 -1
- package/lib/errors/errors/cli.d.ts +1 -1
- package/lib/errors/errors/cli.js +18 -14
- package/lib/errors/errors/exit.d.ts +0 -3
- package/lib/errors/errors/exit.js +1 -1
- package/lib/errors/errors/module-load.d.ts +0 -3
- package/lib/errors/errors/module-load.js +1 -1
- package/lib/errors/errors/pretty-print.js +11 -9
- package/lib/errors/handle.d.ts +12 -2
- package/lib/errors/handle.js +28 -18
- package/lib/errors/index.d.ts +2 -2
- package/lib/errors/index.js +20 -19
- package/lib/errors/logger.js +9 -8
- package/lib/execute.d.ts +49 -0
- package/lib/execute.js +63 -0
- package/lib/flags.d.ts +102 -31
- package/lib/flags.js +81 -46
- package/lib/help/command.d.ts +2 -0
- package/lib/help/command.js +68 -53
- package/lib/help/docopts.js +9 -13
- package/lib/help/formatter.d.ts +1 -1
- package/lib/help/formatter.js +35 -24
- package/lib/help/index.d.ts +7 -3
- package/lib/help/index.js +77 -55
- package/lib/help/root.js +7 -9
- package/lib/help/util.d.ts +1 -7
- package/lib/help/util.js +8 -28
- package/lib/index.d.ts +19 -18
- package/lib/index.js +36 -48
- package/lib/interfaces/config.d.ts +30 -30
- package/lib/interfaces/errors.d.ts +1 -1
- package/lib/interfaces/hooks.d.ts +3 -3
- package/lib/interfaces/index.d.ts +14 -14
- package/lib/interfaces/parser.d.ts +188 -116
- package/lib/interfaces/pjson.d.ts +2 -1
- package/lib/interfaces/plugin.d.ts +10 -1
- package/lib/main.d.ts +0 -48
- package/lib/main.js +11 -66
- package/lib/module-loader.d.ts +68 -79
- package/lib/module-loader.js +183 -150
- package/lib/parser/errors.d.ts +3 -3
- package/lib/parser/errors.js +17 -10
- package/lib/parser/help.js +5 -5
- package/lib/parser/parse.d.ts +3 -0
- package/lib/parser/parse.js +114 -115
- package/lib/parser/validate.js +45 -25
- package/lib/performance.d.ts +5 -1
- package/lib/performance.js +40 -19
- package/lib/util/aggregate-flags.d.ts +2 -0
- package/lib/util/aggregate-flags.js +13 -0
- package/lib/util/cache-command.d.ts +3 -0
- package/lib/util/cache-command.js +109 -0
- package/lib/util/cache-default-value.d.ts +2 -0
- package/lib/util/cache-default-value.js +28 -0
- package/lib/util/ensure-arg-object.d.ts +12 -0
- package/lib/util/ensure-arg-object.js +14 -0
- package/lib/util/fs.d.ts +7 -0
- package/lib/util/fs.js +54 -0
- package/lib/util/os.d.ts +19 -0
- package/lib/util/os.js +28 -0
- package/lib/{util.d.ts → util/util.d.ts} +6 -15
- package/lib/util/util.js +98 -0
- package/package.json +32 -34
- package/lib/cli-ux/action/pride-spinner.d.ts +0 -4
- package/lib/cli-ux/action/pride-spinner.js +0 -30
- package/lib/util.js +0 -126
|
@@ -1,17 +1,21 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.table = void 0;
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
-
const
|
|
7
|
-
const
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const F = tslib_1.__importStar(require("../../flags"));
|
|
6
|
+
const util_1 = require("../../util/util");
|
|
7
|
+
const chalk_1 = tslib_1.__importDefault(require("chalk"));
|
|
8
|
+
const node_util_1 = require("node:util");
|
|
9
|
+
const natural_orderby_1 = require("natural-orderby");
|
|
8
10
|
const js_yaml_1 = require("js-yaml");
|
|
9
|
-
const
|
|
11
|
+
const slice_ansi_1 = tslib_1.__importDefault(require("slice-ansi"));
|
|
10
12
|
const stream_1 = require("../stream");
|
|
11
|
-
const
|
|
12
|
-
const
|
|
13
|
-
const sliceAnsi = require('slice-ansi');
|
|
13
|
+
const screen_1 = require("../../screen");
|
|
14
|
+
const string_width_1 = tslib_1.__importDefault(require("string-width"));
|
|
14
15
|
class Table {
|
|
16
|
+
data;
|
|
17
|
+
options;
|
|
18
|
+
columns;
|
|
15
19
|
constructor(data, columns, options = {}) {
|
|
16
20
|
this.data = data;
|
|
17
21
|
// assign columns
|
|
@@ -20,8 +24,8 @@ class Table {
|
|
|
20
24
|
const extended = col.extended ?? false;
|
|
21
25
|
// turn null and undefined into empty strings by default
|
|
22
26
|
const get = col.get ?? ((row) => row[key] ?? '');
|
|
23
|
-
const header = typeof col.header === 'string' ? col.header : (0, util_1.capitalize)(key.
|
|
24
|
-
const minWidth = Math.max(col.minWidth ?? 0,
|
|
27
|
+
const header = typeof col.header === 'string' ? col.header : (0, util_1.capitalize)(key.replaceAll('_', ' '));
|
|
28
|
+
const minWidth = Math.max(col.minWidth ?? 0, (0, string_width_1.default)(header) + 1);
|
|
25
29
|
return {
|
|
26
30
|
extended,
|
|
27
31
|
get,
|
|
@@ -47,19 +51,18 @@ class Table {
|
|
|
47
51
|
}
|
|
48
52
|
display() {
|
|
49
53
|
// build table rows from input array data
|
|
50
|
-
let rows = this.data.map(d => {
|
|
54
|
+
let rows = this.data.map((d) => {
|
|
51
55
|
const row = {};
|
|
52
56
|
for (const col of this.columns) {
|
|
53
57
|
let val = col.get(d);
|
|
54
58
|
if (typeof val !== 'string')
|
|
55
|
-
val = (0,
|
|
59
|
+
val = (0, node_util_1.inspect)(val, { breakLength: Number.POSITIVE_INFINITY });
|
|
56
60
|
row[col.key] = val;
|
|
57
61
|
}
|
|
58
62
|
return row;
|
|
59
63
|
});
|
|
60
64
|
// filter rows
|
|
61
65
|
if (this.options.filter) {
|
|
62
|
-
/* eslint-disable-next-line prefer-const */
|
|
63
66
|
let [header, regex] = this.options.filter.split('=');
|
|
64
67
|
const isNot = header[0] === '-';
|
|
65
68
|
if (isNot)
|
|
@@ -77,12 +80,10 @@ class Table {
|
|
|
77
80
|
// sort rows
|
|
78
81
|
if (this.options.sort) {
|
|
79
82
|
const sorters = this.options.sort.split(',');
|
|
80
|
-
const sortHeaders = sorters.map(k => k[0] === '-' ? k.slice(1) : k);
|
|
81
|
-
const sortKeys = this.filterColumnsFromHeaders(sortHeaders).map(c =>
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
const sortKeysOrder = sorters.map(k => k[0] === '-' ? 'desc' : 'asc');
|
|
85
|
-
rows = orderBy(rows, sortKeys, sortKeysOrder);
|
|
83
|
+
const sortHeaders = sorters.map((k) => (k[0] === '-' ? k.slice(1) : k));
|
|
84
|
+
const sortKeys = this.filterColumnsFromHeaders(sortHeaders).map((c) => (v) => v[c.key]);
|
|
85
|
+
const sortKeysOrder = sorters.map((k) => (k[0] === '-' ? 'desc' : 'asc'));
|
|
86
|
+
rows = (0, natural_orderby_1.orderBy)(rows, sortKeys, sortKeysOrder);
|
|
86
87
|
}
|
|
87
88
|
// and filter columns
|
|
88
89
|
if (this.options.columns) {
|
|
@@ -91,53 +92,49 @@ class Table {
|
|
|
91
92
|
}
|
|
92
93
|
else if (!this.options.extended) {
|
|
93
94
|
// show extented columns/properties
|
|
94
|
-
this.columns = this.columns.filter(c => !c.extended);
|
|
95
|
+
this.columns = this.columns.filter((c) => !c.extended);
|
|
95
96
|
}
|
|
96
97
|
this.data = rows;
|
|
97
98
|
switch (this.options.output) {
|
|
98
|
-
case 'csv':
|
|
99
|
+
case 'csv': {
|
|
99
100
|
this.outputCSV();
|
|
100
101
|
break;
|
|
101
|
-
|
|
102
|
+
}
|
|
103
|
+
case 'json': {
|
|
102
104
|
this.outputJSON();
|
|
103
105
|
break;
|
|
104
|
-
|
|
106
|
+
}
|
|
107
|
+
case 'yaml': {
|
|
105
108
|
this.outputYAML();
|
|
106
109
|
break;
|
|
107
|
-
|
|
110
|
+
}
|
|
111
|
+
default: {
|
|
108
112
|
this.outputTable();
|
|
113
|
+
}
|
|
109
114
|
}
|
|
110
115
|
}
|
|
111
116
|
findColumnFromHeader(header) {
|
|
112
|
-
return this.columns.find(c => c.header.toLowerCase() === header.toLowerCase());
|
|
117
|
+
return this.columns.find((c) => c.header.toLowerCase() === header.toLowerCase());
|
|
113
118
|
}
|
|
114
119
|
filterColumnsFromHeaders(filters) {
|
|
115
120
|
// unique
|
|
116
|
-
filters = [...
|
|
121
|
+
filters = [...new Set(filters)];
|
|
117
122
|
const cols = [];
|
|
118
123
|
for (const f of filters) {
|
|
119
|
-
const c = this.columns.find(c => c.header.toLowerCase() === f.toLowerCase());
|
|
124
|
+
const c = this.columns.find((c) => c.header.toLowerCase() === f.toLowerCase());
|
|
120
125
|
if (c)
|
|
121
126
|
cols.push(c);
|
|
122
127
|
}
|
|
123
128
|
return cols;
|
|
124
129
|
}
|
|
125
130
|
getCSVRow(d) {
|
|
126
|
-
const values = this.columns.map(col => d[col.key] || '');
|
|
131
|
+
const values = this.columns.map((col) => d[col.key] || '');
|
|
127
132
|
const lineToBeEscaped = values.find((e) => e.includes('"') || e.includes('\n') || e.includes('\r\n') || e.includes('\r') || e.includes(','));
|
|
128
|
-
return values.map(e => lineToBeEscaped ? `"${e.replace('"', '""')}"` : e);
|
|
133
|
+
return values.map((e) => (lineToBeEscaped ? `"${e.replace('"', '""')}"` : e));
|
|
129
134
|
}
|
|
130
135
|
resolveColumnsToObjectArray() {
|
|
131
136
|
const { data, columns } = this;
|
|
132
|
-
return data.map((d) =>
|
|
133
|
-
// eslint-disable-next-line unicorn/prefer-object-from-entries
|
|
134
|
-
return columns.reduce((obj, col) => {
|
|
135
|
-
return {
|
|
136
|
-
...obj,
|
|
137
|
-
[col.key]: d[col.key] ?? '',
|
|
138
|
-
};
|
|
139
|
-
}, {});
|
|
140
|
-
});
|
|
137
|
+
return data.map((d) => Object.fromEntries(columns.map((col) => [col.key, d[col.key] ?? ''])));
|
|
141
138
|
}
|
|
142
139
|
outputJSON() {
|
|
143
140
|
this.options.printLine(JSON.stringify(this.resolveColumnsToObjectArray(), undefined, 2));
|
|
@@ -148,7 +145,7 @@ class Table {
|
|
|
148
145
|
outputCSV() {
|
|
149
146
|
const { data, columns, options } = this;
|
|
150
147
|
if (!options['no-header']) {
|
|
151
|
-
options.printLine(columns.map(c => c.header).join(','));
|
|
148
|
+
options.printLine(columns.map((c) => c.header).join(','));
|
|
152
149
|
}
|
|
153
150
|
for (const d of data) {
|
|
154
151
|
const row = this.getCSVRow(d);
|
|
@@ -160,8 +157,8 @@ class Table {
|
|
|
160
157
|
// column truncation
|
|
161
158
|
//
|
|
162
159
|
// find max width for each column
|
|
163
|
-
const columns = this.columns.map(c => {
|
|
164
|
-
const maxWidth = Math.max(
|
|
160
|
+
const columns = this.columns.map((c) => {
|
|
161
|
+
const maxWidth = Math.max((0, string_width_1.default)('.'.padEnd(c.minWidth - 1)), (0, string_width_1.default)(c.header), getWidestColumnWith(data, c.key)) + 1;
|
|
165
162
|
return {
|
|
166
163
|
...c,
|
|
167
164
|
maxWidth,
|
|
@@ -176,7 +173,7 @@ class Table {
|
|
|
176
173
|
if (options['no-truncate'] || (!stream_1.stdout.isTTY && !process.env.CLI_UX_SKIP_TTY_CHECK))
|
|
177
174
|
return;
|
|
178
175
|
// don't shorten if there is enough screen width
|
|
179
|
-
const dataMaxWidth = (0, util_1.sumBy)(columns, c => c.width);
|
|
176
|
+
const dataMaxWidth = (0, util_1.sumBy)(columns, (c) => c.width);
|
|
180
177
|
const overWidth = dataMaxWidth - maxWidth;
|
|
181
178
|
if (overWidth <= 0)
|
|
182
179
|
return;
|
|
@@ -187,16 +184,18 @@ class Table {
|
|
|
187
184
|
// if sum(minWidth's) is greater than term width
|
|
188
185
|
// nothing can be done so
|
|
189
186
|
// display all as minWidth
|
|
190
|
-
const dataMinWidth = (0, util_1.sumBy)(columns, c => c.minWidth);
|
|
187
|
+
const dataMinWidth = (0, util_1.sumBy)(columns, (c) => c.minWidth);
|
|
191
188
|
if (dataMinWidth >= maxWidth)
|
|
192
189
|
return;
|
|
193
190
|
// some wiggle room left, add it back to "needy" columns
|
|
194
191
|
let wiggleRoom = maxWidth - dataMinWidth;
|
|
195
|
-
const needyCols = columns
|
|
192
|
+
const needyCols = columns
|
|
193
|
+
.map((c) => ({ key: c.key, needs: c.maxWidth - c.width }))
|
|
194
|
+
.sort((a, b) => a.needs - b.needs);
|
|
196
195
|
for (const { key, needs } of needyCols) {
|
|
197
196
|
if (!needs)
|
|
198
197
|
continue;
|
|
199
|
-
const col = columns.find(c => key === c.key);
|
|
198
|
+
const col = columns.find((c) => key === c.key);
|
|
200
199
|
if (!col)
|
|
201
200
|
continue;
|
|
202
201
|
if (wiggleRoom > needs) {
|
|
@@ -224,14 +223,14 @@ class Table {
|
|
|
224
223
|
const header = col.header;
|
|
225
224
|
headers += header.padEnd(col.width);
|
|
226
225
|
}
|
|
227
|
-
options.printLine(
|
|
226
|
+
options.printLine(chalk_1.default.bold(headers));
|
|
228
227
|
// print header dividers
|
|
229
228
|
let dividers = options.rowStart;
|
|
230
229
|
for (const col of columns) {
|
|
231
230
|
const divider = ''.padEnd(col.width - 1, '─') + ' ';
|
|
232
231
|
dividers += divider.padEnd(col.width);
|
|
233
232
|
}
|
|
234
|
-
options.printLine(
|
|
233
|
+
options.printLine(chalk_1.default.bold(dividers));
|
|
235
234
|
}
|
|
236
235
|
// print rows
|
|
237
236
|
for (const row of data) {
|
|
@@ -255,16 +254,16 @@ class Table {
|
|
|
255
254
|
const width = col.width;
|
|
256
255
|
let d = row[col.key];
|
|
257
256
|
d = d.split('\n')[i] || '';
|
|
258
|
-
const visualWidth =
|
|
259
|
-
const colorWidth =
|
|
257
|
+
const visualWidth = (0, string_width_1.default)(d);
|
|
258
|
+
const colorWidth = d.length - visualWidth;
|
|
260
259
|
let cell = d.padEnd(width + colorWidth);
|
|
261
|
-
if (
|
|
260
|
+
if (cell.length - colorWidth > width || visualWidth === width) {
|
|
262
261
|
// truncate the cell, preserving ANSI escape sequences, and keeping
|
|
263
262
|
// into account the width of fullwidth unicode characters
|
|
264
|
-
cell =
|
|
263
|
+
cell = (0, slice_ansi_1.default)(cell, 0, width - 2) + '… ';
|
|
265
264
|
// pad with spaces; this is necessary in case the original string
|
|
266
265
|
// contained fullwidth characters which cannot be split
|
|
267
|
-
cell += ' '.repeat(width -
|
|
266
|
+
cell += ' '.repeat(width - (0, string_width_1.default)(cell));
|
|
268
267
|
}
|
|
269
268
|
l += cell;
|
|
270
269
|
}
|
|
@@ -280,7 +279,7 @@ exports.table = table;
|
|
|
280
279
|
(function (table) {
|
|
281
280
|
table.Flags = {
|
|
282
281
|
columns: F.string({ exclusive: ['extended'], description: 'only show provided columns (comma-separated)' }),
|
|
283
|
-
sort: F.string({ description:
|
|
282
|
+
sort: F.string({ description: "property to sort by (prepend '-' for descending)" }),
|
|
284
283
|
filter: F.string({ description: 'filter property by partial string matching, ex: name=foo' }),
|
|
285
284
|
csv: F.boolean({ exclusive: ['no-truncate'], description: 'output is csv format [alias: --output=csv]' }),
|
|
286
285
|
output: F.string({
|
|
@@ -292,7 +291,6 @@ exports.table = table;
|
|
|
292
291
|
'no-truncate': F.boolean({ exclusive: ['csv'], description: 'do not truncate output to fit screen' }),
|
|
293
292
|
'no-header': F.boolean({ exclusive: ['csv'], description: 'hide table header from output' }),
|
|
294
293
|
};
|
|
295
|
-
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
|
|
296
294
|
function flags(opts) {
|
|
297
295
|
if (opts) {
|
|
298
296
|
const f = {};
|
|
@@ -300,6 +298,7 @@ exports.table = table;
|
|
|
300
298
|
const e = (opts.except && typeof opts.except === 'string' ? [opts.except] : opts.except) || [];
|
|
301
299
|
for (const key of o) {
|
|
302
300
|
if (!e.includes(key)) {
|
|
301
|
+
;
|
|
303
302
|
f[key] = table.Flags[key];
|
|
304
303
|
}
|
|
305
304
|
}
|
|
@@ -308,13 +307,11 @@ exports.table = table;
|
|
|
308
307
|
return table.Flags;
|
|
309
308
|
}
|
|
310
309
|
table.flags = flags;
|
|
311
|
-
})(table
|
|
312
|
-
const getWidestColumnWith = (data, columnKey) => {
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
}, 0);
|
|
320
|
-
};
|
|
310
|
+
})(table || (exports.table = table = {}));
|
|
311
|
+
const getWidestColumnWith = (data, columnKey) => data.reduce((previous, current) => {
|
|
312
|
+
const d = current[columnKey];
|
|
313
|
+
// convert multi-line cell to single longest line
|
|
314
|
+
// for width calculations
|
|
315
|
+
const manyLines = d.split('\n');
|
|
316
|
+
return Math.max(previous, manyLines.length > 1 ? Math.max(...manyLines.map((r) => (0, string_width_1.default)(r))) : (0, string_width_1.default)(d));
|
|
317
|
+
}, 0);
|
|
@@ -3,9 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.Tree = void 0;
|
|
4
4
|
const treeify = require('object-treeify');
|
|
5
5
|
class Tree {
|
|
6
|
-
|
|
7
|
-
this.nodes = {};
|
|
8
|
-
}
|
|
6
|
+
nodes = {};
|
|
9
7
|
insert(child, value = new Tree()) {
|
|
10
8
|
this.nodes[child] = value;
|
|
11
9
|
return this;
|
package/lib/cli-ux/wait.js
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.default = (ms = 1000) => {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
});
|
|
7
|
-
};
|
|
3
|
+
exports.default = (ms = 1000) => new Promise((resolve) => {
|
|
4
|
+
setTimeout(resolve, ms);
|
|
5
|
+
});
|
package/lib/command.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
+
import { ArgInput, ArgOutput, ArgProps, BooleanFlagProps, Deprecation, FlagInput, FlagOutput, Arg as IArg, Flag as IFlag, Input, OptionFlagProps, ParserOutput } from './interfaces/parser';
|
|
2
|
+
import { CommandError } from './interfaces/errors';
|
|
1
3
|
import { Config } from './config';
|
|
2
|
-
import { PrettyPrintableError } from './errors';
|
|
3
|
-
import { BooleanFlagProps, CompletableFlag, Deprecation, Arg as IArg, ArgInput, FlagInput, FlagOutput, Input, ArgProps, OptionFlagProps, ParserOutput, ArgOutput } from './interfaces/parser';
|
|
4
|
-
import { Plugin } from './interfaces/plugin';
|
|
5
4
|
import { LoadOptions } from './interfaces/config';
|
|
6
|
-
import {
|
|
5
|
+
import { Plugin } from './interfaces/plugin';
|
|
6
|
+
import { PrettyPrintableError } from './errors';
|
|
7
7
|
/**
|
|
8
8
|
* An abstract class which acts as the base for each command
|
|
9
9
|
* in your project.
|
|
@@ -65,13 +65,7 @@ export declare abstract class Command {
|
|
|
65
65
|
*/
|
|
66
66
|
static examples: Command.Example[];
|
|
67
67
|
static hasDynamicHelp: boolean;
|
|
68
|
-
|
|
69
|
-
protected static _enableJsonFlag: boolean;
|
|
70
|
-
static get enableJsonFlag(): boolean;
|
|
71
|
-
static set enableJsonFlag(value: boolean);
|
|
72
|
-
static get '--'(): boolean;
|
|
73
|
-
static set '--'(value: boolean);
|
|
74
|
-
get passThroughEnabled(): boolean;
|
|
68
|
+
static enableJsonFlag: boolean;
|
|
75
69
|
/**
|
|
76
70
|
* instantiate and run the command
|
|
77
71
|
*
|
|
@@ -81,13 +75,9 @@ export declare abstract class Command {
|
|
|
81
75
|
* @returns {Promise<unknown>} result
|
|
82
76
|
*/
|
|
83
77
|
static run<T extends Command>(this: new (argv: string[], config: Config) => T, argv?: string[], opts?: LoadOptions): Promise<ReturnType<T['run']>>;
|
|
84
|
-
|
|
85
|
-
static get baseFlags(): FlagInput;
|
|
86
|
-
static set baseFlags(flags: FlagInput);
|
|
78
|
+
static baseFlags: FlagInput;
|
|
87
79
|
/** A hash of flags for the command */
|
|
88
|
-
|
|
89
|
-
static get flags(): FlagInput;
|
|
90
|
-
static set flags(flags: FlagInput);
|
|
80
|
+
static flags: FlagInput;
|
|
91
81
|
id: string | undefined;
|
|
92
82
|
protected debug: (...args: any[]) => void;
|
|
93
83
|
constructor(argv: string[], config: Config);
|
|
@@ -157,10 +147,16 @@ export declare namespace Command {
|
|
|
157
147
|
[name: string]: Arg.Cached;
|
|
158
148
|
};
|
|
159
149
|
hasDynamicHelp?: boolean;
|
|
150
|
+
permutations?: string[];
|
|
151
|
+
aliasPermutations?: string[];
|
|
152
|
+
isESM?: boolean;
|
|
153
|
+
relativePath?: string[];
|
|
160
154
|
};
|
|
161
|
-
type Flag =
|
|
155
|
+
type Flag = IFlag<any>;
|
|
162
156
|
namespace Flag {
|
|
163
|
-
type Cached = Omit<Flag, 'parse' | 'input'> & (BooleanFlagProps | OptionFlagProps)
|
|
157
|
+
type Cached = Omit<Flag, 'parse' | 'input'> & (BooleanFlagProps | OptionFlagProps) & {
|
|
158
|
+
hasDynamicHelp?: boolean;
|
|
159
|
+
};
|
|
164
160
|
type Any = Flag | Cached;
|
|
165
161
|
}
|
|
166
162
|
type Arg = IArg<any>;
|