@orxataguy/tyr 1.0.48 → 1.0.50
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/package.json +1 -1
- package/src/core/Kernel.ts +8 -9
package/package.json
CHANGED
package/src/core/Kernel.ts
CHANGED
|
@@ -51,11 +51,15 @@ export class Kernel {
|
|
|
51
51
|
}
|
|
52
52
|
|
|
53
53
|
public async boot(args: string[]): Promise<void> {
|
|
54
|
-
|
|
54
|
+
this.isDebug = args.includes('--debug');
|
|
55
|
+
|
|
56
|
+
if (this.isDebug) {
|
|
57
|
+
args.splice(args.indexOf('--debug'), 1);
|
|
58
|
+
}
|
|
55
59
|
|
|
56
60
|
(dotenv as any).config({ path: path.join(this.userRoot, '.env'), quiet: true });
|
|
57
61
|
|
|
58
|
-
await this.container.init(isDebug);
|
|
62
|
+
await this.container.init(this.isDebug);
|
|
59
63
|
|
|
60
64
|
this.config = { commands: {}, aliases: {} };
|
|
61
65
|
|
|
@@ -248,10 +252,6 @@ export class Kernel {
|
|
|
248
252
|
|
|
249
253
|
const commandFactory: CommandFactory = module.default;
|
|
250
254
|
const command = commandFactory(context);
|
|
251
|
-
|
|
252
|
-
if (args.includes('--debug')) {
|
|
253
|
-
args.splice(args.indexOf('--debug'), 1);
|
|
254
|
-
}
|
|
255
255
|
|
|
256
256
|
await command(args.slice(1));
|
|
257
257
|
|
|
@@ -261,7 +261,6 @@ export class Kernel {
|
|
|
261
261
|
}
|
|
262
262
|
|
|
263
263
|
private handleError(error: unknown, args: string[]): void {
|
|
264
|
-
const isDebug = args.includes('--debug');
|
|
265
264
|
const logger = this.container.get().logger;
|
|
266
265
|
const commandName = args[0];
|
|
267
266
|
|
|
@@ -269,9 +268,9 @@ export class Kernel {
|
|
|
269
268
|
const enriched = error.commandName
|
|
270
269
|
? error
|
|
271
270
|
: new TyrError(error.message, error.originalError, error.suggestion, commandName);
|
|
272
|
-
enriched.handle(isDebug, logger);
|
|
271
|
+
enriched.handle(this.isDebug, logger);
|
|
273
272
|
} else {
|
|
274
|
-
(new TyrError('Unhandled critical error', error, undefined, commandName)).handle(isDebug, logger);
|
|
273
|
+
(new TyrError('Unhandled critical error', error, undefined, commandName)).handle(this.isDebug, logger);
|
|
275
274
|
}
|
|
276
275
|
|
|
277
276
|
process.exit(1);
|