@h3ravel/musket 0.1.0 → 0.1.2
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 +1 -1
- package/dist/index.cjs +955 -0
- package/dist/index.d.cts +311 -0
- package/dist/index.d.ts +311 -0
- package/dist/index.js +922 -0
- package/package.json +1 -1
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,311 @@
|
|
|
1
|
+
import * as commander0 from "commander";
|
|
2
|
+
import { Argument, Command as Command$1 } from "commander";
|
|
3
|
+
import { XGeneric } from "@h3ravel/support";
|
|
4
|
+
import { Options } from "tsdown";
|
|
5
|
+
|
|
6
|
+
//#region src/Contracts/ICommand.d.ts
|
|
7
|
+
type CommandOption = {
|
|
8
|
+
name: string;
|
|
9
|
+
shared?: boolean;
|
|
10
|
+
required?: boolean;
|
|
11
|
+
multiple?: boolean;
|
|
12
|
+
placeholder?: string;
|
|
13
|
+
description?: string;
|
|
14
|
+
defaultValue?: string | number | boolean | undefined | string[];
|
|
15
|
+
choices?: string[];
|
|
16
|
+
argParser?: (...args: []) => any;
|
|
17
|
+
/**
|
|
18
|
+
* for options like --Q|queue
|
|
19
|
+
*/
|
|
20
|
+
flags?: string[];
|
|
21
|
+
/**
|
|
22
|
+
* true if it's a flag option
|
|
23
|
+
*/
|
|
24
|
+
isFlag?: boolean;
|
|
25
|
+
/**
|
|
26
|
+
* true if name begins with '#' or '^'
|
|
27
|
+
*/
|
|
28
|
+
isHidden?: boolean;
|
|
29
|
+
/**
|
|
30
|
+
* for nested options
|
|
31
|
+
*/
|
|
32
|
+
nestedOptions?: CommandOption[];
|
|
33
|
+
};
|
|
34
|
+
type ParsedCommand = {
|
|
35
|
+
commandClass: Command;
|
|
36
|
+
baseCommand: string;
|
|
37
|
+
description?: string;
|
|
38
|
+
/**
|
|
39
|
+
* true if baseCommand begins with '#' or '^'
|
|
40
|
+
*/
|
|
41
|
+
isHidden?: boolean;
|
|
42
|
+
/**
|
|
43
|
+
* true if baseCommand ends with ':'
|
|
44
|
+
*/
|
|
45
|
+
isNamespaceCommand: boolean;
|
|
46
|
+
/**
|
|
47
|
+
* for colon-ended commands
|
|
48
|
+
*/
|
|
49
|
+
subCommands?: CommandOption[];
|
|
50
|
+
/**
|
|
51
|
+
* for normal commands
|
|
52
|
+
*/
|
|
53
|
+
options?: CommandOption[];
|
|
54
|
+
};
|
|
55
|
+
interface InitConfig {
|
|
56
|
+
/**
|
|
57
|
+
* ASCII Art style logo
|
|
58
|
+
*/
|
|
59
|
+
logo?: string;
|
|
60
|
+
/**
|
|
61
|
+
* The name of the CLI app we're building
|
|
62
|
+
*
|
|
63
|
+
* @default musket
|
|
64
|
+
*/
|
|
65
|
+
cliName?: string;
|
|
66
|
+
/**
|
|
67
|
+
* Don't parse the command, usefull for testing or manual control
|
|
68
|
+
*/
|
|
69
|
+
skipParsing?: boolean;
|
|
70
|
+
/**
|
|
71
|
+
* A callback function that should resolve the handle method of every command
|
|
72
|
+
*
|
|
73
|
+
* @param cmd
|
|
74
|
+
* @param met
|
|
75
|
+
* @returns
|
|
76
|
+
*/
|
|
77
|
+
resolver?: <X>(cmd: X, met: string) => Promise<X>;
|
|
78
|
+
/**
|
|
79
|
+
* Packages that should show up up when the `-V` flag is passed
|
|
80
|
+
*/
|
|
81
|
+
packages?: string[] | {
|
|
82
|
+
name: string;
|
|
83
|
+
alias: string;
|
|
84
|
+
}[];
|
|
85
|
+
/**
|
|
86
|
+
* If set to true, information about musket CLI like name and
|
|
87
|
+
* version info will not be unexpectedly shown in console
|
|
88
|
+
*/
|
|
89
|
+
hideMusketInfo?: boolean;
|
|
90
|
+
/**
|
|
91
|
+
* Commands that should be autoloaded by default
|
|
92
|
+
*/
|
|
93
|
+
baseCommands?: typeof Command[];
|
|
94
|
+
/**
|
|
95
|
+
* Paths where musket can search and auto discover commands
|
|
96
|
+
*
|
|
97
|
+
*
|
|
98
|
+
* @example 'Console/Commands/*.js'
|
|
99
|
+
* @example 'dist/app/Console/Commands/*.js'
|
|
100
|
+
* @example ['Console/Commands/*.js', 'src/app/Commands/*.js']
|
|
101
|
+
*/
|
|
102
|
+
discoveryPaths?: string | string[];
|
|
103
|
+
}
|
|
104
|
+
//#endregion
|
|
105
|
+
//#region src/Core/Kernel.d.ts
|
|
106
|
+
declare class Kernel {
|
|
107
|
+
app: Application;
|
|
108
|
+
cwd: string;
|
|
109
|
+
output: "string" | "number" | "bigint" | "boolean" | "symbol" | "undefined" | "object" | "function";
|
|
110
|
+
modules: XGeneric<{
|
|
111
|
+
version: string;
|
|
112
|
+
name: string;
|
|
113
|
+
}>[];
|
|
114
|
+
basePath: string;
|
|
115
|
+
packages: NonNullable<InitConfig['packages']>;
|
|
116
|
+
private config;
|
|
117
|
+
constructor(app: Application);
|
|
118
|
+
ensureDirectoryExists(dir: string): Promise<void>;
|
|
119
|
+
static init(app: Application, config?: InitConfig): Promise<commander0.Command>;
|
|
120
|
+
private run;
|
|
121
|
+
private loadRequirements;
|
|
122
|
+
}
|
|
123
|
+
//#endregion
|
|
124
|
+
//#region src/Core/Command.d.ts
|
|
125
|
+
declare class Command {
|
|
126
|
+
protected app: Application;
|
|
127
|
+
protected kernel: Kernel;
|
|
128
|
+
constructor(app: Application, kernel: Kernel);
|
|
129
|
+
/**
|
|
130
|
+
* The underlying commander instance.
|
|
131
|
+
*
|
|
132
|
+
* @var Command
|
|
133
|
+
*/
|
|
134
|
+
program: Command$1;
|
|
135
|
+
/**
|
|
136
|
+
* The name and signature of the console command.
|
|
137
|
+
*
|
|
138
|
+
* @var string
|
|
139
|
+
*/
|
|
140
|
+
protected signature: string;
|
|
141
|
+
/**
|
|
142
|
+
* A dictionary of signatures or what not.
|
|
143
|
+
*
|
|
144
|
+
* @var object
|
|
145
|
+
*/
|
|
146
|
+
protected dictionary: Record<string, any>;
|
|
147
|
+
/**
|
|
148
|
+
* The console command description.
|
|
149
|
+
*
|
|
150
|
+
* @var string
|
|
151
|
+
*/
|
|
152
|
+
protected description?: string;
|
|
153
|
+
/**
|
|
154
|
+
* The console command input.
|
|
155
|
+
*
|
|
156
|
+
* @var object
|
|
157
|
+
*/
|
|
158
|
+
private input;
|
|
159
|
+
/**
|
|
160
|
+
* Execute the console command.
|
|
161
|
+
*/
|
|
162
|
+
handle(..._args: any[]): Promise<void>;
|
|
163
|
+
setApplication(app: Application): void;
|
|
164
|
+
setInput(options: XGeneric, args: string[], regArgs: readonly Argument[], dictionary: Record<string, any>, program: Command$1): this;
|
|
165
|
+
setOption(key: string, value: unknown): this;
|
|
166
|
+
setProgram(program: Command$1): this;
|
|
167
|
+
getSignature(): string;
|
|
168
|
+
getDescription(): string | undefined;
|
|
169
|
+
option(key: string, def?: any): any;
|
|
170
|
+
options(key?: string): any;
|
|
171
|
+
argument(key: string, def?: any): any;
|
|
172
|
+
arguments(): Record<string, any>;
|
|
173
|
+
loadBaseFlags(): void;
|
|
174
|
+
/**
|
|
175
|
+
* Check if the command is quiet
|
|
176
|
+
*
|
|
177
|
+
* @returns
|
|
178
|
+
*/
|
|
179
|
+
isQuiet(): any;
|
|
180
|
+
/**
|
|
181
|
+
* Check if the command is silent
|
|
182
|
+
*
|
|
183
|
+
* @returns
|
|
184
|
+
*/
|
|
185
|
+
isSilent(): any;
|
|
186
|
+
/**
|
|
187
|
+
* Check if the command is non interactive
|
|
188
|
+
*
|
|
189
|
+
* @returns
|
|
190
|
+
*/
|
|
191
|
+
isNonInteractive(): boolean;
|
|
192
|
+
/**
|
|
193
|
+
* Get the verbosity of the command
|
|
194
|
+
*
|
|
195
|
+
* @returns
|
|
196
|
+
*/
|
|
197
|
+
getVerbosity(): number;
|
|
198
|
+
/**
|
|
199
|
+
* Log an info message
|
|
200
|
+
*/
|
|
201
|
+
info(message: string): this;
|
|
202
|
+
/**
|
|
203
|
+
* Log a warning message
|
|
204
|
+
*/
|
|
205
|
+
warn(message: string): this;
|
|
206
|
+
/**
|
|
207
|
+
* Log a line message
|
|
208
|
+
*/
|
|
209
|
+
line(message: string): this;
|
|
210
|
+
/**
|
|
211
|
+
* Log a new line
|
|
212
|
+
*/
|
|
213
|
+
newLine(count?: number): this;
|
|
214
|
+
/**
|
|
215
|
+
* Log a success message
|
|
216
|
+
*/
|
|
217
|
+
success(message: string): this;
|
|
218
|
+
/**
|
|
219
|
+
* Log an error message
|
|
220
|
+
*/
|
|
221
|
+
error(message: string): this;
|
|
222
|
+
/**
|
|
223
|
+
* Log an error message and terminate execution of the command
|
|
224
|
+
* return an exit code of 1
|
|
225
|
+
*
|
|
226
|
+
* This method is not chainable
|
|
227
|
+
*/
|
|
228
|
+
fail(message: string): void;
|
|
229
|
+
/**
|
|
230
|
+
* Log a debug message
|
|
231
|
+
*/
|
|
232
|
+
debug(message: string | string[]): this;
|
|
233
|
+
}
|
|
234
|
+
//#endregion
|
|
235
|
+
//#region src/Musket.d.ts
|
|
236
|
+
declare class Musket {
|
|
237
|
+
private app;
|
|
238
|
+
private kernel;
|
|
239
|
+
private baseCommands;
|
|
240
|
+
private resolver?;
|
|
241
|
+
private tsDownConfig;
|
|
242
|
+
/**
|
|
243
|
+
* The name of the CLI app we're building
|
|
244
|
+
*
|
|
245
|
+
* @default musket
|
|
246
|
+
*/
|
|
247
|
+
cliName: string;
|
|
248
|
+
private config;
|
|
249
|
+
private commands;
|
|
250
|
+
constructor(app: Application, kernel: Kernel, baseCommands?: Command[], resolver?: (<X>(cmd: X, met: string) => Promise<X>) | undefined, tsDownConfig?: Options);
|
|
251
|
+
build(): Promise<Command$1>;
|
|
252
|
+
private loadBaseCommands;
|
|
253
|
+
/**
|
|
254
|
+
* Provide the configuration to initialize the CLI with
|
|
255
|
+
*
|
|
256
|
+
* @param config
|
|
257
|
+
* @returns
|
|
258
|
+
*/
|
|
259
|
+
configure(config: InitConfig): this;
|
|
260
|
+
/**
|
|
261
|
+
* Set the paths where the cli can search and auto discover commands
|
|
262
|
+
*
|
|
263
|
+
* @param paths
|
|
264
|
+
*
|
|
265
|
+
* @example instance.discoverCommandsFrom('Console/Commands/*.js')
|
|
266
|
+
* @example instance.discoverCommandsFrom(['Console/Commands/*.js', 'App/Commands/*.js'])
|
|
267
|
+
*
|
|
268
|
+
* @returns the current cli intance
|
|
269
|
+
*/
|
|
270
|
+
discoverCommandsFrom(paths: string | string[]): this;
|
|
271
|
+
private loadDiscoveredCommands;
|
|
272
|
+
addCommand(command: Command): void;
|
|
273
|
+
private initialize;
|
|
274
|
+
rebuild(name: string): Promise<void>;
|
|
275
|
+
private makeOption;
|
|
276
|
+
private handle;
|
|
277
|
+
static parse(kernel: Kernel, config?: InitConfig): Promise<Command$1>;
|
|
278
|
+
}
|
|
279
|
+
//#endregion
|
|
280
|
+
//#region src/Contracts/Application.d.ts
|
|
281
|
+
declare class Application {
|
|
282
|
+
/**
|
|
283
|
+
* The current musket CLI Instance
|
|
284
|
+
*/
|
|
285
|
+
musket?: Musket;
|
|
286
|
+
/**
|
|
287
|
+
* Registered commands will be preloaded
|
|
288
|
+
*/
|
|
289
|
+
registeredCommands?: typeof Command[];
|
|
290
|
+
}
|
|
291
|
+
//#endregion
|
|
292
|
+
//#region src/Signature.d.ts
|
|
293
|
+
declare class Signature {
|
|
294
|
+
/**
|
|
295
|
+
* Helper to parse options inside a block of text
|
|
296
|
+
*
|
|
297
|
+
* @param block
|
|
298
|
+
* @returns
|
|
299
|
+
*/
|
|
300
|
+
static parseOptions(block: string): CommandOption[];
|
|
301
|
+
/**
|
|
302
|
+
* Helper to parse a command's signature
|
|
303
|
+
*
|
|
304
|
+
* @param signature
|
|
305
|
+
* @param commandClass
|
|
306
|
+
* @returns
|
|
307
|
+
*/
|
|
308
|
+
static parseSignature(signature: string, commandClass: Command): ParsedCommand;
|
|
309
|
+
}
|
|
310
|
+
//#endregion
|
|
311
|
+
export { Application, Command, CommandOption, InitConfig, Kernel, Musket, ParsedCommand, Signature };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,311 @@
|
|
|
1
|
+
import * as commander0 from "commander";
|
|
2
|
+
import { Argument, Command as Command$1 } from "commander";
|
|
3
|
+
import { Options } from "tsdown";
|
|
4
|
+
import { XGeneric } from "@h3ravel/support";
|
|
5
|
+
|
|
6
|
+
//#region src/Contracts/ICommand.d.ts
|
|
7
|
+
type CommandOption = {
|
|
8
|
+
name: string;
|
|
9
|
+
shared?: boolean;
|
|
10
|
+
required?: boolean;
|
|
11
|
+
multiple?: boolean;
|
|
12
|
+
placeholder?: string;
|
|
13
|
+
description?: string;
|
|
14
|
+
defaultValue?: string | number | boolean | undefined | string[];
|
|
15
|
+
choices?: string[];
|
|
16
|
+
argParser?: (...args: []) => any;
|
|
17
|
+
/**
|
|
18
|
+
* for options like --Q|queue
|
|
19
|
+
*/
|
|
20
|
+
flags?: string[];
|
|
21
|
+
/**
|
|
22
|
+
* true if it's a flag option
|
|
23
|
+
*/
|
|
24
|
+
isFlag?: boolean;
|
|
25
|
+
/**
|
|
26
|
+
* true if name begins with '#' or '^'
|
|
27
|
+
*/
|
|
28
|
+
isHidden?: boolean;
|
|
29
|
+
/**
|
|
30
|
+
* for nested options
|
|
31
|
+
*/
|
|
32
|
+
nestedOptions?: CommandOption[];
|
|
33
|
+
};
|
|
34
|
+
type ParsedCommand = {
|
|
35
|
+
commandClass: Command;
|
|
36
|
+
baseCommand: string;
|
|
37
|
+
description?: string;
|
|
38
|
+
/**
|
|
39
|
+
* true if baseCommand begins with '#' or '^'
|
|
40
|
+
*/
|
|
41
|
+
isHidden?: boolean;
|
|
42
|
+
/**
|
|
43
|
+
* true if baseCommand ends with ':'
|
|
44
|
+
*/
|
|
45
|
+
isNamespaceCommand: boolean;
|
|
46
|
+
/**
|
|
47
|
+
* for colon-ended commands
|
|
48
|
+
*/
|
|
49
|
+
subCommands?: CommandOption[];
|
|
50
|
+
/**
|
|
51
|
+
* for normal commands
|
|
52
|
+
*/
|
|
53
|
+
options?: CommandOption[];
|
|
54
|
+
};
|
|
55
|
+
interface InitConfig {
|
|
56
|
+
/**
|
|
57
|
+
* ASCII Art style logo
|
|
58
|
+
*/
|
|
59
|
+
logo?: string;
|
|
60
|
+
/**
|
|
61
|
+
* The name of the CLI app we're building
|
|
62
|
+
*
|
|
63
|
+
* @default musket
|
|
64
|
+
*/
|
|
65
|
+
cliName?: string;
|
|
66
|
+
/**
|
|
67
|
+
* Don't parse the command, usefull for testing or manual control
|
|
68
|
+
*/
|
|
69
|
+
skipParsing?: boolean;
|
|
70
|
+
/**
|
|
71
|
+
* A callback function that should resolve the handle method of every command
|
|
72
|
+
*
|
|
73
|
+
* @param cmd
|
|
74
|
+
* @param met
|
|
75
|
+
* @returns
|
|
76
|
+
*/
|
|
77
|
+
resolver?: <X>(cmd: X, met: string) => Promise<X>;
|
|
78
|
+
/**
|
|
79
|
+
* Packages that should show up up when the `-V` flag is passed
|
|
80
|
+
*/
|
|
81
|
+
packages?: string[] | {
|
|
82
|
+
name: string;
|
|
83
|
+
alias: string;
|
|
84
|
+
}[];
|
|
85
|
+
/**
|
|
86
|
+
* If set to true, information about musket CLI like name and
|
|
87
|
+
* version info will not be unexpectedly shown in console
|
|
88
|
+
*/
|
|
89
|
+
hideMusketInfo?: boolean;
|
|
90
|
+
/**
|
|
91
|
+
* Commands that should be autoloaded by default
|
|
92
|
+
*/
|
|
93
|
+
baseCommands?: typeof Command[];
|
|
94
|
+
/**
|
|
95
|
+
* Paths where musket can search and auto discover commands
|
|
96
|
+
*
|
|
97
|
+
*
|
|
98
|
+
* @example 'Console/Commands/*.js'
|
|
99
|
+
* @example 'dist/app/Console/Commands/*.js'
|
|
100
|
+
* @example ['Console/Commands/*.js', 'src/app/Commands/*.js']
|
|
101
|
+
*/
|
|
102
|
+
discoveryPaths?: string | string[];
|
|
103
|
+
}
|
|
104
|
+
//#endregion
|
|
105
|
+
//#region src/Core/Kernel.d.ts
|
|
106
|
+
declare class Kernel {
|
|
107
|
+
app: Application;
|
|
108
|
+
cwd: string;
|
|
109
|
+
output: "string" | "number" | "bigint" | "boolean" | "symbol" | "undefined" | "object" | "function";
|
|
110
|
+
modules: XGeneric<{
|
|
111
|
+
version: string;
|
|
112
|
+
name: string;
|
|
113
|
+
}>[];
|
|
114
|
+
basePath: string;
|
|
115
|
+
packages: NonNullable<InitConfig['packages']>;
|
|
116
|
+
private config;
|
|
117
|
+
constructor(app: Application);
|
|
118
|
+
ensureDirectoryExists(dir: string): Promise<void>;
|
|
119
|
+
static init(app: Application, config?: InitConfig): Promise<commander0.Command>;
|
|
120
|
+
private run;
|
|
121
|
+
private loadRequirements;
|
|
122
|
+
}
|
|
123
|
+
//#endregion
|
|
124
|
+
//#region src/Core/Command.d.ts
|
|
125
|
+
declare class Command {
|
|
126
|
+
protected app: Application;
|
|
127
|
+
protected kernel: Kernel;
|
|
128
|
+
constructor(app: Application, kernel: Kernel);
|
|
129
|
+
/**
|
|
130
|
+
* The underlying commander instance.
|
|
131
|
+
*
|
|
132
|
+
* @var Command
|
|
133
|
+
*/
|
|
134
|
+
program: Command$1;
|
|
135
|
+
/**
|
|
136
|
+
* The name and signature of the console command.
|
|
137
|
+
*
|
|
138
|
+
* @var string
|
|
139
|
+
*/
|
|
140
|
+
protected signature: string;
|
|
141
|
+
/**
|
|
142
|
+
* A dictionary of signatures or what not.
|
|
143
|
+
*
|
|
144
|
+
* @var object
|
|
145
|
+
*/
|
|
146
|
+
protected dictionary: Record<string, any>;
|
|
147
|
+
/**
|
|
148
|
+
* The console command description.
|
|
149
|
+
*
|
|
150
|
+
* @var string
|
|
151
|
+
*/
|
|
152
|
+
protected description?: string;
|
|
153
|
+
/**
|
|
154
|
+
* The console command input.
|
|
155
|
+
*
|
|
156
|
+
* @var object
|
|
157
|
+
*/
|
|
158
|
+
private input;
|
|
159
|
+
/**
|
|
160
|
+
* Execute the console command.
|
|
161
|
+
*/
|
|
162
|
+
handle(..._args: any[]): Promise<void>;
|
|
163
|
+
setApplication(app: Application): void;
|
|
164
|
+
setInput(options: XGeneric, args: string[], regArgs: readonly Argument[], dictionary: Record<string, any>, program: Command$1): this;
|
|
165
|
+
setOption(key: string, value: unknown): this;
|
|
166
|
+
setProgram(program: Command$1): this;
|
|
167
|
+
getSignature(): string;
|
|
168
|
+
getDescription(): string | undefined;
|
|
169
|
+
option(key: string, def?: any): any;
|
|
170
|
+
options(key?: string): any;
|
|
171
|
+
argument(key: string, def?: any): any;
|
|
172
|
+
arguments(): Record<string, any>;
|
|
173
|
+
loadBaseFlags(): void;
|
|
174
|
+
/**
|
|
175
|
+
* Check if the command is quiet
|
|
176
|
+
*
|
|
177
|
+
* @returns
|
|
178
|
+
*/
|
|
179
|
+
isQuiet(): any;
|
|
180
|
+
/**
|
|
181
|
+
* Check if the command is silent
|
|
182
|
+
*
|
|
183
|
+
* @returns
|
|
184
|
+
*/
|
|
185
|
+
isSilent(): any;
|
|
186
|
+
/**
|
|
187
|
+
* Check if the command is non interactive
|
|
188
|
+
*
|
|
189
|
+
* @returns
|
|
190
|
+
*/
|
|
191
|
+
isNonInteractive(): boolean;
|
|
192
|
+
/**
|
|
193
|
+
* Get the verbosity of the command
|
|
194
|
+
*
|
|
195
|
+
* @returns
|
|
196
|
+
*/
|
|
197
|
+
getVerbosity(): number;
|
|
198
|
+
/**
|
|
199
|
+
* Log an info message
|
|
200
|
+
*/
|
|
201
|
+
info(message: string): this;
|
|
202
|
+
/**
|
|
203
|
+
* Log a warning message
|
|
204
|
+
*/
|
|
205
|
+
warn(message: string): this;
|
|
206
|
+
/**
|
|
207
|
+
* Log a line message
|
|
208
|
+
*/
|
|
209
|
+
line(message: string): this;
|
|
210
|
+
/**
|
|
211
|
+
* Log a new line
|
|
212
|
+
*/
|
|
213
|
+
newLine(count?: number): this;
|
|
214
|
+
/**
|
|
215
|
+
* Log a success message
|
|
216
|
+
*/
|
|
217
|
+
success(message: string): this;
|
|
218
|
+
/**
|
|
219
|
+
* Log an error message
|
|
220
|
+
*/
|
|
221
|
+
error(message: string): this;
|
|
222
|
+
/**
|
|
223
|
+
* Log an error message and terminate execution of the command
|
|
224
|
+
* return an exit code of 1
|
|
225
|
+
*
|
|
226
|
+
* This method is not chainable
|
|
227
|
+
*/
|
|
228
|
+
fail(message: string): void;
|
|
229
|
+
/**
|
|
230
|
+
* Log a debug message
|
|
231
|
+
*/
|
|
232
|
+
debug(message: string | string[]): this;
|
|
233
|
+
}
|
|
234
|
+
//#endregion
|
|
235
|
+
//#region src/Musket.d.ts
|
|
236
|
+
declare class Musket {
|
|
237
|
+
private app;
|
|
238
|
+
private kernel;
|
|
239
|
+
private baseCommands;
|
|
240
|
+
private resolver?;
|
|
241
|
+
private tsDownConfig;
|
|
242
|
+
/**
|
|
243
|
+
* The name of the CLI app we're building
|
|
244
|
+
*
|
|
245
|
+
* @default musket
|
|
246
|
+
*/
|
|
247
|
+
cliName: string;
|
|
248
|
+
private config;
|
|
249
|
+
private commands;
|
|
250
|
+
constructor(app: Application, kernel: Kernel, baseCommands?: Command[], resolver?: (<X>(cmd: X, met: string) => Promise<X>) | undefined, tsDownConfig?: Options);
|
|
251
|
+
build(): Promise<Command$1>;
|
|
252
|
+
private loadBaseCommands;
|
|
253
|
+
/**
|
|
254
|
+
* Provide the configuration to initialize the CLI with
|
|
255
|
+
*
|
|
256
|
+
* @param config
|
|
257
|
+
* @returns
|
|
258
|
+
*/
|
|
259
|
+
configure(config: InitConfig): this;
|
|
260
|
+
/**
|
|
261
|
+
* Set the paths where the cli can search and auto discover commands
|
|
262
|
+
*
|
|
263
|
+
* @param paths
|
|
264
|
+
*
|
|
265
|
+
* @example instance.discoverCommandsFrom('Console/Commands/*.js')
|
|
266
|
+
* @example instance.discoverCommandsFrom(['Console/Commands/*.js', 'App/Commands/*.js'])
|
|
267
|
+
*
|
|
268
|
+
* @returns the current cli intance
|
|
269
|
+
*/
|
|
270
|
+
discoverCommandsFrom(paths: string | string[]): this;
|
|
271
|
+
private loadDiscoveredCommands;
|
|
272
|
+
addCommand(command: Command): void;
|
|
273
|
+
private initialize;
|
|
274
|
+
rebuild(name: string): Promise<void>;
|
|
275
|
+
private makeOption;
|
|
276
|
+
private handle;
|
|
277
|
+
static parse(kernel: Kernel, config?: InitConfig): Promise<Command$1>;
|
|
278
|
+
}
|
|
279
|
+
//#endregion
|
|
280
|
+
//#region src/Contracts/Application.d.ts
|
|
281
|
+
declare class Application {
|
|
282
|
+
/**
|
|
283
|
+
* The current musket CLI Instance
|
|
284
|
+
*/
|
|
285
|
+
musket?: Musket;
|
|
286
|
+
/**
|
|
287
|
+
* Registered commands will be preloaded
|
|
288
|
+
*/
|
|
289
|
+
registeredCommands?: typeof Command[];
|
|
290
|
+
}
|
|
291
|
+
//#endregion
|
|
292
|
+
//#region src/Signature.d.ts
|
|
293
|
+
declare class Signature {
|
|
294
|
+
/**
|
|
295
|
+
* Helper to parse options inside a block of text
|
|
296
|
+
*
|
|
297
|
+
* @param block
|
|
298
|
+
* @returns
|
|
299
|
+
*/
|
|
300
|
+
static parseOptions(block: string): CommandOption[];
|
|
301
|
+
/**
|
|
302
|
+
* Helper to parse a command's signature
|
|
303
|
+
*
|
|
304
|
+
* @param signature
|
|
305
|
+
* @param commandClass
|
|
306
|
+
* @returns
|
|
307
|
+
*/
|
|
308
|
+
static parseSignature(signature: string, commandClass: Command): ParsedCommand;
|
|
309
|
+
}
|
|
310
|
+
//#endregion
|
|
311
|
+
export { Application, Command, CommandOption, InitConfig, Kernel, Musket, ParsedCommand, Signature };
|