@teambit/cli 0.0.0-387ca83bd6d05e8441bf8d4e938b4a402307cc6b
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/cli.composition.tsx +7 -0
- package/cli.docs.mdx +12 -0
- package/dist/cli-parser.d.ts +38 -0
- package/dist/cli-parser.js +379 -0
- package/dist/cli-parser.js.map +1 -0
- package/dist/cli.aspect.d.ts +4 -0
- package/dist/cli.aspect.js +22 -0
- package/dist/cli.aspect.js.map +1 -0
- package/dist/cli.cmd.d.ts +32 -0
- package/dist/cli.cmd.js +151 -0
- package/dist/cli.cmd.js.map +1 -0
- package/dist/cli.composition.d.ts +1 -0
- package/dist/cli.composition.js +29 -0
- package/dist/cli.composition.js.map +1 -0
- package/dist/cli.docs.mdx +12 -0
- package/dist/cli.main.runtime.d.ts +86 -0
- package/dist/cli.main.runtime.js +304 -0
- package/dist/cli.main.runtime.js.map +1 -0
- package/dist/command-groups.d.ts +31 -0
- package/dist/command-groups.js +44 -0
- package/dist/command-groups.js.map +1 -0
- package/dist/command-helper.d.ts +25 -0
- package/dist/command-helper.js +59 -0
- package/dist/command-helper.js.map +1 -0
- package/dist/command-runner.d.ts +35 -0
- package/dist/command-runner.js +176 -0
- package/dist/command-runner.js.map +1 -0
- package/dist/command.d.ts +130 -0
- package/dist/command.js +3 -0
- package/dist/command.js.map +1 -0
- package/dist/completion.cmd.d.ts +9 -0
- package/dist/completion.cmd.js +22 -0
- package/dist/completion.cmd.js.map +1 -0
- package/dist/default-error-handler.d.ts +12 -0
- package/dist/default-error-handler.js +81 -0
- package/dist/default-error-handler.js.map +1 -0
- package/dist/esm.mjs +17 -0
- package/dist/exceptions/already-exists.d.ts +4 -0
- package/dist/exceptions/already-exists.js +21 -0
- package/dist/exceptions/already-exists.js.map +1 -0
- package/dist/exceptions/command-not-found.d.ts +7 -0
- package/dist/exceptions/command-not-found.js +44 -0
- package/dist/exceptions/command-not-found.js.map +1 -0
- package/dist/exceptions/index.d.ts +2 -0
- package/dist/exceptions/index.js +33 -0
- package/dist/exceptions/index.js.map +1 -0
- package/dist/exceptions/yargs-exit-workaround.d.ts +6 -0
- package/dist/exceptions/yargs-exit-workaround.js +23 -0
- package/dist/exceptions/yargs-exit-workaround.js.map +1 -0
- package/dist/generate-doc-md.d.ts +25 -0
- package/dist/generate-doc-md.js +151 -0
- package/dist/generate-doc-md.js.map +1 -0
- package/dist/get-command-id.d.ts +1 -0
- package/dist/get-command-id.js +11 -0
- package/dist/get-command-id.js.map +1 -0
- package/dist/global-flags.d.ts +7 -0
- package/dist/global-flags.js +24 -0
- package/dist/global-flags.js.map +1 -0
- package/dist/handle-errors.d.ts +3 -0
- package/dist/handle-errors.js +78 -0
- package/dist/handle-errors.js.map +1 -0
- package/dist/help.cmd.d.ts +15 -0
- package/dist/help.cmd.js +36 -0
- package/dist/help.cmd.js.map +1 -0
- package/dist/help.d.ts +3 -0
- package/dist/help.js +88 -0
- package/dist/help.js.map +1 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.js +147 -0
- package/dist/index.js.map +1 -0
- package/dist/preview-1752165283597.js +7 -0
- package/dist/version.cmd.d.ts +13 -0
- package/dist/version.cmd.js +39 -0
- package/dist/version.cmd.js.map +1 -0
- package/dist/yargs-adapter.d.ts +22 -0
- package/dist/yargs-adapter.js +114 -0
- package/dist/yargs-adapter.js.map +1 -0
- package/esm.mjs +17 -0
- package/exceptions/already-exists.ts +7 -0
- package/exceptions/command-not-found.ts +22 -0
- package/exceptions/index.ts +2 -0
- package/exceptions/yargs-exit-workaround.ts +10 -0
- package/package.json +73 -0
- package/types/asset.d.ts +41 -0
- package/types/style.d.ts +42 -0
package/cli.docs.mdx
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Bit's command-line interface. Enables aspects to add and remove commands.
|
|
3
|
+
labels: ['cli', 'component']
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
CLI Aspect manages the commands in the CLI. New commands are registered to this aspect with the necessary data such as, command-name, description and flags. Parsing the args from the CLI is done by Commander package.
|
|
7
|
+
|
|
8
|
+
## Features
|
|
9
|
+
|
|
10
|
+
- Allow to register new commands
|
|
11
|
+
- Use commander commands.
|
|
12
|
+
- Render to stdout as string or as a React component by Ink.
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import yargs from 'yargs';
|
|
2
|
+
import { Command } from './command';
|
|
3
|
+
import { GroupsType } from './command-groups';
|
|
4
|
+
import { OnCommandStartSlot } from './cli.main.runtime';
|
|
5
|
+
import { CommandRunner } from './command-runner';
|
|
6
|
+
export declare class CLIParser {
|
|
7
|
+
private commands;
|
|
8
|
+
private groups;
|
|
9
|
+
private onCommandStartSlot;
|
|
10
|
+
parser: yargs.Argv<{}>;
|
|
11
|
+
private yargsCommands;
|
|
12
|
+
constructor(commands: Command[], groups: GroupsType, onCommandStartSlot: OnCommandStartSlot);
|
|
13
|
+
parse(args?: string[]): Promise<CommandRunner>;
|
|
14
|
+
private addYargsCommand;
|
|
15
|
+
private setHelpMiddleware;
|
|
16
|
+
private handleCommandFailure;
|
|
17
|
+
private configureCompletion;
|
|
18
|
+
private printHelp;
|
|
19
|
+
private configureParser;
|
|
20
|
+
private parseCommandWithSubCommands;
|
|
21
|
+
private getYargsCommand;
|
|
22
|
+
private configureGlobalFlags;
|
|
23
|
+
private throwForNonExistsCommand;
|
|
24
|
+
/**
|
|
25
|
+
* manipulate the command help output. there is no API from Yarn to do any of this, so it needs to be done manually.
|
|
26
|
+
* see https://github.com/yargs/yargs/issues/1956
|
|
27
|
+
*
|
|
28
|
+
* the original order of the output:
|
|
29
|
+
* description
|
|
30
|
+
* Options
|
|
31
|
+
* Commands
|
|
32
|
+
* Global
|
|
33
|
+
* Positionals
|
|
34
|
+
* Examples
|
|
35
|
+
*/
|
|
36
|
+
private logCommandHelp;
|
|
37
|
+
}
|
|
38
|
+
export declare function findCommandByArgv(commands: Command[]): Command | undefined;
|
|
@@ -0,0 +1,379 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.CLIParser = void 0;
|
|
7
|
+
exports.findCommandByArgv = findCommandByArgv;
|
|
8
|
+
function _didyoumean() {
|
|
9
|
+
const data = _interopRequireDefault(require("didyoumean"));
|
|
10
|
+
_didyoumean = function () {
|
|
11
|
+
return data;
|
|
12
|
+
};
|
|
13
|
+
return data;
|
|
14
|
+
}
|
|
15
|
+
function _yargs() {
|
|
16
|
+
const data = _interopRequireDefault(require("yargs"));
|
|
17
|
+
_yargs = function () {
|
|
18
|
+
return data;
|
|
19
|
+
};
|
|
20
|
+
return data;
|
|
21
|
+
}
|
|
22
|
+
function _lodash() {
|
|
23
|
+
const data = require("lodash");
|
|
24
|
+
_lodash = function () {
|
|
25
|
+
return data;
|
|
26
|
+
};
|
|
27
|
+
return data;
|
|
28
|
+
}
|
|
29
|
+
function _legacy() {
|
|
30
|
+
const data = require("@teambit/legacy.consumer");
|
|
31
|
+
_legacy = function () {
|
|
32
|
+
return data;
|
|
33
|
+
};
|
|
34
|
+
return data;
|
|
35
|
+
}
|
|
36
|
+
function _legacy2() {
|
|
37
|
+
const data = require("@teambit/legacy.logger");
|
|
38
|
+
_legacy2 = function () {
|
|
39
|
+
return data;
|
|
40
|
+
};
|
|
41
|
+
return data;
|
|
42
|
+
}
|
|
43
|
+
function _legacy3() {
|
|
44
|
+
const data = require("@teambit/legacy.loader");
|
|
45
|
+
_legacy3 = function () {
|
|
46
|
+
return data;
|
|
47
|
+
};
|
|
48
|
+
return data;
|
|
49
|
+
}
|
|
50
|
+
function _chalk() {
|
|
51
|
+
const data = _interopRequireDefault(require("chalk"));
|
|
52
|
+
_chalk = function () {
|
|
53
|
+
return data;
|
|
54
|
+
};
|
|
55
|
+
return data;
|
|
56
|
+
}
|
|
57
|
+
function _getCommandId() {
|
|
58
|
+
const data = require("./get-command-id");
|
|
59
|
+
_getCommandId = function () {
|
|
60
|
+
return data;
|
|
61
|
+
};
|
|
62
|
+
return data;
|
|
63
|
+
}
|
|
64
|
+
function _help() {
|
|
65
|
+
const data = require("./help");
|
|
66
|
+
_help = function () {
|
|
67
|
+
return data;
|
|
68
|
+
};
|
|
69
|
+
return data;
|
|
70
|
+
}
|
|
71
|
+
function _yargsAdapter() {
|
|
72
|
+
const data = require("./yargs-adapter");
|
|
73
|
+
_yargsAdapter = function () {
|
|
74
|
+
return data;
|
|
75
|
+
};
|
|
76
|
+
return data;
|
|
77
|
+
}
|
|
78
|
+
function _commandNotFound() {
|
|
79
|
+
const data = require("./exceptions/command-not-found");
|
|
80
|
+
_commandNotFound = function () {
|
|
81
|
+
return data;
|
|
82
|
+
};
|
|
83
|
+
return data;
|
|
84
|
+
}
|
|
85
|
+
function _yargsExitWorkaround() {
|
|
86
|
+
const data = require("./exceptions/yargs-exit-workaround");
|
|
87
|
+
_yargsExitWorkaround = function () {
|
|
88
|
+
return data;
|
|
89
|
+
};
|
|
90
|
+
return data;
|
|
91
|
+
}
|
|
92
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
93
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
94
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
95
|
+
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
96
|
+
class CLIParser {
|
|
97
|
+
constructor(commands, groups, onCommandStartSlot) {
|
|
98
|
+
this.commands = commands;
|
|
99
|
+
this.groups = groups;
|
|
100
|
+
this.onCommandStartSlot = onCommandStartSlot;
|
|
101
|
+
_defineProperty(this, "parser", _yargs().default);
|
|
102
|
+
_defineProperty(this, "yargsCommands", []);
|
|
103
|
+
}
|
|
104
|
+
async parse(args = process.argv.slice(2)) {
|
|
105
|
+
this.throwForNonExistsCommand(args[0]);
|
|
106
|
+
_legacy2().logger.debug(`[+] CLI-INPUT: ${args.join(' ')}`);
|
|
107
|
+
_legacy2().logger.writeCommandHistoryStart();
|
|
108
|
+
(0, _yargs().default)(args);
|
|
109
|
+
_yargs().default.help(false);
|
|
110
|
+
this.configureParser();
|
|
111
|
+
this.commands.forEach(command => {
|
|
112
|
+
if (command.commands && command.commands.length) {
|
|
113
|
+
this.parseCommandWithSubCommands(command);
|
|
114
|
+
} else {
|
|
115
|
+
const yargsCommand = this.getYargsCommand(command);
|
|
116
|
+
this.addYargsCommand(yargsCommand);
|
|
117
|
+
}
|
|
118
|
+
});
|
|
119
|
+
this.configureGlobalFlags();
|
|
120
|
+
this.setHelpMiddleware();
|
|
121
|
+
this.handleCommandFailure();
|
|
122
|
+
this.configureCompletion();
|
|
123
|
+
// yargs.showHelpOnFail(false); // doesn't help. it still shows the help on failure.
|
|
124
|
+
_yargs().default.strict(); // don't allow non-exist flags and non-exist commands
|
|
125
|
+
|
|
126
|
+
_yargs().default
|
|
127
|
+
// .recommendCommands() // don't use it, it brings the global help of yargs, we have a custom one
|
|
128
|
+
.wrap(null);
|
|
129
|
+
await _yargs().default.parse();
|
|
130
|
+
const currentYargsCommand = this.yargsCommands.find(y => y.commandRunner);
|
|
131
|
+
if (!currentYargsCommand) {
|
|
132
|
+
// this happens when the args/flags are wrong. in this case, it prints the help of the command and in most cases
|
|
133
|
+
// exits the process before reaching this line. however, in case logger.isDaemon is true, which is for bit-cli-server,
|
|
134
|
+
// it doesn't exits the process, so we need to return undefined here.
|
|
135
|
+
throw new Error(`yargs failed to parse the command "${args.join(' ')}" and also failed to catch it properly`);
|
|
136
|
+
}
|
|
137
|
+
return currentYargsCommand.commandRunner;
|
|
138
|
+
}
|
|
139
|
+
addYargsCommand(yargsCommand) {
|
|
140
|
+
this.yargsCommands.push(yargsCommand);
|
|
141
|
+
_yargs().default.command(yargsCommand);
|
|
142
|
+
}
|
|
143
|
+
setHelpMiddleware() {
|
|
144
|
+
_yargs().default.middleware(argv => {
|
|
145
|
+
if (argv._.length === 0 && argv.help) {
|
|
146
|
+
const shouldShowInternalCommands = Boolean(argv.internal);
|
|
147
|
+
// this is the main help page
|
|
148
|
+
this.printHelp(shouldShowInternalCommands);
|
|
149
|
+
process.exit(0);
|
|
150
|
+
}
|
|
151
|
+
if (argv.help) {
|
|
152
|
+
_legacy3().loader.off(); // stop the "loading bit..." before showing help if needed
|
|
153
|
+
// this is a command help page
|
|
154
|
+
_yargs().default.showHelp(this.logCommandHelp.bind(this));
|
|
155
|
+
process.exit(0);
|
|
156
|
+
}
|
|
157
|
+
}, true);
|
|
158
|
+
}
|
|
159
|
+
handleCommandFailure() {
|
|
160
|
+
_yargs().default.fail((msg, err) => {
|
|
161
|
+
_legacy3().loader.stop();
|
|
162
|
+
if (err) {
|
|
163
|
+
throw err;
|
|
164
|
+
}
|
|
165
|
+
const args = process.argv.slice(2);
|
|
166
|
+
const isHelpFlagEntered = args.includes('--help') || args.includes('-h');
|
|
167
|
+
let msgForDaemon = '';
|
|
168
|
+
try {
|
|
169
|
+
_yargs().default.showHelp(this.logCommandHelp.bind(this));
|
|
170
|
+
} catch (error) {
|
|
171
|
+
if (error instanceof _yargsExitWorkaround().YargsExitWorkaround) {
|
|
172
|
+
msgForDaemon = error.helpMsg;
|
|
173
|
+
} else {
|
|
174
|
+
throw error;
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
const isMsgAboutMissingArgs = msg.startsWith('Not enough non-option arguments');
|
|
178
|
+
// avoid showing the "Not enough non-option arguments" message when the user is trying to get the command help
|
|
179
|
+
if (!isMsgAboutMissingArgs || !isHelpFlagEntered) {
|
|
180
|
+
// eslint-disable-next-line no-console
|
|
181
|
+
console.log(`\n${_chalk().default.yellow(msg)}`);
|
|
182
|
+
msgForDaemon += `\n${_chalk().default.yellow(msg)}`;
|
|
183
|
+
}
|
|
184
|
+
if (_legacy2().logger.isDaemon) throw new (_yargsExitWorkaround().YargsExitWorkaround)(1, msgForDaemon);
|
|
185
|
+
process.exit(1);
|
|
186
|
+
});
|
|
187
|
+
}
|
|
188
|
+
configureCompletion() {
|
|
189
|
+
const commandsToShowComponentIdsForCompletion = ['show', 'diff', 'tag', 'export', 'env', 'envs', 'compile', 'build', 'test', 'lint', 'log', 'dependents', 'dependencies'];
|
|
190
|
+
// @ts-ignore
|
|
191
|
+
_yargs().default.completion('completion', async function (current, argv, completionFilter, done) {
|
|
192
|
+
if (!current.startsWith('-') && commandsToShowComponentIdsForCompletion.includes(argv._[1])) {
|
|
193
|
+
const consumer = await (0, _legacy().loadConsumerIfExist)();
|
|
194
|
+
done(consumer?.bitmapIdsFromCurrentLane.map(id => id.toStringWithoutVersion()));
|
|
195
|
+
} else {
|
|
196
|
+
completionFilter();
|
|
197
|
+
}
|
|
198
|
+
});
|
|
199
|
+
}
|
|
200
|
+
printHelp(shouldShowInternalCommands = false) {
|
|
201
|
+
const help = (0, _help().formatHelp)(this.commands, this.groups, shouldShowInternalCommands);
|
|
202
|
+
if (_legacy2().logger.isDaemon) throw new (_yargsExitWorkaround().YargsExitWorkaround)(0, help);else console.log(help); // eslint-disable-line no-console
|
|
203
|
+
}
|
|
204
|
+
configureParser() {
|
|
205
|
+
_yargs().default.parserConfiguration({
|
|
206
|
+
// 'strip-dashed': true, // we can't enable it, otherwise, the completion doesn't work
|
|
207
|
+
'strip-aliased': true,
|
|
208
|
+
'boolean-negation': false,
|
|
209
|
+
'populate--': true
|
|
210
|
+
});
|
|
211
|
+
}
|
|
212
|
+
parseCommandWithSubCommands(command) {
|
|
213
|
+
const yarnCommand = this.getYargsCommand(command);
|
|
214
|
+
const builderFunc = () => {
|
|
215
|
+
command.commands?.forEach(cmd => {
|
|
216
|
+
const subCommand = this.getYargsCommand(cmd);
|
|
217
|
+
this.addYargsCommand(subCommand);
|
|
218
|
+
});
|
|
219
|
+
// since the "builder" method is overridden, the global flags of the main command are gone, this fixes it.
|
|
220
|
+
_yargs().default.options(_yargsAdapter().YargsAdapter.getGlobalOptions(command));
|
|
221
|
+
return _yargs().default;
|
|
222
|
+
};
|
|
223
|
+
yarnCommand.builder = builderFunc;
|
|
224
|
+
this.addYargsCommand(yarnCommand);
|
|
225
|
+
}
|
|
226
|
+
getYargsCommand(command) {
|
|
227
|
+
const yargsCommand = new (_yargsAdapter().YargsAdapter)(command, this.onCommandStartSlot);
|
|
228
|
+
yargsCommand.builder = yargsCommand.builder.bind(yargsCommand);
|
|
229
|
+
yargsCommand.handler = yargsCommand.handler.bind(yargsCommand);
|
|
230
|
+
return yargsCommand;
|
|
231
|
+
}
|
|
232
|
+
configureGlobalFlags() {
|
|
233
|
+
_yargs().default.option('help', {
|
|
234
|
+
alias: 'h',
|
|
235
|
+
describe: 'show help',
|
|
236
|
+
group: _yargsAdapter().GLOBAL_GROUP
|
|
237
|
+
}).option('version', {
|
|
238
|
+
global: false,
|
|
239
|
+
alias: 'v',
|
|
240
|
+
describe: 'show version',
|
|
241
|
+
group: _yargsAdapter().GLOBAL_GROUP
|
|
242
|
+
});
|
|
243
|
+
}
|
|
244
|
+
throwForNonExistsCommand(commandName) {
|
|
245
|
+
if (!commandName || commandName.startsWith('-')) {
|
|
246
|
+
return;
|
|
247
|
+
}
|
|
248
|
+
const commandsNames = this.commands.map(c => (0, _getCommandId().getCommandId)(c.name));
|
|
249
|
+
const aliases = this.commands.map(c => c.alias).filter(a => a);
|
|
250
|
+
const existingGlobalFlags = ['-V', '--version'];
|
|
251
|
+
const validCommands = [...commandsNames, ...aliases, ...existingGlobalFlags];
|
|
252
|
+
const commandExist = validCommands.includes(commandName);
|
|
253
|
+
if (!commandExist) {
|
|
254
|
+
_didyoumean().default.returnFirstMatch = true;
|
|
255
|
+
const suggestions = (0, _didyoumean().default)(commandName, this.commands.filter(c => !c.private).map(c => (0, _getCommandId().getCommandId)(c.name)));
|
|
256
|
+
const suggestion = suggestions && Array.isArray(suggestions) ? suggestions[0] : suggestions;
|
|
257
|
+
throw new (_commandNotFound().CommandNotFound)(commandName, suggestion);
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
/**
|
|
262
|
+
* manipulate the command help output. there is no API from Yarn to do any of this, so it needs to be done manually.
|
|
263
|
+
* see https://github.com/yargs/yargs/issues/1956
|
|
264
|
+
*
|
|
265
|
+
* the original order of the output:
|
|
266
|
+
* description
|
|
267
|
+
* Options
|
|
268
|
+
* Commands
|
|
269
|
+
* Global
|
|
270
|
+
* Positionals
|
|
271
|
+
* Examples
|
|
272
|
+
*/
|
|
273
|
+
logCommandHelp(help) {
|
|
274
|
+
const command = findCommandByArgv(this.commands);
|
|
275
|
+
const lines = help.split('\n');
|
|
276
|
+
const linesWithoutEmpty = (0, _lodash().compact)(lines);
|
|
277
|
+
const cmdLine = linesWithoutEmpty[0];
|
|
278
|
+
const description = [];
|
|
279
|
+
const options = [];
|
|
280
|
+
const globalOptions = [];
|
|
281
|
+
const subCommands = [];
|
|
282
|
+
const args = [];
|
|
283
|
+
const examples = [];
|
|
284
|
+
let optionsStarted = false;
|
|
285
|
+
let globalStarted = false;
|
|
286
|
+
let subCommandsStarted = false;
|
|
287
|
+
let positionalsStarted = false;
|
|
288
|
+
let examplesStarted = false;
|
|
289
|
+
for (let i = 1; i < linesWithoutEmpty.length; i += 1) {
|
|
290
|
+
const currentLine = linesWithoutEmpty[i];
|
|
291
|
+
if (currentLine === _yargsAdapter().STANDARD_GROUP) {
|
|
292
|
+
optionsStarted = true;
|
|
293
|
+
} else if (currentLine === _yargsAdapter().GLOBAL_GROUP) {
|
|
294
|
+
globalStarted = true;
|
|
295
|
+
} else if (currentLine === 'Commands:') {
|
|
296
|
+
subCommandsStarted = true;
|
|
297
|
+
} else if (currentLine === 'Positionals:') {
|
|
298
|
+
positionalsStarted = true;
|
|
299
|
+
} else if (currentLine === 'Examples:') {
|
|
300
|
+
examplesStarted = true;
|
|
301
|
+
} else if (examplesStarted) {
|
|
302
|
+
examples.push(currentLine);
|
|
303
|
+
} else if (positionalsStarted) {
|
|
304
|
+
args.push(currentLine);
|
|
305
|
+
} else if (globalStarted) {
|
|
306
|
+
globalOptions.push(currentLine);
|
|
307
|
+
} else if (optionsStarted) {
|
|
308
|
+
options.push(currentLine);
|
|
309
|
+
} else if (subCommandsStarted) {
|
|
310
|
+
subCommands.push(currentLine);
|
|
311
|
+
} else {
|
|
312
|
+
description.push(currentLine);
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
// show the flags in green
|
|
317
|
+
const optionsColored = options.map(optLine => {
|
|
318
|
+
const match = optLine.match(/^(\s*)(.+?)(\s{2,}.*)/);
|
|
319
|
+
if (match) {
|
|
320
|
+
const leadingSpaces = match[1];
|
|
321
|
+
const optionPart = match[2];
|
|
322
|
+
const rest = match[3];
|
|
323
|
+
const coloredOptionPart = optionPart.replace(/(^|[^a-zA-Z0-9])(--?[a-zA-Z][a-zA-Z-]*)/g, (m, p1, p2) => p1 + _chalk().default.green(p2));
|
|
324
|
+
return leadingSpaces + coloredOptionPart + rest;
|
|
325
|
+
} else {
|
|
326
|
+
return optLine;
|
|
327
|
+
}
|
|
328
|
+
});
|
|
329
|
+
const argsColored = args.map(arg => arg.replace(/^ {2}\S+/, argName => _chalk().default.green(argName))); // regex: two spaces then the first word until a white space
|
|
330
|
+
const optionsStr = options.length ? `\n${_yargsAdapter().STANDARD_GROUP}\n${optionsColored.join('\n')}\n` : '';
|
|
331
|
+
const argumentsStr = args.length ? `\nArguments:\n${argsColored.join('\n')}\n` : '';
|
|
332
|
+
const examplesStr = examples.length ? `\nExamples:\n${examples.join('\n')}\n` : '';
|
|
333
|
+
const subCommandsStr = subCommands.length ? `\n${'Commands:'}\n${subCommands.join('\n')}\n` : '';
|
|
334
|
+
// show the description in bold
|
|
335
|
+
const descriptionColored = description.map(desc => _chalk().default.bold(desc));
|
|
336
|
+
if (command?.extendedDescription) {
|
|
337
|
+
descriptionColored.push(command?.extendedDescription);
|
|
338
|
+
}
|
|
339
|
+
if (command?.helpUrl) {
|
|
340
|
+
descriptionColored.push(`for more info, visit: ${_chalk().default.underline(command.helpUrl)}`);
|
|
341
|
+
}
|
|
342
|
+
const descriptionStr = descriptionColored.join('\n');
|
|
343
|
+
const globalOptionsStr = globalOptions.join('\n');
|
|
344
|
+
const finalOutput = `${cmdLine}
|
|
345
|
+
|
|
346
|
+
${descriptionStr}
|
|
347
|
+
${argumentsStr}${subCommandsStr}${optionsStr}${examplesStr}
|
|
348
|
+
${_yargsAdapter().GLOBAL_GROUP}
|
|
349
|
+
${globalOptionsStr}`;
|
|
350
|
+
if (_legacy2().logger.isDaemon) throw new (_yargsExitWorkaround().YargsExitWorkaround)(0, finalOutput);else console.log(finalOutput); // eslint-disable-line no-console
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
exports.CLIParser = CLIParser;
|
|
354
|
+
function findCommandByArgv(commands) {
|
|
355
|
+
const args = process.argv.slice(2);
|
|
356
|
+
const enteredCommand = args[0];
|
|
357
|
+
const enteredSubCommand = args[1];
|
|
358
|
+
if (!enteredCommand) {
|
|
359
|
+
return undefined;
|
|
360
|
+
}
|
|
361
|
+
const isCommandMatch = (cmd, str) => {
|
|
362
|
+
return cmd.name.startsWith(`${str} `) ||
|
|
363
|
+
// e.g. "tag <id>".startsWith("tag ")
|
|
364
|
+
cmd.name === str ||
|
|
365
|
+
// e.g. "globals" === "globals"
|
|
366
|
+
cmd.alias === str; // e.g. "t" === "t"
|
|
367
|
+
};
|
|
368
|
+
const command = commands.find(cmd => isCommandMatch(cmd, enteredCommand));
|
|
369
|
+
if (!command) {
|
|
370
|
+
return undefined;
|
|
371
|
+
}
|
|
372
|
+
if (!command.commands || !enteredSubCommand) {
|
|
373
|
+
return command; // no sub-commands.
|
|
374
|
+
}
|
|
375
|
+
const subCommand = command.commands.find(cmd => isCommandMatch(cmd, enteredSubCommand));
|
|
376
|
+
return subCommand || command;
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
//# sourceMappingURL=cli-parser.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_didyoumean","data","_interopRequireDefault","require","_yargs","_lodash","_legacy","_legacy2","_legacy3","_chalk","_getCommandId","_help","_yargsAdapter","_commandNotFound","_yargsExitWorkaround","e","__esModule","default","_defineProperty","r","t","_toPropertyKey","Object","defineProperty","value","enumerable","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","CLIParser","constructor","commands","groups","onCommandStartSlot","yargs","parse","args","process","argv","slice","throwForNonExistsCommand","logger","debug","join","writeCommandHistoryStart","help","configureParser","forEach","command","length","parseCommandWithSubCommands","yargsCommand","getYargsCommand","addYargsCommand","configureGlobalFlags","setHelpMiddleware","handleCommandFailure","configureCompletion","strict","wrap","currentYargsCommand","yargsCommands","find","y","commandRunner","Error","push","middleware","_","shouldShowInternalCommands","Boolean","internal","printHelp","exit","loader","off","showHelp","logCommandHelp","bind","fail","msg","err","stop","isHelpFlagEntered","includes","msgForDaemon","error","YargsExitWorkaround","helpMsg","isMsgAboutMissingArgs","startsWith","console","log","chalk","yellow","isDaemon","commandsToShowComponentIdsForCompletion","completion","current","completionFilter","done","consumer","loadConsumerIfExist","bitmapIdsFromCurrentLane","map","id","toStringWithoutVersion","formatHelp","parserConfiguration","yarnCommand","builderFunc","cmd","subCommand","options","YargsAdapter","getGlobalOptions","builder","handler","option","alias","describe","group","GLOBAL_GROUP","global","commandName","commandsNames","c","getCommandId","name","aliases","filter","a","existingGlobalFlags","validCommands","commandExist","didYouMean","returnFirstMatch","suggestions","private","suggestion","Array","isArray","CommandNotFound","findCommandByArgv","lines","split","linesWithoutEmpty","compact","cmdLine","description","globalOptions","subCommands","examples","optionsStarted","globalStarted","subCommandsStarted","positionalsStarted","examplesStarted","currentLine","STANDARD_GROUP","optionsColored","optLine","match","leadingSpaces","optionPart","rest","coloredOptionPart","replace","m","p1","p2","green","argsColored","arg","argName","optionsStr","argumentsStr","examplesStr","subCommandsStr","descriptionColored","desc","bold","extendedDescription","helpUrl","underline","descriptionStr","globalOptionsStr","finalOutput","exports","enteredCommand","enteredSubCommand","undefined","isCommandMatch","str"],"sources":["cli-parser.ts"],"sourcesContent":["import didYouMean from 'didyoumean';\nimport yargs from 'yargs';\nimport { Command } from './command';\nimport { GroupsType } from './command-groups';\nimport { compact } from 'lodash';\nimport { loadConsumerIfExist } from '@teambit/legacy.consumer';\nimport { logger } from '@teambit/legacy.logger';\nimport { loader } from '@teambit/legacy.loader';\nimport chalk from 'chalk';\nimport { getCommandId } from './get-command-id';\nimport { formatHelp } from './help';\nimport { GLOBAL_GROUP, STANDARD_GROUP, YargsAdapter } from './yargs-adapter';\nimport { CommandNotFound } from './exceptions/command-not-found';\nimport { OnCommandStartSlot } from './cli.main.runtime';\nimport { CommandRunner } from './command-runner';\nimport { YargsExitWorkaround } from './exceptions/yargs-exit-workaround';\n\nexport class CLIParser {\n public parser = yargs;\n private yargsCommands: YargsAdapter[] = [];\n constructor(\n private commands: Command[],\n private groups: GroupsType,\n private onCommandStartSlot: OnCommandStartSlot\n ) {}\n\n async parse(args = process.argv.slice(2)): Promise<CommandRunner> {\n this.throwForNonExistsCommand(args[0]);\n logger.debug(`[+] CLI-INPUT: ${args.join(' ')}`);\n logger.writeCommandHistoryStart();\n yargs(args);\n yargs.help(false);\n this.configureParser();\n this.commands.forEach((command: Command) => {\n if (command.commands && command.commands.length) {\n this.parseCommandWithSubCommands(command);\n } else {\n const yargsCommand = this.getYargsCommand(command);\n this.addYargsCommand(yargsCommand);\n }\n });\n this.configureGlobalFlags();\n this.setHelpMiddleware();\n this.handleCommandFailure();\n this.configureCompletion();\n // yargs.showHelpOnFail(false); // doesn't help. it still shows the help on failure.\n yargs.strict(); // don't allow non-exist flags and non-exist commands\n\n yargs\n // .recommendCommands() // don't use it, it brings the global help of yargs, we have a custom one\n .wrap(null);\n\n await yargs.parse();\n\n const currentYargsCommand = this.yargsCommands.find((y) => y.commandRunner);\n if (!currentYargsCommand) {\n // this happens when the args/flags are wrong. in this case, it prints the help of the command and in most cases\n // exits the process before reaching this line. however, in case logger.isDaemon is true, which is for bit-cli-server,\n // it doesn't exits the process, so we need to return undefined here.\n throw new Error(`yargs failed to parse the command \"${args.join(' ')}\" and also failed to catch it properly`);\n }\n return currentYargsCommand.commandRunner as CommandRunner;\n }\n\n private addYargsCommand(yargsCommand: YargsAdapter) {\n this.yargsCommands.push(yargsCommand);\n yargs.command(yargsCommand);\n }\n\n private setHelpMiddleware() {\n yargs.middleware((argv) => {\n if (argv._.length === 0 && argv.help) {\n const shouldShowInternalCommands = Boolean(argv.internal);\n // this is the main help page\n this.printHelp(shouldShowInternalCommands);\n process.exit(0);\n }\n if (argv.help) {\n loader.off(); // stop the \"loading bit...\" before showing help if needed\n // this is a command help page\n yargs.showHelp(this.logCommandHelp.bind(this));\n process.exit(0);\n }\n }, true);\n }\n\n private handleCommandFailure() {\n yargs.fail((msg, err) => {\n loader.stop();\n if (err) {\n throw err;\n }\n const args = process.argv.slice(2);\n const isHelpFlagEntered = args.includes('--help') || args.includes('-h');\n let msgForDaemon = '';\n try {\n yargs.showHelp(this.logCommandHelp.bind(this));\n } catch (error: any) {\n if (error instanceof YargsExitWorkaround) {\n msgForDaemon = error.helpMsg;\n } else {\n throw error;\n }\n }\n const isMsgAboutMissingArgs = msg.startsWith('Not enough non-option arguments');\n // avoid showing the \"Not enough non-option arguments\" message when the user is trying to get the command help\n if (!isMsgAboutMissingArgs || !isHelpFlagEntered) {\n // eslint-disable-next-line no-console\n console.log(`\\n${chalk.yellow(msg)}`);\n msgForDaemon += `\\n${chalk.yellow(msg)}`;\n }\n if (logger.isDaemon) throw new YargsExitWorkaround(1, msgForDaemon);\n process.exit(1);\n });\n }\n\n private configureCompletion() {\n const commandsToShowComponentIdsForCompletion = [\n 'show',\n 'diff',\n 'tag',\n 'export',\n 'env',\n 'envs',\n 'compile',\n 'build',\n 'test',\n 'lint',\n 'log',\n 'dependents',\n 'dependencies',\n ];\n // @ts-ignore\n yargs.completion('completion', async function (current, argv, completionFilter, done) {\n if (!current.startsWith('-') && commandsToShowComponentIdsForCompletion.includes(argv._[1])) {\n const consumer = await loadConsumerIfExist();\n done(consumer?.bitmapIdsFromCurrentLane.map((id) => id.toStringWithoutVersion()));\n } else {\n completionFilter();\n }\n });\n }\n\n private printHelp(shouldShowInternalCommands = false) {\n const help = formatHelp(this.commands, this.groups, shouldShowInternalCommands);\n if (logger.isDaemon) throw new YargsExitWorkaround(0, help);\n else console.log(help); // eslint-disable-line no-console\n }\n\n private configureParser() {\n yargs.parserConfiguration({\n // 'strip-dashed': true, // we can't enable it, otherwise, the completion doesn't work\n 'strip-aliased': true,\n 'boolean-negation': false,\n 'populate--': true,\n });\n }\n\n private parseCommandWithSubCommands(command: Command) {\n const yarnCommand = this.getYargsCommand(command);\n const builderFunc = () => {\n command.commands?.forEach((cmd) => {\n const subCommand = this.getYargsCommand(cmd);\n this.addYargsCommand(subCommand);\n });\n // since the \"builder\" method is overridden, the global flags of the main command are gone, this fixes it.\n yargs.options(YargsAdapter.getGlobalOptions(command));\n return yargs;\n };\n yarnCommand.builder = builderFunc;\n this.addYargsCommand(yarnCommand);\n }\n\n private getYargsCommand(command: Command): YargsAdapter {\n const yargsCommand = new YargsAdapter(command, this.onCommandStartSlot);\n yargsCommand.builder = yargsCommand.builder.bind(yargsCommand);\n yargsCommand.handler = yargsCommand.handler.bind(yargsCommand);\n\n return yargsCommand;\n }\n\n private configureGlobalFlags() {\n yargs\n .option('help', {\n alias: 'h',\n describe: 'show help',\n group: GLOBAL_GROUP,\n })\n .option('version', {\n global: false,\n alias: 'v',\n describe: 'show version',\n group: GLOBAL_GROUP,\n });\n }\n\n private throwForNonExistsCommand(commandName: string) {\n if (!commandName || commandName.startsWith('-')) {\n return;\n }\n const commandsNames = this.commands.map((c) => getCommandId(c.name));\n const aliases = this.commands.map((c) => c.alias).filter((a) => a);\n const existingGlobalFlags = ['-V', '--version'];\n const validCommands = [...commandsNames, ...aliases, ...existingGlobalFlags];\n const commandExist = validCommands.includes(commandName);\n\n if (!commandExist) {\n didYouMean.returnFirstMatch = true;\n const suggestions = didYouMean(\n commandName,\n this.commands.filter((c) => !c.private).map((c) => getCommandId(c.name))\n );\n const suggestion = suggestions && Array.isArray(suggestions) ? suggestions[0] : suggestions;\n\n throw new CommandNotFound(commandName, suggestion as string);\n }\n }\n\n /**\n * manipulate the command help output. there is no API from Yarn to do any of this, so it needs to be done manually.\n * see https://github.com/yargs/yargs/issues/1956\n *\n * the original order of the output:\n * description\n * Options\n * Commands\n * Global\n * Positionals\n * Examples\n */\n private logCommandHelp(help: string) {\n const command = findCommandByArgv(this.commands);\n\n const lines = help.split('\\n');\n const linesWithoutEmpty = compact(lines);\n const cmdLine = linesWithoutEmpty[0];\n const description: string[] = [];\n const options: string[] = [];\n const globalOptions: string[] = [];\n const subCommands: string[] = [];\n const args: string[] = [];\n const examples: string[] = [];\n\n let optionsStarted = false;\n let globalStarted = false;\n let subCommandsStarted = false;\n let positionalsStarted = false;\n let examplesStarted = false;\n for (let i = 1; i < linesWithoutEmpty.length; i += 1) {\n const currentLine = linesWithoutEmpty[i];\n if (currentLine === STANDARD_GROUP) {\n optionsStarted = true;\n } else if (currentLine === GLOBAL_GROUP) {\n globalStarted = true;\n } else if (currentLine === 'Commands:') {\n subCommandsStarted = true;\n } else if (currentLine === 'Positionals:') {\n positionalsStarted = true;\n } else if (currentLine === 'Examples:') {\n examplesStarted = true;\n } else if (examplesStarted) {\n examples.push(currentLine);\n } else if (positionalsStarted) {\n args.push(currentLine);\n } else if (globalStarted) {\n globalOptions.push(currentLine);\n } else if (optionsStarted) {\n options.push(currentLine);\n } else if (subCommandsStarted) {\n subCommands.push(currentLine);\n } else {\n description.push(currentLine);\n }\n }\n\n // show the flags in green\n const optionsColored = options.map((optLine) => {\n const match = optLine.match(/^(\\s*)(.+?)(\\s{2,}.*)/);\n if (match) {\n const leadingSpaces = match[1];\n const optionPart = match[2];\n const rest = match[3];\n const coloredOptionPart = optionPart.replace(\n /(^|[^a-zA-Z0-9])(--?[a-zA-Z][a-zA-Z-]*)/g,\n (m, p1, p2) => p1 + chalk.green(p2)\n );\n return leadingSpaces + coloredOptionPart + rest;\n } else {\n return optLine;\n }\n });\n const argsColored = args.map((arg) => arg.replace(/^ {2}\\S+/, (argName) => chalk.green(argName))); // regex: two spaces then the first word until a white space\n const optionsStr = options.length ? `\\n${STANDARD_GROUP}\\n${optionsColored.join('\\n')}\\n` : '';\n const argumentsStr = args.length ? `\\nArguments:\\n${argsColored.join('\\n')}\\n` : '';\n const examplesStr = examples.length ? `\\nExamples:\\n${examples.join('\\n')}\\n` : '';\n const subCommandsStr = subCommands.length ? `\\n${'Commands:'}\\n${subCommands.join('\\n')}\\n` : '';\n // show the description in bold\n const descriptionColored = description.map((desc) => chalk.bold(desc));\n if (command?.extendedDescription) {\n descriptionColored.push(command?.extendedDescription);\n }\n if (command?.helpUrl) {\n descriptionColored.push(`for more info, visit: ${chalk.underline(command.helpUrl)}`);\n }\n const descriptionStr = descriptionColored.join('\\n');\n const globalOptionsStr = globalOptions.join('\\n');\n\n const finalOutput = `${cmdLine}\n\n${descriptionStr}\n${argumentsStr}${subCommandsStr}${optionsStr}${examplesStr}\n${GLOBAL_GROUP}\n${globalOptionsStr}`;\n\n if (logger.isDaemon) throw new YargsExitWorkaround(0, finalOutput);\n else console.log(finalOutput); // eslint-disable-line no-console\n }\n}\n\nexport function findCommandByArgv(commands: Command[]): Command | undefined {\n const args = process.argv.slice(2);\n const enteredCommand = args[0];\n const enteredSubCommand = args[1];\n if (!enteredCommand) {\n return undefined;\n }\n const isCommandMatch = (cmd: Command, str: string) => {\n return (\n cmd.name.startsWith(`${str} `) || // e.g. \"tag <id>\".startsWith(\"tag \")\n cmd.name === str || // e.g. \"globals\" === \"globals\"\n cmd.alias === str\n ); // e.g. \"t\" === \"t\"\n };\n const command = commands.find((cmd) => isCommandMatch(cmd, enteredCommand));\n if (!command) {\n return undefined;\n }\n if (!command.commands || !enteredSubCommand) {\n return command; // no sub-commands.\n }\n const subCommand = command.commands.find((cmd) => isCommandMatch(cmd, enteredSubCommand));\n return subCommand || command;\n}\n"],"mappings":";;;;;;;AAAA,SAAAA,YAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,WAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,OAAA;EAAA,MAAAH,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAC,MAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAGA,SAAAI,QAAA;EAAA,MAAAJ,IAAA,GAAAE,OAAA;EAAAE,OAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAK,QAAA;EAAA,MAAAL,IAAA,GAAAE,OAAA;EAAAG,OAAA,YAAAA,CAAA;IAAA,OAAAL,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAM,SAAA;EAAA,MAAAN,IAAA,GAAAE,OAAA;EAAAI,QAAA,YAAAA,CAAA;IAAA,OAAAN,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAO,SAAA;EAAA,MAAAP,IAAA,GAAAE,OAAA;EAAAK,QAAA,YAAAA,CAAA;IAAA,OAAAP,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAQ,OAAA;EAAA,MAAAR,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAM,MAAA,YAAAA,CAAA;IAAA,OAAAR,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAS,cAAA;EAAA,MAAAT,IAAA,GAAAE,OAAA;EA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|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = exports.MainRuntime = exports.CLIAspect = void 0;
|
|
7
|
+
function _harmony() {
|
|
8
|
+
const data = require("@teambit/harmony");
|
|
9
|
+
_harmony = function () {
|
|
10
|
+
return data;
|
|
11
|
+
};
|
|
12
|
+
return data;
|
|
13
|
+
}
|
|
14
|
+
const MainRuntime = exports.MainRuntime = new (_harmony().RuntimeDefinition)('main');
|
|
15
|
+
const CLIAspect = exports.CLIAspect = _harmony().Aspect.create({
|
|
16
|
+
id: 'teambit.harmony/cli',
|
|
17
|
+
dependencies: [],
|
|
18
|
+
declareRuntime: MainRuntime
|
|
19
|
+
});
|
|
20
|
+
var _default = exports.default = CLIAspect;
|
|
21
|
+
|
|
22
|
+
//# sourceMappingURL=cli.aspect.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_harmony","data","require","MainRuntime","exports","RuntimeDefinition","CLIAspect","Aspect","create","id","dependencies","declareRuntime","_default","default"],"sources":["cli.aspect.ts"],"sourcesContent":["import { Aspect, RuntimeDefinition } from '@teambit/harmony';\n\nexport const MainRuntime = new RuntimeDefinition('main');\n\nexport const CLIAspect = Aspect.create({\n id: 'teambit.harmony/cli',\n dependencies: [],\n declareRuntime: MainRuntime,\n});\n\nexport default CLIAspect;\n"],"mappings":";;;;;;AAAA,SAAAA,SAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,QAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEO,MAAME,WAAW,GAAAC,OAAA,CAAAD,WAAA,GAAG,KAAIE,4BAAiB,EAAC,MAAM,CAAC;AAEjD,MAAMC,SAAS,GAAAF,OAAA,CAAAE,SAAA,GAAGC,iBAAM,CAACC,MAAM,CAAC;EACrCC,EAAE,EAAE,qBAAqB;EACzBC,YAAY,EAAE,EAAE;EAChBC,cAAc,EAAER;AAClB,CAAC,CAAC;AAAC,IAAAS,QAAA,GAAAR,OAAA,CAAAS,OAAA,GAEYP,SAAS","ignoreList":[]}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { Command, CommandOptions } from './command';
|
|
2
|
+
import { CLIMain } from './cli.main.runtime';
|
|
3
|
+
import { GenerateOpts } from './generate-doc-md';
|
|
4
|
+
export declare class CliGenerateCmd implements Command {
|
|
5
|
+
private cliMain;
|
|
6
|
+
name: string;
|
|
7
|
+
description: string;
|
|
8
|
+
alias: string;
|
|
9
|
+
loader: boolean;
|
|
10
|
+
group: string;
|
|
11
|
+
options: CommandOptions;
|
|
12
|
+
private: boolean;
|
|
13
|
+
constructor(cliMain: CLIMain);
|
|
14
|
+
report(args: any, { metadata, docs }: GenerateOpts & {
|
|
15
|
+
docs?: boolean;
|
|
16
|
+
}): Promise<string>;
|
|
17
|
+
json(): Promise<(Partial<Command> & {
|
|
18
|
+
commands?: any;
|
|
19
|
+
})[]>;
|
|
20
|
+
}
|
|
21
|
+
export declare class CliCmd implements Command {
|
|
22
|
+
private cliMain;
|
|
23
|
+
name: string;
|
|
24
|
+
description: string;
|
|
25
|
+
alias: string;
|
|
26
|
+
commands: Command[];
|
|
27
|
+
loader: boolean;
|
|
28
|
+
group: string;
|
|
29
|
+
options: CommandOptions;
|
|
30
|
+
constructor(cliMain: CLIMain);
|
|
31
|
+
report(): Promise<string>;
|
|
32
|
+
}
|