@orxataguy/tyr 1.0.48 → 1.0.49

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