@nu-art/commando 0.204.66 → 0.204.68

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/basic.d.ts CHANGED
@@ -6,6 +6,13 @@ type Cli_EchoOptions = {
6
6
  append?: boolean;
7
7
  };
8
8
  };
9
+ type Cli_RmdirOptions = {
10
+ force?: true;
11
+ recursive?: true;
12
+ };
13
+ type Cli_CpdirOptions = {
14
+ contentOnly?: boolean;
15
+ };
9
16
  /**
10
17
  * Represents a Command Line Interface (CLI) to build and execute shell commands.
11
18
  */
@@ -30,6 +37,8 @@ export declare class Cli_Basic extends CliWrapper {
30
37
  */
31
38
  ls(params?: string): this;
32
39
  mkdir(dirName: string): this;
40
+ rmdir(dirPath: string, options?: Cli_RmdirOptions): this;
41
+ cpdir(srcPath: string, destPath: string, options?: Cli_CpdirOptions): this;
33
42
  cat(fileName: string): this;
34
43
  echo(log: string, options?: Cli_EchoOptions): this;
35
44
  /**
package/cli/basic.js CHANGED
@@ -47,6 +47,23 @@ class Cli_Basic extends cli_1.CliWrapper {
47
47
  this.cli.append(`mkdir -p ${dirName}`);
48
48
  return this;
49
49
  }
50
+ rmdir(dirPath, options) {
51
+ let command = 'rm';
52
+ if (options === null || options === void 0 ? void 0 : options.force)
53
+ command += ' -rf';
54
+ if (options === null || options === void 0 ? void 0 : options.recursive)
55
+ command += ' -r';
56
+ this.cli.append(`${command} ${dirPath}`);
57
+ return this;
58
+ }
59
+ cpdir(srcPath, destPath, options) {
60
+ let command = `cp -r ${srcPath}`;
61
+ if (options === null || options === void 0 ? void 0 : options.contentOnly)
62
+ command += '/*';
63
+ command += ` ${destPath}`;
64
+ this.cli.append(command);
65
+ return this;
66
+ }
50
67
  cat(fileName) {
51
68
  this.cli.append(`cat ${fileName}`);
52
69
  return this;
package/cli/cli-params.js CHANGED
@@ -61,7 +61,7 @@ class CLIParams_Resolver {
61
61
  });
62
62
  if (cliParamToResolve.isArray) {
63
63
  let currentValues = output[key];
64
- currentValues = (0, ts_common_1.filterDuplicates)([...currentValues !== null && currentValues !== void 0 ? currentValues : [], finalValue]);
64
+ currentValues = (0, ts_common_1.filterDuplicates)([...(currentValues !== null && currentValues !== void 0 ? currentValues : []), ...(0, ts_common_1.asArray)(finalValue)]);
65
65
  output[key] = currentValues;
66
66
  return output;
67
67
  }
package/cli/git.d.ts CHANGED
@@ -14,7 +14,7 @@ type GitPushParams = {
14
14
  };
15
15
  export declare class Cli_Git extends Super {
16
16
  git: {
17
- clone: (url: string, options?: GitCloneParams) => Cli_Git;
17
+ clone: (url: string, options?: GitCloneParams) => this;
18
18
  checkout: (branch: string) => Cli_Git;
19
19
  createTag: (tagName: string) => Cli_Git;
20
20
  gitCommit: (commitMessage: string) => Cli_Git;
@@ -32,7 +32,7 @@ export declare class Cli_Git extends Super {
32
32
  gsui: (modules?: string) => Cli_Git;
33
33
  status: () => Cli_Git;
34
34
  };
35
- private git_clone;
35
+ git_clone(url: string, options?: GitCloneParams): this;
36
36
  private git_checkout;
37
37
  private git_createTag;
38
38
  private git_gitCommit;
@@ -60,7 +60,7 @@ export declare abstract class ConsoleContainer<Type extends BlessedWidgetsType,
60
60
  *
61
61
  * @returns {this} The current instance for method chaining.
62
62
  */
63
- readonly create: () => this;
63
+ create(): this;
64
64
  /**
65
65
  * Resumes rendering and enables focus on the widgets.
66
66
  *
@@ -22,18 +22,6 @@ class ConsoleContainer extends ts_common_1.Logger {
22
22
  this.enabled = false;
23
23
  this.state = {};
24
24
  this.widgets = [];
25
- /**
26
- * Creates the container and its widgets, and resumes rendering if not already enabled.
27
- *
28
- * @returns {this} The current instance for method chaining.
29
- */
30
- this.create = () => {
31
- this.createContainer();
32
- this._createWidgets();
33
- if (!this.enabled)
34
- this.resume();
35
- return this;
36
- };
37
25
  /**
38
26
  * Resumes rendering and enables focus on the widgets.
39
27
  *
@@ -135,11 +123,23 @@ class ConsoleContainer extends ts_common_1.Logger {
135
123
  }
136
124
  this.createContent();
137
125
  }
126
+ /**
127
+ * Creates the container and its widgets, and resumes rendering if not already enabled.
128
+ *
129
+ * @returns {this} The current instance for method chaining.
130
+ */
131
+ create() {
132
+ this.createContainer();
133
+ this._createWidgets();
134
+ if (!this.enabled)
135
+ this.resume();
136
+ return this;
137
+ }
138
138
  _render() {
139
139
  if (!this.enabled)
140
140
  return;
141
- this.container.screen.render();
142
141
  this.render();
142
+ this.container.screen.render();
143
143
  }
144
144
  }
145
145
  exports.ConsoleContainer = ConsoleContainer;
package/core/cli.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  /// <reference types="node" />
2
2
  /// <reference types="node" />
3
+ /// <reference types="mocha" />
3
4
  /// <reference types="node" />
4
5
  /// <reference types="node" />
5
6
  /// <reference types="node" />
@@ -42,6 +43,7 @@ export declare class BaseCLI extends Logger {
42
43
  */
43
44
  readonly append: (command: string) => this;
44
45
  setUID(uuid: string): void;
46
+ setStdErrorValidator(processor: (stderr: string) => boolean): void;
45
47
  addStdoutProcessor(processor: (stdout: string) => void): void;
46
48
  addStderrProcessor(processor: (stderr: string) => void): void;
47
49
  removeStdoutProcessor(processor: (stdout: string) => void): void;
@@ -108,6 +110,7 @@ export declare class Commando {
108
110
  addStderrProcessor: (processor: (stderr: string) => void) => this;
109
111
  removeStdoutProcessor: (processor: (stdout: string) => void) => this;
110
112
  removeStderrProcessor: (processor: (stderr: string) => void) => this;
113
+ setStdErrorValidator: (processor: (stderr: string) => boolean) => this;
111
114
  private constructor();
112
115
  }
113
116
  export declare class CommandoInteractive {
@@ -117,6 +120,7 @@ export declare class CommandoInteractive {
117
120
  addStderrProcessor: (processor: (stderr: string) => void) => this;
118
121
  removeStdoutProcessor: (processor: (stdout: string) => void) => this;
119
122
  removeStderrProcessor: (processor: (stderr: string) => void) => this;
123
+ setStdErrorValidator: (processor: (stderr: string) => boolean) => this;
120
124
  setUID: (uid: string) => this;
121
125
  close: (cb?: AsyncVoidFunction) => this;
122
126
  kill: (signal?: NodeJS.Signals | number) => boolean;
package/core/cli.js CHANGED
@@ -55,6 +55,9 @@ class BaseCLI extends ts_common_1.Logger {
55
55
  setUID(uuid) {
56
56
  this.setTag(uuid);
57
57
  }
58
+ setStdErrorValidator(processor) {
59
+ this.stderrValidator = processor;
60
+ }
58
61
  addStdoutProcessor(processor) {
59
62
  this.stdoutProcessors.push(processor);
60
63
  }
@@ -248,6 +251,10 @@ class Commando {
248
251
  cli.removeStderrProcessor(processor);
249
252
  return commando;
250
253
  };
254
+ commando.setStdErrorValidator = (processor) => {
255
+ cli.setStdErrorValidator(processor);
256
+ return commando;
257
+ };
251
258
  return commando;
252
259
  }
253
260
  constructor() {
@@ -271,6 +278,7 @@ class Commando {
271
278
  this.addStderrProcessor = (processor) => this;
272
279
  this.removeStdoutProcessor = (processor) => this;
273
280
  this.removeStderrProcessor = (processor) => this;
281
+ this.setStdErrorValidator = (processor) => this;
274
282
  }
275
283
  }
276
284
  exports.Commando = Commando;
@@ -280,6 +288,7 @@ class CommandoInteractive {
280
288
  this.addStderrProcessor = (processor) => this;
281
289
  this.removeStdoutProcessor = (processor) => this;
282
290
  this.removeStderrProcessor = (processor) => this;
291
+ this.setStdErrorValidator = (processor) => this;
283
292
  this.setUID = (uid) => this;
284
293
  this.close = (cb) => this;
285
294
  this.kill = (signal) => true;
@@ -323,6 +332,10 @@ class CommandoInteractive {
323
332
  cli.removeStderrProcessor(processor);
324
333
  return commando;
325
334
  };
335
+ commando.setStdErrorValidator = (processor) => {
336
+ cli.setStdErrorValidator(processor);
337
+ return commando;
338
+ };
326
339
  return commando;
327
340
  }
328
341
  }
package/core/tools.d.ts CHANGED
@@ -1,2 +1,3 @@
1
+ import { AbsolutePath } from '@nu-art/ts-common';
1
2
  export declare function removeAnsiCodes(text: string): string;
2
- export declare function convertToFullPath(pathToFile: string, assetParentPath?: string): string;
3
+ export declare function convertToFullPath(pathToFile: string, assetParentPath?: string): AbsolutePath;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nu-art/commando",
3
- "version": "0.204.66",
3
+ "version": "0.204.68",
4
4
  "description": "",
5
5
  "keywords": [
6
6
  "TacB0sS",
package/tsconfig.json CHANGED
@@ -16,10 +16,7 @@
16
16
  "noUnusedLocals": true,
17
17
  "module": "commonjs",
18
18
  "sourceMap": true,
19
- "strict": true,
20
- "typeRoots": [
21
- "./types"
22
- ]
19
+ "strict": true
23
20
  },
24
21
  "esModuleInterop": true,
25
22
  "module": "ES2020"