@oclif/core 3.0.0-beta.8 → 3.0.0
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 +4 -2
- package/flush.d.ts +3 -0
- package/flush.js +1 -0
- package/handle.js +1 -0
- package/lib/args.d.ts +2 -2
- package/lib/args.js +17 -18
- package/lib/{ux → cli-ux}/action/base.d.ts +19 -21
- package/lib/{ux → cli-ux}/action/base.js +126 -120
- package/lib/{ux → cli-ux}/action/simple.js +25 -30
- package/lib/{ux → cli-ux}/action/spinner.d.ts +9 -7
- package/lib/{ux → cli-ux}/action/spinner.js +45 -37
- package/lib/{ux → cli-ux}/action/spinners.js +187 -187
- package/lib/cli-ux/action/types.d.ts +5 -0
- package/lib/cli-ux/action/types.js +2 -0
- package/lib/{ux → cli-ux}/config.d.ts +5 -5
- package/lib/{ux → cli-ux}/config.js +17 -17
- package/lib/{ux → cli-ux}/exit.js +3 -0
- package/lib/cli-ux/flush.d.ts +1 -0
- package/lib/cli-ux/flush.js +28 -0
- package/lib/cli-ux/index.d.ts +39 -0
- package/lib/{ux → cli-ux}/index.js +74 -97
- package/lib/{ux → cli-ux}/list.js +3 -3
- package/lib/{ux → cli-ux}/prompt.d.ts +3 -3
- package/lib/{ux → cli-ux}/prompt.js +35 -25
- package/lib/{ux → cli-ux}/stream.d.ts +6 -6
- package/lib/{ux → cli-ux}/stream.js +11 -10
- package/lib/cli-ux/styled/index.d.ts +4 -0
- package/lib/cli-ux/styled/index.js +11 -0
- package/lib/{ux → cli-ux}/styled/object.js +7 -9
- package/lib/{ux → cli-ux}/styled/table.d.ts +10 -10
- package/lib/{ux → cli-ux}/styled/table.js +130 -133
- package/lib/{ux → cli-ux}/styled/tree.js +11 -13
- package/lib/cli-ux/wait.js +5 -0
- package/lib/command.d.ts +82 -88
- package/lib/command.js +196 -175
- package/lib/config/config.d.ts +89 -90
- package/lib/config/config.js +466 -566
- package/lib/config/index.d.ts +0 -1
- package/lib/config/index.js +1 -3
- package/lib/config/plugin-loader.d.ts +12 -12
- package/lib/config/plugin-loader.js +72 -56
- package/lib/config/plugin.d.ts +25 -24
- package/lib/config/plugin.js +188 -154
- package/lib/config/ts-node.d.ts +2 -1
- package/lib/config/ts-node.js +71 -58
- package/lib/config/util.d.ts +1 -11
- package/lib/config/util.js +6 -59
- package/lib/errors/config.d.ts +1 -1
- package/lib/errors/config.js +6 -6
- package/lib/errors/errors/cli.d.ts +7 -7
- package/lib/errors/errors/cli.js +20 -16
- package/lib/errors/errors/exit.d.ts +1 -4
- package/lib/errors/errors/exit.js +1 -1
- package/lib/errors/errors/module-load.d.ts +1 -4
- package/lib/errors/errors/module-load.js +1 -1
- package/lib/errors/errors/pretty-print.d.ts +1 -1
- package/lib/errors/errors/pretty-print.js +12 -10
- package/lib/errors/handle.d.ts +12 -2
- package/lib/errors/handle.js +26 -14
- package/lib/errors/index.d.ts +10 -10
- package/lib/errors/index.js +25 -24
- package/lib/errors/logger.d.ts +2 -2
- package/lib/errors/logger.js +14 -13
- package/lib/execute.d.ts +6 -6
- package/lib/execute.js +10 -9
- package/lib/flags.d.ts +103 -32
- package/lib/flags.js +79 -45
- package/lib/help/command.d.ts +16 -14
- package/lib/help/command.js +178 -163
- package/lib/help/docopts.d.ts +5 -5
- package/lib/help/docopts.js +50 -54
- package/lib/help/formatter.d.ts +37 -37
- package/lib/help/formatter.js +66 -55
- package/lib/help/index.d.ts +25 -21
- package/lib/help/index.js +169 -147
- package/lib/help/root.d.ts +1 -1
- package/lib/help/root.js +15 -17
- package/lib/help/util.d.ts +2 -8
- package/lib/help/util.js +8 -28
- package/lib/index.d.ts +19 -20
- package/lib/index.js +37 -43
- package/lib/interfaces/config.d.ts +67 -66
- package/lib/interfaces/errors.d.ts +5 -5
- package/lib/interfaces/help.d.ts +17 -17
- package/lib/interfaces/hooks.d.ts +49 -49
- package/lib/interfaces/index.d.ts +7 -7
- package/lib/interfaces/manifest.d.ts +1 -1
- package/lib/interfaces/parser.d.ts +175 -51
- package/lib/interfaces/pjson.d.ts +41 -41
- package/lib/interfaces/plugin.d.ts +47 -41
- package/lib/interfaces/s3-manifest.d.ts +7 -7
- package/lib/interfaces/topic.d.ts +1 -1
- package/lib/interfaces/ts-config.d.ts +7 -7
- package/lib/main.d.ts +2 -2
- package/lib/main.js +16 -16
- package/lib/module-loader.d.ts +67 -77
- package/lib/module-loader.js +183 -150
- package/lib/parser/errors.d.ts +7 -7
- package/lib/parser/errors.js +29 -22
- package/lib/parser/help.js +5 -5
- package/lib/parser/index.js +2 -2
- package/lib/parser/parse.d.ts +9 -6
- package/lib/parser/parse.js +253 -221
- package/lib/parser/validate.js +53 -33
- package/lib/performance.d.ts +43 -32
- package/lib/performance.js +133 -91
- package/lib/screen.js +2 -2
- package/lib/settings.d.ts +11 -12
- package/lib/settings.js +2 -2
- 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} +7 -16
- package/lib/util/util.js +98 -0
- package/package.json +35 -37
- package/lib/util.js +0 -126
- package/lib/ux/flush.d.ts +0 -1
- package/lib/ux/flush.js +0 -27
- package/lib/ux/index.d.ts +0 -64
- package/lib/ux/styled/index.d.ts +0 -6
- package/lib/ux/styled/index.js +0 -13
- package/lib/ux/styled/json.d.ts +0 -1
- package/lib/ux/styled/json.js +0 -15
- package/lib/ux/wait.js +0 -7
- package/lib/{ux → cli-ux}/action/simple.d.ts +4 -4
- package/lib/{ux → cli-ux}/action/spinners.d.ts +117 -117
- package/lib/{ux → cli-ux}/exit.d.ts +2 -2
- package/lib/{ux → cli-ux}/list.d.ts +0 -0
- package/lib/{ux → cli-ux}/styled/object.d.ts +0 -0
- package/lib/{ux → cli-ux}/styled/progress.d.ts +0 -0
- package/lib/{ux → cli-ux}/styled/progress.js +0 -0
- package/lib/{ux → cli-ux}/styled/tree.d.ts +1 -1
- /package/lib/{ux → cli-ux}/wait.d.ts +0 -0
package/lib/help/formatter.d.ts
CHANGED
|
@@ -1,20 +1,22 @@
|
|
|
1
1
|
import { Command } from '../command';
|
|
2
2
|
import * as Interfaces from '../interfaces';
|
|
3
3
|
export type HelpSectionKeyValueTable = {
|
|
4
|
-
name: string;
|
|
5
4
|
description: string;
|
|
5
|
+
name: string;
|
|
6
6
|
}[];
|
|
7
7
|
export type HelpSection = {
|
|
8
|
+
body: [string, string | undefined][] | HelpSectionKeyValueTable | string | undefined;
|
|
8
9
|
header: string;
|
|
9
|
-
body: string | HelpSectionKeyValueTable | [string, string | undefined][] | undefined;
|
|
10
10
|
} | undefined;
|
|
11
11
|
export type HelpSectionRenderer = (data: {
|
|
12
|
-
cmd: Command.Class | Command.Loadable | Command.Cached;
|
|
13
|
-
flags: Command.Flag.Any[];
|
|
14
12
|
args: Command.Arg.Any[];
|
|
13
|
+
cmd: Command.Cached | Command.Class | Command.Loadable;
|
|
14
|
+
flags: Command.Flag.Any[];
|
|
15
15
|
}, header: string) => HelpSection | HelpSection[] | string | undefined;
|
|
16
16
|
export declare class HelpFormatter {
|
|
17
|
+
protected config: Interfaces.Config;
|
|
17
18
|
indentSpacing: number;
|
|
19
|
+
protected opts: Interfaces.HelpOptions;
|
|
18
20
|
/**
|
|
19
21
|
* Takes a string and replaces `<%= prop =>` with the value of prop, where prop is anything on
|
|
20
22
|
* `config=Interfaces.Config` or `opts=Interface.HelpOptions`.
|
|
@@ -25,37 +27,6 @@ export declare class HelpFormatter {
|
|
|
25
27
|
*/
|
|
26
28
|
render: (input: string) => string;
|
|
27
29
|
constructor(config: Interfaces.Config, opts?: Partial<Interfaces.HelpOptions>);
|
|
28
|
-
protected config: Interfaces.Config;
|
|
29
|
-
protected opts: Interfaces.HelpOptions;
|
|
30
|
-
/**
|
|
31
|
-
* Wrap text according to `opts.maxWidth` which is typically set to the terminal width. All text
|
|
32
|
-
* will be rendered before bring wrapped, otherwise it could mess up the lengths.
|
|
33
|
-
*
|
|
34
|
-
* A terminal will automatically wrap text, so this method is primarily used for indented
|
|
35
|
-
* text. For indented text, specify the indentation so it is taken into account during wrapping.
|
|
36
|
-
*
|
|
37
|
-
* Here is an example of wrapping with indentation.
|
|
38
|
-
* ```
|
|
39
|
-
* <------ terminal window width ------>
|
|
40
|
-
* <---------- no indentation --------->
|
|
41
|
-
* This is my text that will be wrapped
|
|
42
|
-
* once it passes maxWidth.
|
|
43
|
-
*
|
|
44
|
-
* <- indent -><------ text space ----->
|
|
45
|
-
* This is my text that will
|
|
46
|
-
* be wrapped once it passes
|
|
47
|
-
* maxWidth.
|
|
48
|
-
*
|
|
49
|
-
* <-- indent not taken into account ->
|
|
50
|
-
* This is my text that will
|
|
51
|
-
* be wrapped
|
|
52
|
-
* once it passes maxWidth.
|
|
53
|
-
* ```
|
|
54
|
-
* @param body the text to wrap
|
|
55
|
-
* @param spacing the indentation size to subtract from the terminal width
|
|
56
|
-
* @returns the formatted wrapped text
|
|
57
|
-
*/
|
|
58
|
-
wrap(body: string, spacing?: number): string;
|
|
59
30
|
/**
|
|
60
31
|
* Indent by `this.indentSpacing`. The text should be wrap based on terminal width before indented.
|
|
61
32
|
*
|
|
@@ -89,8 +60,37 @@ export declare class HelpFormatter {
|
|
|
89
60
|
renderList(input: (string | undefined)[][], opts: {
|
|
90
61
|
indentation: number;
|
|
91
62
|
multiline?: boolean;
|
|
92
|
-
stripAnsi?: boolean;
|
|
93
63
|
spacer?: string;
|
|
64
|
+
stripAnsi?: boolean;
|
|
94
65
|
}): string;
|
|
95
|
-
section(header: string, body: string | HelpSection | HelpSectionKeyValueTable |
|
|
66
|
+
section(header: string, body: [string, string | undefined][] | HelpSection | HelpSectionKeyValueTable | string): string;
|
|
67
|
+
/**
|
|
68
|
+
* Wrap text according to `opts.maxWidth` which is typically set to the terminal width. All text
|
|
69
|
+
* will be rendered before bring wrapped, otherwise it could mess up the lengths.
|
|
70
|
+
*
|
|
71
|
+
* A terminal will automatically wrap text, so this method is primarily used for indented
|
|
72
|
+
* text. For indented text, specify the indentation so it is taken into account during wrapping.
|
|
73
|
+
*
|
|
74
|
+
* Here is an example of wrapping with indentation.
|
|
75
|
+
* ```
|
|
76
|
+
* <------ terminal window width ------>
|
|
77
|
+
* <---------- no indentation --------->
|
|
78
|
+
* This is my text that will be wrapped
|
|
79
|
+
* once it passes maxWidth.
|
|
80
|
+
*
|
|
81
|
+
* <- indent -><------ text space ----->
|
|
82
|
+
* This is my text that will
|
|
83
|
+
* be wrapped once it passes
|
|
84
|
+
* maxWidth.
|
|
85
|
+
*
|
|
86
|
+
* <-- indent not taken into account ->
|
|
87
|
+
* This is my text that will
|
|
88
|
+
* be wrapped
|
|
89
|
+
* once it passes maxWidth.
|
|
90
|
+
* ```
|
|
91
|
+
* @param body the text to wrap
|
|
92
|
+
* @param spacing the indentation size to subtract from the terminal width
|
|
93
|
+
* @returns the formatted wrapped text
|
|
94
|
+
*/
|
|
95
|
+
wrap(body: string, spacing?: number): string;
|
|
96
96
|
}
|
package/lib/help/formatter.js
CHANGED
|
@@ -1,52 +1,32 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.HelpFormatter = void 0;
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
-
const
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const chalk_1 = tslib_1.__importDefault(require("chalk"));
|
|
6
|
+
const indent_string_1 = tslib_1.__importDefault(require("indent-string"));
|
|
7
|
+
const string_width_1 = tslib_1.__importDefault(require("string-width"));
|
|
8
|
+
const strip_ansi_1 = tslib_1.__importDefault(require("strip-ansi"));
|
|
9
|
+
const widest_line_1 = tslib_1.__importDefault(require("widest-line"));
|
|
10
|
+
const wrap_ansi_1 = tslib_1.__importDefault(require("wrap-ansi"));
|
|
7
11
|
const screen_1 = require("../screen");
|
|
8
12
|
const util_1 = require("./util");
|
|
9
|
-
const width = require('string-width');
|
|
10
|
-
const widestLine = require('widest-line');
|
|
11
|
-
const wrap = require('wrap-ansi');
|
|
12
|
-
const { bold, } = Chalk;
|
|
13
13
|
class HelpFormatter {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
this.opts = { maxWidth: screen_1.stdtermwidth, ...opts };
|
|
18
|
-
this.render = (0, util_1.template)(this);
|
|
19
|
-
}
|
|
14
|
+
config;
|
|
15
|
+
indentSpacing = 2;
|
|
16
|
+
opts;
|
|
20
17
|
/**
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
* A terminal will automatically wrap text, so this method is primarily used for indented
|
|
25
|
-
* text. For indented text, specify the indentation so it is taken into account during wrapping.
|
|
26
|
-
*
|
|
27
|
-
* Here is an example of wrapping with indentation.
|
|
28
|
-
* ```
|
|
29
|
-
* <------ terminal window width ------>
|
|
30
|
-
* <---------- no indentation --------->
|
|
31
|
-
* This is my text that will be wrapped
|
|
32
|
-
* once it passes maxWidth.
|
|
18
|
+
* Takes a string and replaces `<%= prop =>` with the value of prop, where prop is anything on
|
|
19
|
+
* `config=Interfaces.Config` or `opts=Interface.HelpOptions`.
|
|
33
20
|
*
|
|
34
|
-
*
|
|
35
|
-
*
|
|
36
|
-
* be wrapped once it passes
|
|
37
|
-
* maxWidth.
|
|
38
|
-
*
|
|
39
|
-
* <-- indent not taken into account ->
|
|
40
|
-
* This is my text that will
|
|
41
|
-
* be wrapped
|
|
42
|
-
* once it passes maxWidth.
|
|
21
|
+
* ```javascript
|
|
22
|
+
* `<%= config.bin =>` // will resolve to the bin defined in `pjson.oclif`.
|
|
43
23
|
* ```
|
|
44
|
-
* @param body the text to wrap
|
|
45
|
-
* @param spacing the indentation size to subtract from the terminal width
|
|
46
|
-
* @returns the formatted wrapped text
|
|
47
24
|
*/
|
|
48
|
-
|
|
49
|
-
|
|
25
|
+
render;
|
|
26
|
+
constructor(config, opts = {}) {
|
|
27
|
+
this.config = config;
|
|
28
|
+
this.opts = { maxWidth: screen_1.stdtermwidth, ...opts };
|
|
29
|
+
this.render = (0, util_1.template)(this);
|
|
50
30
|
}
|
|
51
31
|
/**
|
|
52
32
|
* Indent by `this.indentSpacing`. The text should be wrap based on terminal width before indented.
|
|
@@ -78,7 +58,7 @@ class HelpFormatter {
|
|
|
78
58
|
* @return the formatted indented text
|
|
79
59
|
*/
|
|
80
60
|
indent(body, spacing = this.indentSpacing) {
|
|
81
|
-
return
|
|
61
|
+
return (0, indent_string_1.default)(body, spacing);
|
|
82
62
|
}
|
|
83
63
|
renderList(input, opts) {
|
|
84
64
|
if (input.length === 0) {
|
|
@@ -91,12 +71,12 @@ class HelpFormatter {
|
|
|
91
71
|
continue;
|
|
92
72
|
if (left) {
|
|
93
73
|
if (opts.stripAnsi)
|
|
94
|
-
left =
|
|
74
|
+
left = (0, strip_ansi_1.default)(left);
|
|
95
75
|
output += this.wrap(left.trim(), opts.indentation);
|
|
96
76
|
}
|
|
97
77
|
if (right) {
|
|
98
78
|
if (opts.stripAnsi)
|
|
99
|
-
right =
|
|
79
|
+
right = (0, strip_ansi_1.default)(right);
|
|
100
80
|
output += '\n';
|
|
101
81
|
output += this.indent(this.wrap(right.trim(), opts.indentation + 2), 4);
|
|
102
82
|
}
|
|
@@ -106,7 +86,7 @@ class HelpFormatter {
|
|
|
106
86
|
};
|
|
107
87
|
if (opts.multiline)
|
|
108
88
|
return renderMultiline();
|
|
109
|
-
const maxLength =
|
|
89
|
+
const maxLength = (0, widest_line_1.default)(input.map((i) => i[0]).join('\n'));
|
|
110
90
|
let output = '';
|
|
111
91
|
let spacer = opts.spacer || '\n';
|
|
112
92
|
let cur = '';
|
|
@@ -118,16 +98,16 @@ class HelpFormatter {
|
|
|
118
98
|
}
|
|
119
99
|
cur = left || '';
|
|
120
100
|
if (opts.stripAnsi)
|
|
121
|
-
cur =
|
|
101
|
+
cur = (0, strip_ansi_1.default)(cur);
|
|
122
102
|
if (!right) {
|
|
123
103
|
cur = cur.trim();
|
|
124
104
|
continue;
|
|
125
105
|
}
|
|
126
106
|
if (opts.stripAnsi)
|
|
127
|
-
right =
|
|
107
|
+
right = (0, strip_ansi_1.default)(right);
|
|
128
108
|
right = this.wrap(right.trim(), opts.indentation + maxLength + 2);
|
|
129
|
-
const [first, ...lines] = right.split('\n').map(s => s.trim());
|
|
130
|
-
cur += ' '.repeat(maxLength -
|
|
109
|
+
const [first, ...lines] = right.split('\n').map((s) => s.trim());
|
|
110
|
+
cur += ' '.repeat(maxLength - (0, string_width_1.default)(cur) + 2);
|
|
131
111
|
cur += first;
|
|
132
112
|
if (lines.length === 0) {
|
|
133
113
|
continue;
|
|
@@ -154,13 +134,13 @@ class HelpFormatter {
|
|
|
154
134
|
newBody = this.render(body);
|
|
155
135
|
}
|
|
156
136
|
else if (Array.isArray(body)) {
|
|
157
|
-
newBody = body.map(entry => {
|
|
137
|
+
newBody = body.map((entry) => {
|
|
158
138
|
if ('name' in entry) {
|
|
159
139
|
const tableEntry = entry;
|
|
160
|
-
return
|
|
140
|
+
return [this.render(tableEntry.name), this.render(tableEntry.description)];
|
|
161
141
|
}
|
|
162
142
|
const [left, right] = entry;
|
|
163
|
-
return
|
|
143
|
+
return [this.render(left), right && this.render(right)];
|
|
164
144
|
});
|
|
165
145
|
}
|
|
166
146
|
else if ('header' in body) {
|
|
@@ -168,14 +148,45 @@ class HelpFormatter {
|
|
|
168
148
|
}
|
|
169
149
|
else {
|
|
170
150
|
newBody = body
|
|
171
|
-
.map((entry) =>
|
|
172
|
-
.map(([left, right]) =>
|
|
151
|
+
.map((entry) => [entry.name, entry.description])
|
|
152
|
+
.map(([left, right]) => [this.render(left), right && this.render(right)]);
|
|
173
153
|
}
|
|
174
154
|
const output = [
|
|
175
|
-
bold(header),
|
|
176
|
-
this.indent(Array.isArray(newBody) ? this.renderList(newBody, { stripAnsi: this.opts.stripAnsi
|
|
155
|
+
chalk_1.default.bold(header),
|
|
156
|
+
this.indent(Array.isArray(newBody) ? this.renderList(newBody, { indentation: 2, stripAnsi: this.opts.stripAnsi }) : newBody),
|
|
177
157
|
].join('\n');
|
|
178
|
-
return this.opts.stripAnsi ?
|
|
158
|
+
return this.opts.stripAnsi ? (0, strip_ansi_1.default)(output) : output;
|
|
159
|
+
}
|
|
160
|
+
/**
|
|
161
|
+
* Wrap text according to `opts.maxWidth` which is typically set to the terminal width. All text
|
|
162
|
+
* will be rendered before bring wrapped, otherwise it could mess up the lengths.
|
|
163
|
+
*
|
|
164
|
+
* A terminal will automatically wrap text, so this method is primarily used for indented
|
|
165
|
+
* text. For indented text, specify the indentation so it is taken into account during wrapping.
|
|
166
|
+
*
|
|
167
|
+
* Here is an example of wrapping with indentation.
|
|
168
|
+
* ```
|
|
169
|
+
* <------ terminal window width ------>
|
|
170
|
+
* <---------- no indentation --------->
|
|
171
|
+
* This is my text that will be wrapped
|
|
172
|
+
* once it passes maxWidth.
|
|
173
|
+
*
|
|
174
|
+
* <- indent -><------ text space ----->
|
|
175
|
+
* This is my text that will
|
|
176
|
+
* be wrapped once it passes
|
|
177
|
+
* maxWidth.
|
|
178
|
+
*
|
|
179
|
+
* <-- indent not taken into account ->
|
|
180
|
+
* This is my text that will
|
|
181
|
+
* be wrapped
|
|
182
|
+
* once it passes maxWidth.
|
|
183
|
+
* ```
|
|
184
|
+
* @param body the text to wrap
|
|
185
|
+
* @param spacing the indentation size to subtract from the terminal width
|
|
186
|
+
* @returns the formatted wrapped text
|
|
187
|
+
*/
|
|
188
|
+
wrap(body, spacing = this.indentSpacing) {
|
|
189
|
+
return (0, wrap_ansi_1.default)(this.render(body), this.opts.maxWidth - spacing, { hard: true });
|
|
179
190
|
}
|
|
180
191
|
}
|
|
181
192
|
exports.HelpFormatter = HelpFormatter;
|
package/lib/help/index.d.ts
CHANGED
|
@@ -1,41 +1,45 @@
|
|
|
1
|
+
import { Command } from '../command';
|
|
1
2
|
import * as Interfaces from '../interfaces';
|
|
2
|
-
import CommandHelp from './command';
|
|
3
|
+
import { CommandHelp } from './command';
|
|
3
4
|
import { HelpFormatter } from './formatter';
|
|
4
|
-
import { Command } from '../command';
|
|
5
5
|
export { CommandHelp } from './command';
|
|
6
|
-
export {
|
|
6
|
+
export { getHelpFlagAdditions, normalizeArgv, standardizeIDFromArgv } from './util';
|
|
7
7
|
export declare abstract class HelpBase extends HelpFormatter {
|
|
8
8
|
constructor(config: Interfaces.Config, opts?: Partial<Interfaces.HelpOptions>);
|
|
9
|
-
/**
|
|
10
|
-
* Show help, used in multi-command CLIs
|
|
11
|
-
* @param args passed into your command, useful for determining which type of help to display
|
|
12
|
-
*/
|
|
13
|
-
abstract showHelp(argv: string[]): Promise<void>;
|
|
14
9
|
/**
|
|
15
10
|
* Show help for an individual command
|
|
16
11
|
* @param command
|
|
17
12
|
* @param topics
|
|
18
13
|
*/
|
|
19
14
|
abstract showCommandHelp(command: Command.Class, topics: Interfaces.Topic[]): Promise<void>;
|
|
15
|
+
/**
|
|
16
|
+
* Show help, used in multi-command CLIs
|
|
17
|
+
* @param args passed into your command, useful for determining which type of help to display
|
|
18
|
+
*/
|
|
19
|
+
abstract showHelp(argv: string[]): Promise<void>;
|
|
20
20
|
}
|
|
21
21
|
export declare class Help extends HelpBase {
|
|
22
22
|
protected CommandHelpClass: typeof CommandHelp;
|
|
23
|
-
private get _topics();
|
|
24
|
-
protected get sortedCommands(): Command.Loadable[];
|
|
25
|
-
protected get sortedTopics(): Interfaces.Topic[];
|
|
26
23
|
constructor(config: Interfaces.Config, opts?: Partial<Interfaces.HelpOptions>);
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
protected
|
|
30
|
-
protected
|
|
24
|
+
private get _topics();
|
|
25
|
+
protected command(command: Command.Class): string;
|
|
26
|
+
protected description(c: Command.Cached | Command.Class | Command.Loadable): string;
|
|
27
|
+
protected formatCommand(command: Command.Cached | Command.Class | Command.Loadable): string;
|
|
28
|
+
protected formatCommands(commands: Array<Command.Cached | Command.Class | Command.Loadable>): string;
|
|
31
29
|
protected formatRoot(): string;
|
|
32
|
-
protected formatCommand(command: Command.Class | Command.Loadable | Command.Cached): string;
|
|
33
|
-
protected getCommandHelpClass(command: Command.Class | Command.Loadable | Command.Cached): CommandHelp;
|
|
34
|
-
protected formatCommands(commands: Array<Command.Class | Command.Loadable | Command.Cached>): string;
|
|
35
|
-
protected summary(c: Command.Class | Command.Loadable | Command.Cached): string | undefined;
|
|
36
|
-
protected description(c: Command.Class | Command.Loadable | Command.Cached): string;
|
|
37
30
|
protected formatTopic(topic: Interfaces.Topic): string;
|
|
38
31
|
protected formatTopics(topics: Interfaces.Topic[]): string;
|
|
39
|
-
protected
|
|
32
|
+
protected getCommandHelpClass(command: Command.Cached | Command.Class | Command.Loadable): CommandHelp;
|
|
40
33
|
protected log(...args: string[]): void;
|
|
34
|
+
showCommandHelp(command: Command.Cached | Command.Class | Command.Loadable): Promise<void>;
|
|
35
|
+
showHelp(argv: string[]): Promise<void>;
|
|
36
|
+
protected showRootHelp(): Promise<void>;
|
|
37
|
+
protected showTopicHelp(topic: Interfaces.Topic): Promise<void>;
|
|
38
|
+
protected summary(c: Command.Cached | Command.Class | Command.Loadable): string | undefined;
|
|
39
|
+
protected get sortedCommands(): Command.Loadable[];
|
|
40
|
+
protected get sortedTopics(): Interfaces.Topic[];
|
|
41
|
+
}
|
|
42
|
+
interface HelpBaseDerived {
|
|
43
|
+
new (config: Interfaces.Config, opts?: Partial<Interfaces.HelpOptions>): HelpBase;
|
|
41
44
|
}
|
|
45
|
+
export declare function loadHelpClass(config: Interfaces.Config): Promise<HelpBaseDerived>;
|