@nu-art/commando 0.204.111 → 0.204.113

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": "@nu-art/commando",
3
- "version": "0.204.111",
3
+ "version": "0.204.113",
4
4
  "description": "",
5
5
  "keywords": [
6
6
  "TacB0sS",
@@ -68,7 +68,7 @@ export declare class CommandoInteractive extends BaseCommando {
68
68
  * @returns {this} - The CommandoInteractive instance for method chaining.
69
69
  */
70
70
  addLogProcessor(processor: (log: string, std: LogTypes) => boolean): this;
71
- setLogLevelFilter(processor: (log: string, std: LogTypes) => LogLevel): this;
71
+ setLogLevelFilter(processor: (log: string, std: LogTypes) => LogLevel | undefined): this;
72
72
  /**
73
73
  * Removes a log processor from the shell.
74
74
  * @param {Function} processor - The log processor function to remove.
@@ -50,7 +50,7 @@ export declare class InteractiveShell extends Logger {
50
50
  * @returns {this} - The InteractiveShell instance for method chaining.
51
51
  */
52
52
  addLogProcessor(processor: LogProcessor): this;
53
- setLogLevelFilter(logLevelFilter: (log: string, std: LogTypes) => LogLevel): this;
53
+ setLogLevelFilter(logLevelFilter: (log: string, std: LogTypes) => LogLevel | undefined): this;
54
54
  /**
55
55
  * Removes a log processor from handling log messages.
56
56
  * @param {(log: string, std: LogTypes) => boolean} processor - The log processor function to remove.
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.InteractiveShell = void 0;
4
4
  const ts_common_1 = require("@nu-art/ts-common");
5
5
  const node_child_process_1 = require("node:child_process");
6
+ const defaultLogLevelFilter = (log, std) => std === 'err' ? ts_common_1.LogLevel.Error : ts_common_1.LogLevel.Info;
6
7
  class InteractiveShell extends ts_common_1.Logger {
7
8
  /**
8
9
  * Constructs an InteractiveShell instance, initializes a detached shell session, and sets up log processors.
@@ -12,7 +13,7 @@ class InteractiveShell extends ts_common_1.Logger {
12
13
  super();
13
14
  this._debug = false;
14
15
  this.logProcessors = [];
15
- this.logLevelFilter = (log, std) => std === 'err' ? ts_common_1.LogLevel.Error : ts_common_1.LogLevel.Info;
16
+ this.logLevelFilter = defaultLogLevelFilter;
16
17
  /**
17
18
  * Executes a command in the interactive shell.
18
19
  * @param {string} command - The command to execute.
@@ -77,6 +78,7 @@ class InteractiveShell extends ts_common_1.Logger {
77
78
  });
78
79
  this.alive = true;
79
80
  const printer = (std) => (data) => {
81
+ var _a;
80
82
  const messages = data.toString().trim().split('\n');
81
83
  if (!messages.length)
82
84
  return;
@@ -87,7 +89,7 @@ class InteractiveShell extends ts_common_1.Logger {
87
89
  return toPrint && filter;
88
90
  }, true);
89
91
  if (toPrint) {
90
- const logLevel = this.logLevelFilter(message, std);
92
+ const logLevel = (_a = this.logLevelFilter(message, std)) !== null && _a !== void 0 ? _a : defaultLogLevelFilter(message, std);
91
93
  this.log(logLevel, false, [message]);
92
94
  }
93
95
  }