@nu-art/commando 0.300.8 → 0.400.1
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-params/CLIParamsResolver.d.ts +1 -1
- package/cli-params/CLIParamsResolver.js +30 -31
- package/cli-params/CLIParamsResolver.js.map +1 -0
- package/cli-params/consts.d.ts +1 -1
- package/cli-params/consts.js +11 -15
- package/cli-params/consts.js.map +1 -0
- package/cli-params/types.d.ts +1 -0
- package/cli-params/types.js +2 -2
- package/cli-params/types.js.map +1 -0
- package/package.json +17 -13
- package/shell/core/BaseCommando.d.ts +2 -2
- package/shell/core/BaseCommando.js +12 -14
- package/shell/core/BaseCommando.js.map +1 -0
- package/shell/core/CliError.js +10 -8
- package/shell/core/CliError.js.map +1 -0
- package/shell/core/CommandBuilder.js +41 -40
- package/shell/core/CommandBuilder.js.map +1 -0
- package/shell/core/CommandoPool.d.ts +9 -0
- package/shell/core/CommandoPool.js +15 -0
- package/shell/core/CommandoPool.js.map +1 -0
- package/shell/core/class-merger.js +3 -6
- package/shell/core/class-merger.js.map +1 -0
- package/shell/index.d.ts +2 -2
- package/shell/index.js +3 -18
- package/shell/index.js.map +1 -0
- package/shell/interactive/CommandoInteractive.d.ts +12 -15
- package/shell/interactive/CommandoInteractive.js +88 -72
- package/shell/interactive/CommandoInteractive.js.map +1 -0
- package/shell/interactive/InteractiveShell.d.ts +14 -16
- package/shell/interactive/InteractiveShell.js +135 -88
- package/shell/interactive/InteractiveShell.js.map +1 -0
- package/shell/plugins/basic.d.ts +2 -2
- package/shell/plugins/basic.js +8 -11
- package/shell/plugins/basic.js.map +1 -0
- package/shell/plugins/git.d.ts +3 -3
- package/shell/plugins/git.js +30 -36
- package/shell/plugins/git.js.map +1 -0
- package/shell/plugins/nvm.d.ts +3 -3
- package/shell/plugins/nvm.js +22 -28
- package/shell/plugins/nvm.js.map +1 -0
- package/shell/plugins/pnpm.d.ts +4 -4
- package/shell/plugins/pnpm.js +8 -11
- package/shell/plugins/pnpm.js.map +1 -0
- package/shell/plugins/programming.d.ts +2 -2
- package/shell/plugins/programming.js +3 -6
- package/shell/plugins/programming.js.map +1 -0
- package/shell/plugins/python.d.ts +3 -3
- package/shell/plugins/python.js +9 -12
- package/shell/plugins/python.js.map +1 -0
- package/shell/services/nvm.d.ts +1 -1
- package/shell/services/nvm.js +62 -88
- package/shell/services/nvm.js.map +1 -0
- package/shell/services/pnpm.d.ts +3 -3
- package/shell/services/pnpm.js +54 -56
- package/shell/services/pnpm.js.map +1 -0
- package/shell/simple/Commando.d.ts +2 -2
- package/shell/simple/Commando.js +15 -18
- package/shell/simple/Commando.js.map +1 -0
- package/shell/simple/SimpleShell.js +34 -33
- package/shell/simple/SimpleShell.js.map +1 -0
- package/shell/tools.js +4 -30
- package/shell/tools.js.map +1 -0
- package/shell/types.d.ts +1 -1
- package/shell/types.js +2 -2
- package/shell/types.js.map +1 -0
- package/console/ConsoleContainer.d.ts +0 -89
- package/console/ConsoleContainer.js +0 -145
- package/console/ConsoleScreen.d.ts +0 -21
- package/console/ConsoleScreen.js +0 -21
- package/console/types.d.ts +0 -61
- package/console/types.js +0 -72
- package/tsconfig.json +0 -23
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BaseCliParam, CliParams } from './types';
|
|
1
|
+
import { BaseCliParam, CliParams } from './types.js';
|
|
2
2
|
export declare class CLIParamsResolver<T extends BaseCliParam<string, any>[], Output extends CliParams<T> = CliParams<T>> {
|
|
3
3
|
private params;
|
|
4
4
|
static create<T extends BaseCliParam<string, any>[]>(...params: T): CLIParamsResolver<T, CliParams<T>>;
|
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const consts_1 = require("./consts");
|
|
6
|
-
class CLIParamsResolver {
|
|
1
|
+
import { asArray, exists, filterDuplicates, StaticLogger } from '@nu-art/ts-common';
|
|
2
|
+
import { DefaultProcessorsMapper } from './consts.js';
|
|
3
|
+
export class CLIParamsResolver {
|
|
4
|
+
params;
|
|
7
5
|
static create(...params) {
|
|
8
6
|
return new CLIParamsResolver(params);
|
|
9
7
|
}
|
|
@@ -17,35 +15,38 @@ class CLIParamsResolver {
|
|
|
17
15
|
*/
|
|
18
16
|
resolveParamValue(inputParams = process.argv.slice(2, process.argv.length)) {
|
|
19
17
|
const runtimeParams = inputParams.reduce((output, inputParam) => {
|
|
20
|
-
|
|
21
|
-
const cliParamToResolve = this.findMatchingParamToResolve(
|
|
18
|
+
let [key, value] = inputParam.split('=');
|
|
19
|
+
const cliParamToResolve = this.findMatchingParamToResolve(key);
|
|
22
20
|
if (!cliParamToResolve)
|
|
23
21
|
return output;
|
|
24
|
-
|
|
22
|
+
if (value && value.startsWith('"') && value.endsWith('"')) {
|
|
23
|
+
value = value.slice(1, -1);
|
|
24
|
+
value = value.replace(/\\"/g, '"');
|
|
25
|
+
}
|
|
25
26
|
const finalValue = cliParamToResolve.process(value, cliParamToResolve.defaultValue);
|
|
26
27
|
// validate options if exits
|
|
27
|
-
if (cliParamToResolve.options && !cliParamToResolve.options.includes(
|
|
28
|
-
throw new Error(
|
|
29
|
-
const
|
|
30
|
-
if (
|
|
31
|
-
|
|
28
|
+
if (cliParamToResolve.options && !cliParamToResolve.options.includes(finalValue))
|
|
29
|
+
throw new Error(`value not supported for param: ${cliParamToResolve.name}, supported values: ${cliParamToResolve.options.join(', ')}`);
|
|
30
|
+
const keyName = cliParamToResolve.keyName;
|
|
31
|
+
if (exists(cliParamToResolve.dependencies))
|
|
32
|
+
cliParamToResolve.dependencies?.forEach(dependency => {
|
|
32
33
|
output[dependency.param.keyName] = dependency.value;
|
|
33
34
|
});
|
|
34
35
|
if (cliParamToResolve.isArray) {
|
|
35
|
-
let currentValues = output[
|
|
36
|
-
currentValues =
|
|
37
|
-
output[
|
|
36
|
+
let currentValues = output[keyName];
|
|
37
|
+
currentValues = filterDuplicates([...(currentValues ?? []), ...asArray(finalValue)]);
|
|
38
|
+
output[keyName] = currentValues;
|
|
38
39
|
return output;
|
|
39
40
|
}
|
|
40
41
|
//if already exists and the value ain't an array warn that the value will be overridden
|
|
41
|
-
if (output[
|
|
42
|
-
|
|
43
|
-
//Apply single value to the object
|
|
44
|
-
output[
|
|
42
|
+
if (output[keyName])
|
|
43
|
+
StaticLogger.logWarning(`this param does not accept multiple values, overriding prev value: ${output[keyName]}`);
|
|
44
|
+
//Apply a single value to the object
|
|
45
|
+
output[keyName] = finalValue;
|
|
45
46
|
return output;
|
|
46
47
|
}, {});
|
|
47
|
-
this.params.filter(param =>
|
|
48
|
-
runtimeParams[param.keyName] = param.
|
|
48
|
+
this.params.filter(param => exists(param.initialValue) && !exists(runtimeParams[param.keyName])).forEach(param => {
|
|
49
|
+
runtimeParams[param.keyName] = param.initialValue;
|
|
49
50
|
});
|
|
50
51
|
return runtimeParams;
|
|
51
52
|
}
|
|
@@ -57,15 +58,13 @@ class CLIParamsResolver {
|
|
|
57
58
|
* @private
|
|
58
59
|
*/
|
|
59
60
|
findMatchingParamToResolve(inputParam) {
|
|
60
|
-
let maxKeyLength = 0;
|
|
61
61
|
let matchingParam;
|
|
62
|
-
// look for the longest fitting param in order to make sure we find the perfect match
|
|
63
62
|
this.params.forEach((param) => {
|
|
64
63
|
param.keys.forEach((key) => {
|
|
65
|
-
if (inputParam
|
|
66
|
-
|
|
64
|
+
if (inputParam === key)
|
|
65
|
+
matchingParam = param;
|
|
66
|
+
if (inputParam.startsWith(`${key}=`))
|
|
67
67
|
matchingParam = param;
|
|
68
|
-
}
|
|
69
68
|
});
|
|
70
69
|
});
|
|
71
70
|
return matchingParam;
|
|
@@ -83,13 +82,13 @@ class CLIParamsResolver {
|
|
|
83
82
|
param.name = param.keyName;
|
|
84
83
|
//If no processor is passed apply default by type
|
|
85
84
|
if (!param.process) {
|
|
86
|
-
param.process =
|
|
85
|
+
param.process = DefaultProcessorsMapper[param.type.split('[')[0].trim()];
|
|
87
86
|
}
|
|
88
87
|
//Determine if value is array by the param type TODO: improve this chunk of code, this is not strict enough
|
|
89
|
-
if (!
|
|
88
|
+
if (!exists(param.isArray) && param.type.includes('[]'))
|
|
90
89
|
param.isArray = true;
|
|
91
90
|
return param;
|
|
92
91
|
});
|
|
93
92
|
}
|
|
94
93
|
}
|
|
95
|
-
|
|
94
|
+
//# sourceMappingURL=CLIParamsResolver.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CLIParamsResolver.js","sourceRoot":"/Users/tacb0ss/dev/nu-art/beamz/_thunderstorm/commando/src/main/","sources":["cli-params/CLIParamsResolver.ts"],"names":[],"mappings":"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"}
|
package/cli-params/consts.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { TypedMap } from '@nu-art/ts-common';
|
|
2
|
-
import { CliParam } from './types';
|
|
2
|
+
import { CliParam } from './types.js';
|
|
3
3
|
export declare const DefaultProcessor_Boolean: CliParam<any, boolean>['process'];
|
|
4
4
|
export declare const DefaultProcessor_String: CliParam<any, string>['process'];
|
|
5
5
|
export declare const DefaultProcessor_Number: CliParam<any, number>['process'];
|
package/cli-params/consts.js
CHANGED
|
@@ -1,22 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.DefaultProcessorsMapper = exports.DefaultProcessor_Number = exports.DefaultProcessor_String = exports.DefaultProcessor_Boolean = void 0;
|
|
4
|
-
const DefaultProcessor_Boolean = (input, defaultValue) => {
|
|
1
|
+
import { exists } from '@nu-art/ts-common';
|
|
2
|
+
export const DefaultProcessor_Boolean = (input, defaultValue) => {
|
|
5
3
|
return true;
|
|
6
4
|
};
|
|
7
|
-
|
|
8
|
-
const DefaultProcessor_String = (input, defaultValue) => {
|
|
5
|
+
export const DefaultProcessor_String = (input, defaultValue) => {
|
|
9
6
|
if (!input || !input.length) {
|
|
10
|
-
if (!defaultValue)
|
|
7
|
+
if (!exists(defaultValue))
|
|
11
8
|
throw new Error('expected string value');
|
|
12
9
|
return defaultValue;
|
|
13
10
|
}
|
|
14
11
|
return input;
|
|
15
12
|
};
|
|
16
|
-
|
|
17
|
-
const DefaultProcessor_Number = (input, defaultValue) => {
|
|
13
|
+
export const DefaultProcessor_Number = (input, defaultValue) => {
|
|
18
14
|
if (!input) {
|
|
19
|
-
if (!defaultValue)
|
|
15
|
+
if (!exists(defaultValue))
|
|
20
16
|
throw new Error('expected number value');
|
|
21
17
|
return defaultValue;
|
|
22
18
|
}
|
|
@@ -24,9 +20,9 @@ const DefaultProcessor_Number = (input, defaultValue) => {
|
|
|
24
20
|
throw new Error('expected number value');
|
|
25
21
|
return Number(input);
|
|
26
22
|
};
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
number: exports.DefaultProcessor_Number,
|
|
23
|
+
export const DefaultProcessorsMapper = {
|
|
24
|
+
string: DefaultProcessor_String,
|
|
25
|
+
boolean: DefaultProcessor_Boolean,
|
|
26
|
+
number: DefaultProcessor_Number,
|
|
32
27
|
};
|
|
28
|
+
//# sourceMappingURL=consts.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"consts.js","sourceRoot":"/Users/tacb0ss/dev/nu-art/beamz/_thunderstorm/commando/src/main/","sources":["cli-params/consts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,MAAM,EAAW,MAAM,mBAAmB,CAAC;AAInD,MAAM,CAAC,MAAM,wBAAwB,GAAsC,CAAC,KAAc,EAAE,YAAsB,EAAW,EAAE;IAC9H,OAAO,IAAI,CAAC;AACb,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,uBAAuB,GAAqC,CAAC,KAAc,EAAE,YAAqB,EAAU,EAAE;IAC1H,IAAI,CAAC,KAAK,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC;QAC7B,IAAI,CAAC,MAAM,CAAC,YAAY,CAAC;YACxB,MAAM,IAAI,KAAK,CAAC,uBAAuB,CAAC,CAAC;QAE1C,OAAO,YAAY,CAAC;IACrB,CAAC;IAED,OAAO,KAAK,CAAC;AACd,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,uBAAuB,GAAqC,CAAC,KAAc,EAAE,YAAqB,EAAU,EAAE;IAC1H,IAAI,CAAC,KAAK,EAAE,CAAC;QACZ,IAAI,CAAC,MAAM,CAAC,YAAY,CAAC;YACxB,MAAM,IAAI,KAAK,CAAC,uBAAuB,CAAC,CAAC;QAE1C,OAAO,YAAY,CAAC;IACrB,CAAC;IAED,IAAI,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QACvB,MAAM,IAAI,KAAK,CAAC,uBAAuB,CAAC,CAAC;IAE1C,OAAO,MAAM,CAAC,KAAK,CAAC,CAAC;AACtB,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,uBAAuB,GAA4C;IAC/E,MAAM,EAAE,uBAAuB;IAC/B,OAAO,EAAE,wBAAwB;IACjC,MAAM,EAAE,uBAAuB;CAC/B,CAAC"}
|
package/cli-params/types.d.ts
CHANGED
package/cli-params/types.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
export {};
|
|
2
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"/Users/tacb0ss/dev/nu-art/beamz/_thunderstorm/commando/src/main/","sources":["cli-params/types.ts"],"names":[],"mappings":""}
|
package/package.json
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nu-art/commando",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.400.1",
|
|
4
4
|
"description": "",
|
|
5
|
+
"type": "module",
|
|
5
6
|
"keywords": [
|
|
6
7
|
"TacB0sS",
|
|
7
8
|
"infra",
|
|
@@ -13,8 +14,7 @@
|
|
|
13
14
|
"url": "https://github.com/nu-art-js/thunderstorm/issues"
|
|
14
15
|
},
|
|
15
16
|
"publishConfig": {
|
|
16
|
-
"directory": "dist"
|
|
17
|
-
"linkDirectory": true
|
|
17
|
+
"directory": "dist"
|
|
18
18
|
},
|
|
19
19
|
"repository": {
|
|
20
20
|
"type": "git",
|
|
@@ -22,8 +22,6 @@
|
|
|
22
22
|
},
|
|
23
23
|
"license": "Apache-2.0",
|
|
24
24
|
"author": "TacB0sS",
|
|
25
|
-
"main": "index.js",
|
|
26
|
-
"types": "index.d.ts",
|
|
27
25
|
"files": [
|
|
28
26
|
"**/*"
|
|
29
27
|
],
|
|
@@ -31,13 +29,19 @@
|
|
|
31
29
|
"build": "tsc"
|
|
32
30
|
},
|
|
33
31
|
"dependencies": {
|
|
34
|
-
"
|
|
35
|
-
"blessed": "^0.1.81",
|
|
36
|
-
"@nu-art/ts-common": "~0.300.0"
|
|
32
|
+
"@nu-art/ts-common": "0.400.1"
|
|
37
33
|
},
|
|
38
|
-
"
|
|
39
|
-
"
|
|
40
|
-
|
|
41
|
-
|
|
34
|
+
"unitConfig": {
|
|
35
|
+
"type": "typescript-lib"
|
|
36
|
+
},
|
|
37
|
+
"exports": {
|
|
38
|
+
".": {
|
|
39
|
+
"types": "./index.d.ts",
|
|
40
|
+
"import": "./index.js"
|
|
41
|
+
},
|
|
42
|
+
"./*": {
|
|
43
|
+
"types": "./*.d.ts",
|
|
44
|
+
"import": "./*.js"
|
|
45
|
+
}
|
|
42
46
|
}
|
|
43
|
-
}
|
|
47
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Constructor } from '@nu-art/ts-common';
|
|
2
|
-
import { CommandBuilder } from './CommandBuilder';
|
|
2
|
+
import { CommandBuilder } from './CommandBuilder.js';
|
|
3
3
|
export declare class BaseCommando {
|
|
4
4
|
protected readonly builder: CommandBuilder;
|
|
5
5
|
protected _debug: boolean;
|
|
@@ -8,7 +8,7 @@ export declare class BaseCommando {
|
|
|
8
8
|
* @param {Constructor<any>[]} plugins - The plugins to merge with BaseCommando.
|
|
9
9
|
* @returns The Super type merged of BaseCommando and all the plugins provided new instance of BaseCommando merged with the plugins.
|
|
10
10
|
*/
|
|
11
|
-
static _create<T extends Constructor<any>[]>(...plugins: T): import("./class-merger").MergeTypes<[typeof BaseCommando, ...T]> & BaseCommando;
|
|
11
|
+
static _create<T extends Constructor<any>[]>(...plugins: T): import("./class-merger.js").MergeTypes<[typeof BaseCommando, ...T]> & BaseCommando;
|
|
12
12
|
/**
|
|
13
13
|
* Constructs a BaseCommando instance.
|
|
14
14
|
*/
|
|
@@ -1,28 +1,26 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
class BaseCommando {
|
|
1
|
+
import { ImplementationMissingException } from '@nu-art/ts-common';
|
|
2
|
+
import { CommandBuilder } from './CommandBuilder.js';
|
|
3
|
+
import { CreateMergedInstance } from './class-merger.js';
|
|
4
|
+
export class BaseCommando {
|
|
5
|
+
builder;
|
|
6
|
+
_debug = false;
|
|
8
7
|
/**
|
|
9
8
|
* Creates a new instance of BaseCommando merged with the provided plugins.
|
|
10
9
|
* @param {Constructor<any>[]} plugins - The plugins to merge with BaseCommando.
|
|
11
10
|
* @returns The Super type merged of BaseCommando and all the plugins provided new instance of BaseCommando merged with the plugins.
|
|
12
11
|
*/
|
|
13
12
|
static _create(...plugins) {
|
|
14
|
-
const _commando =
|
|
13
|
+
const _commando = CreateMergedInstance(BaseCommando, ...plugins);
|
|
15
14
|
const commando = _commando;
|
|
16
15
|
// @ts-ignore
|
|
17
|
-
commando.builder = new
|
|
16
|
+
commando.builder = new CommandBuilder();
|
|
18
17
|
return commando;
|
|
19
18
|
}
|
|
20
19
|
/**
|
|
21
20
|
* Constructs a BaseCommando instance.
|
|
22
21
|
*/
|
|
23
22
|
constructor() {
|
|
24
|
-
this.
|
|
25
|
-
this.builder = new CommandBuilder_1.CommandBuilder();
|
|
23
|
+
this.builder = new CommandBuilder();
|
|
26
24
|
}
|
|
27
25
|
/**
|
|
28
26
|
* Toggles or sets the debug mode.
|
|
@@ -30,7 +28,7 @@ class BaseCommando {
|
|
|
30
28
|
* @returns {boolean} - The current state of debug mode.
|
|
31
29
|
*/
|
|
32
30
|
debug(debug) {
|
|
33
|
-
this._debug = debug
|
|
31
|
+
this._debug = debug ?? !this._debug;
|
|
34
32
|
return this;
|
|
35
33
|
}
|
|
36
34
|
/**
|
|
@@ -67,7 +65,7 @@ class BaseCommando {
|
|
|
67
65
|
return this;
|
|
68
66
|
}
|
|
69
67
|
async execute(callback) {
|
|
70
|
-
throw new
|
|
68
|
+
throw new ImplementationMissingException('need to override this method in your class');
|
|
71
69
|
}
|
|
72
70
|
}
|
|
73
|
-
|
|
71
|
+
//# sourceMappingURL=BaseCommando.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BaseCommando.js","sourceRoot":"/Users/tacb0ss/dev/nu-art/beamz/_thunderstorm/commando/src/main/","sources":["shell/core/BaseCommando.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,8BAA8B,EAAC,MAAM,mBAAmB,CAAC;AAC9E,OAAO,EAAC,cAAc,EAAC,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAC,oBAAoB,EAAC,MAAM,mBAAmB,CAAC;AAGvD,MAAM,OAAO,YAAY;IACL,OAAO,CAAiB;IACjC,MAAM,GAAY,KAAK,CAAC;IAElC;;;;OAIG;IACH,MAAM,CAAC,OAAO,CAA+B,GAAG,OAAU;QACzD,MAAM,SAAS,GAAG,oBAAoB,CAAC,YAAY,EAAE,GAAG,OAAO,CAAC,CAAC;QACjE,MAAM,QAAQ,GAAG,SAA4C,CAAC;QAC9D,aAAa;QACb,QAAQ,CAAC,OAAO,GAAG,IAAI,cAAc,EAAE,CAAC;QACxC,OAAO,QAAQ,CAAC;IACjB,CAAC;IAED;;OAEG;IACH;QACC,IAAI,CAAC,OAAO,GAAG,IAAI,cAAc,EAAE,CAAC;IACrC,CAAC;IAED;;;;OAIG;IACH,KAAK,CAAC,KAAe;QACpB,IAAI,CAAC,MAAM,GAAG,KAAK,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC;QACpC,OAAO,IAAI,CAAC;IACb,CAAC;IAED;;;;OAIG;IACH,MAAM,CAAC,OAAe;QACrB,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;QAC7B,OAAO,IAAI,CAAC;IACb,CAAC;IAED;;;OAGG;IACH,QAAQ;QACP,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC;QACxB,OAAO,IAAI,CAAC;IACb,CAAC;IAED;;;OAGG;IACH,SAAS;QACR,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,CAAC;QACzB,OAAO,IAAI,CAAC;IACb,CAAC;IAED;;;OAGG;IACI,SAAS;QACf,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,CAAC;QACzB,OAAO,IAAI,CAAC;IACb,CAAC;IAaD,KAAK,CAAC,OAAO,CAAI,QAAkE;QAClF,MAAM,IAAI,8BAA8B,CAAC,4CAA4C,CAAC,CAAC;IACxF,CAAC;CACD"}
|
package/shell/core/CliError.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import { CustomException } from '@nu-art/ts-common';
|
|
2
|
+
export class CliError extends CustomException {
|
|
3
|
+
stdout;
|
|
4
|
+
stderr;
|
|
5
|
+
cause;
|
|
6
6
|
constructor(message, stdout, stderr, cause) {
|
|
7
7
|
super(CliError, message, cause);
|
|
8
8
|
this.stdout = stdout;
|
|
@@ -10,8 +10,10 @@ class CliError extends ts_common_1.CustomException {
|
|
|
10
10
|
this.cause = cause;
|
|
11
11
|
}
|
|
12
12
|
}
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
export class CommandoException extends CustomException {
|
|
14
|
+
stdout;
|
|
15
|
+
stderr;
|
|
16
|
+
exitCode;
|
|
15
17
|
constructor(message, stdout, stderr, exitCode) {
|
|
16
18
|
super(CliError, message);
|
|
17
19
|
this.stdout = stdout;
|
|
@@ -19,4 +21,4 @@ class CommandoException extends ts_common_1.CustomException {
|
|
|
19
21
|
this.exitCode = exitCode;
|
|
20
22
|
}
|
|
21
23
|
}
|
|
22
|
-
|
|
24
|
+
//# sourceMappingURL=CliError.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CliError.js","sourceRoot":"/Users/tacb0ss/dev/nu-art/beamz/_thunderstorm/commando/src/main/","sources":["shell/core/CliError.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,eAAe,EAAC,MAAM,mBAAmB,CAAC;AAIlD,MAAM,OAAO,QACZ,SAAQ,eAAe;IAEvB,MAAM,CAAS;IACf,MAAM,CAAS;IACf,KAAK,CAAgB;IAErB,YAAY,OAAe,EAAE,MAAc,EAAE,MAAc,EAAE,KAAoB;QAChF,KAAK,CAAC,QAAQ,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC;QAChC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;IACpB,CAAC;CACD;AAED,MAAM,OAAO,iBACZ,SAAQ,eAAe;IAEvB,MAAM,CAAS;IACf,MAAM,CAAS;IACf,QAAQ,CAAS;IAEjB,YAAY,OAAe,EAAE,MAAc,EAAE,MAAc,EAAE,QAAgB;QAC5E,KAAK,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;QACzB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;IAC1B,CAAC;CACD"}
|
|
@@ -1,55 +1,40 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.CommandBuilder = void 0;
|
|
4
1
|
/**
|
|
5
2
|
* Default options for CommandBuilder class instances.
|
|
6
3
|
*/
|
|
7
4
|
const defaultOptions = {
|
|
8
|
-
newlineDelimiter: '\n
|
|
5
|
+
newlineDelimiter: '\n',
|
|
9
6
|
indentation: 2,
|
|
10
7
|
};
|
|
11
|
-
class CommandBuilder {
|
|
8
|
+
export class CommandBuilder {
|
|
9
|
+
commands = [];
|
|
10
|
+
indentation = 0;
|
|
11
|
+
option = defaultOptions;
|
|
12
12
|
/**
|
|
13
13
|
* Constructs a CommandBuilder instance with given options.
|
|
14
14
|
* @param {Partial<Options>} [options=defaultOptions] - Configuration options for the CommandBuilder instance.
|
|
15
15
|
*/
|
|
16
16
|
constructor(options = defaultOptions) {
|
|
17
|
-
this.commands = [];
|
|
18
|
-
this.indentation = 0;
|
|
19
|
-
this.option = defaultOptions;
|
|
20
|
-
/**
|
|
21
|
-
* Generates a string of spaces for indentation based on the current indentation level.
|
|
22
|
-
* @returns {string} - A string containing spaces for the current indentation level.
|
|
23
|
-
*/
|
|
24
|
-
this.getIndentation = () => {
|
|
25
|
-
return ' '.repeat(this.option.indentation * this.indentation);
|
|
26
|
-
};
|
|
27
|
-
/**
|
|
28
|
-
* Increases the current indentation level by one.
|
|
29
|
-
*/
|
|
30
|
-
this.indentIn = () => {
|
|
31
|
-
this.indentation++;
|
|
32
|
-
};
|
|
33
|
-
/**
|
|
34
|
-
* Decreases the current indentation level by one.
|
|
35
|
-
*/
|
|
36
|
-
this.indentOut = () => {
|
|
37
|
-
this.indentation--;
|
|
38
|
-
};
|
|
39
|
-
/**
|
|
40
|
-
* Appends a command to the command list with proper indentation.
|
|
41
|
-
* @param {string} command - The command to append.
|
|
42
|
-
* @returns {this} - The CommandBuilder instance for method chaining.
|
|
43
|
-
*/
|
|
44
|
-
this.append = (command) => {
|
|
45
|
-
const commands = command.split(this.option.newlineDelimiter);
|
|
46
|
-
for (const _command of commands) {
|
|
47
|
-
this.commands.push(`${this.getIndentation()}${_command.trim()}`);
|
|
48
|
-
}
|
|
49
|
-
return this;
|
|
50
|
-
};
|
|
51
17
|
this.option = options;
|
|
52
18
|
}
|
|
19
|
+
/**
|
|
20
|
+
* Generates a string of spaces for indentation based on the current indentation level.
|
|
21
|
+
* @returns {string} - A string containing spaces for the current indentation level.
|
|
22
|
+
*/
|
|
23
|
+
getIndentation = () => {
|
|
24
|
+
return ' '.repeat(this.option.indentation * this.indentation);
|
|
25
|
+
};
|
|
26
|
+
/**
|
|
27
|
+
* Increases the current indentation level by one.
|
|
28
|
+
*/
|
|
29
|
+
indentIn = () => {
|
|
30
|
+
this.indentation++;
|
|
31
|
+
};
|
|
32
|
+
/**
|
|
33
|
+
* Decreases the current indentation level by one.
|
|
34
|
+
*/
|
|
35
|
+
indentOut = () => {
|
|
36
|
+
this.indentation--;
|
|
37
|
+
};
|
|
53
38
|
/**
|
|
54
39
|
* Appends an empty line to the command list for readability.
|
|
55
40
|
* @returns {this} - The CommandBuilder instance for method chaining.
|
|
@@ -58,6 +43,22 @@ class CommandBuilder {
|
|
|
58
43
|
this.append('');
|
|
59
44
|
return this;
|
|
60
45
|
}
|
|
46
|
+
/**
|
|
47
|
+
* Appends a command to the command list with proper indentation.
|
|
48
|
+
* @param {string} command - The command to append.
|
|
49
|
+
* @returns {this} - The CommandBuilder instance for method chaining.
|
|
50
|
+
*/
|
|
51
|
+
append = (command) => {
|
|
52
|
+
const commands = command.split(this.option.newlineDelimiter);
|
|
53
|
+
for (const _command of commands) {
|
|
54
|
+
const command = _command.trim();
|
|
55
|
+
if (command.length === 0)
|
|
56
|
+
this.commands.push(command);
|
|
57
|
+
else
|
|
58
|
+
this.commands.push(`${this.getIndentation()}${command}`);
|
|
59
|
+
}
|
|
60
|
+
return this;
|
|
61
|
+
};
|
|
61
62
|
/**
|
|
62
63
|
* Retrieves the full command list as a single string.
|
|
63
64
|
* @returns {string} - The full command list.
|
|
@@ -75,4 +76,4 @@ class CommandBuilder {
|
|
|
75
76
|
return command;
|
|
76
77
|
}
|
|
77
78
|
}
|
|
78
|
-
|
|
79
|
+
//# sourceMappingURL=CommandBuilder.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CommandBuilder.js","sourceRoot":"/Users/tacb0ss/dev/nu-art/beamz/_thunderstorm/commando/src/main/","sources":["shell/core/CommandBuilder.ts"],"names":[],"mappings":"AAQA;;GAEG;AACH,MAAM,cAAc,GAAY;IAC/B,gBAAgB,EAAE,IAAI;IACtB,WAAW,EAAE,CAAC;CACd,CAAC;AAEF,MAAM,OAAO,cAAc;IAC1B,QAAQ,GAAa,EAAE,CAAC;IAChB,WAAW,GAAW,CAAC,CAAC;IACxB,MAAM,GAAY,cAAc,CAAC;IAEzC;;;OAGG;IACH,YAAY,UAA4B,cAAc;QACrD,IAAI,CAAC,MAAM,GAAG,OAAkB,CAAC;IAClC,CAAC;IAED;;;OAGG;IACO,cAAc,GAAG,GAAW,EAAE;QACvC,OAAO,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,WAAW,GAAG,IAAI,CAAC,WAAW,CAAC,CAAC;IAC/D,CAAC,CAAC;IAEF;;OAEG;IACM,QAAQ,GAAG,GAAG,EAAE;QACxB,IAAI,CAAC,WAAW,EAAE,CAAC;IACpB,CAAC,CAAC;IAEF;;OAEG;IACM,SAAS,GAAG,GAAG,EAAE;QACzB,IAAI,CAAC,WAAW,EAAE,CAAC;IACpB,CAAC,CAAC;IAEF;;;OAGG;IACI,SAAS;QACf,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;QAChB,OAAO,IAAI,CAAC;IACb,CAAC;IAED;;;;OAIG;IACM,MAAM,GAAG,CAAC,OAAe,EAAQ,EAAE;QAC3C,MAAM,QAAQ,GAAG,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,gBAAgB,CAAC,CAAC;QAC7D,KAAK,MAAM,QAAQ,IAAI,QAAQ,EAAE,CAAC;YACjC,MAAM,OAAO,GAAG,QAAQ,CAAC,IAAI,EAAE,CAAC;YAChC,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC;gBACvB,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;;gBAE5B,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,cAAc,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;QAC3D,CAAC;QAED,OAAO,IAAI,CAAC;IACb,CAAC,CAAC;IAEF;;;OAGG;IACH,UAAU;QACT,OAAO,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,gBAAgB,CAAC,CAAC;IACzD,CAAC;IAED;;;OAGG;IACH,KAAK;QACJ,MAAM,OAAO,GAAG,IAAI,CAAC,UAAU,EAAE,CAAC;QAClC,IAAI,CAAC,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAC;QACzB,OAAO,OAAO,CAAC;IAChB,CAAC;CACD"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Constructor } from '@nu-art/ts-common';
|
|
2
|
+
import { CommandoInteractive } from '../interactive/CommandoInteractive.js';
|
|
3
|
+
import { BaseCommando } from './BaseCommando.js';
|
|
4
|
+
import { Commando_Basic } from '../plugins/basic.js';
|
|
5
|
+
import { MergeTypes } from './class-merger.js';
|
|
6
|
+
export declare const CommandoPool: {
|
|
7
|
+
allocateCommando: <T extends Constructor<any>[]>(uid: string, ...plugins: T) => MergeTypes<[...T]> & CommandoInteractive & BaseCommando & Commando_Basic;
|
|
8
|
+
killAll: () => Promise<void>;
|
|
9
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { CommandoInteractive } from '../interactive/CommandoInteractive.js';
|
|
2
|
+
import { Commando_Basic } from '../plugins/basic.js';
|
|
3
|
+
const commandoPool = [];
|
|
4
|
+
export const CommandoPool = {
|
|
5
|
+
allocateCommando: (uid, ...plugins) => {
|
|
6
|
+
const commando = CommandoInteractive.create(...plugins, Commando_Basic);
|
|
7
|
+
commando.setUID(uid);
|
|
8
|
+
commandoPool.push(commando);
|
|
9
|
+
return commando;
|
|
10
|
+
},
|
|
11
|
+
killAll: async () => {
|
|
12
|
+
await Promise.all(commandoPool.map(c => c.kill()));
|
|
13
|
+
}
|
|
14
|
+
};
|
|
15
|
+
//# sourceMappingURL=CommandoPool.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CommandoPool.js","sourceRoot":"/Users/tacb0ss/dev/nu-art/beamz/_thunderstorm/commando/src/main/","sources":["shell/core/CommandoPool.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,mBAAmB,EAAC,MAAM,uCAAuC,CAAC;AAE1E,OAAO,EAAC,cAAc,EAAC,MAAM,qBAAqB,CAAC;AAGnD,MAAM,YAAY,GAA4D,EAAE,CAAC;AAEjF,MAAM,CAAC,MAAM,YAAY,GAAG;IAC3B,gBAAgB,EAAE,CAA+B,GAAW,EAAE,GAAG,OAAU,EAA4E,EAAE;QACxJ,MAAM,QAAQ,GAAG,mBAAmB,CAAC,MAAM,CAAC,GAAG,OAAO,EAAE,cAAc,CAAwF,CAAC;QAC/J,QAAQ,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;QACrB,YAAY,CAAC,IAAI,CAAC,QAA0E,CAAC,CAAC;QAC9F,OAAO,QAAQ,CAAC;IACjB,CAAC;IACD,OAAO,EAAE,KAAK,IAAI,EAAE;QACnB,MAAM,OAAO,CAAC,GAAG,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;IACpD,CAAC;CACD,CAAC"}
|
|
@@ -1,14 +1,10 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.MergeClass = MergeClass;
|
|
4
|
-
exports.CreateMergedInstance = CreateMergedInstance;
|
|
5
1
|
/**
|
|
6
2
|
* Function to merge multiple classes into a single class.
|
|
7
3
|
* @template T - An array of constructors.
|
|
8
4
|
* @param {...T} plugins - The constructors to merge.
|
|
9
5
|
* @returns {Constructor<MergeTypes<T>>} - A new constructor that merges all the provided constructors.
|
|
10
6
|
*/
|
|
11
|
-
function MergeClass(...plugins) {
|
|
7
|
+
export function MergeClass(...plugins) {
|
|
12
8
|
class SuperClass {
|
|
13
9
|
/**
|
|
14
10
|
* Constructs an instance of SuperClass, merging properties from all plugins.
|
|
@@ -33,7 +29,8 @@ function MergeClass(...plugins) {
|
|
|
33
29
|
* @param {...T} plugins - The constructors to merge.
|
|
34
30
|
* @returns {MergeTypes<T>} - An instance of the merged class.
|
|
35
31
|
*/
|
|
36
|
-
function CreateMergedInstance(...plugins) {
|
|
32
|
+
export function CreateMergedInstance(...plugins) {
|
|
37
33
|
const SuperClass = MergeClass(...plugins);
|
|
38
34
|
return new SuperClass();
|
|
39
35
|
}
|
|
36
|
+
//# sourceMappingURL=class-merger.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"class-merger.js","sourceRoot":"/Users/tacb0ss/dev/nu-art/beamz/_thunderstorm/commando/src/main/","sources":["shell/core/class-merger.ts"],"names":[],"mappings":"AAcA;;;;;GAKG;AACH,MAAM,UAAU,UAAU,CAA+B,GAAG,OAAU;IACrE,MAAM,UAAU;QACf;;;WAGG;QACH,YAAY,GAAG,IAAW;YACzB,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE;gBACxB,MAAM,CAAC,mBAAmB,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE;oBAC3D,MAAM,IAAI,GAAG,MAAM,CAAC,wBAAwB,CAAC,MAAM,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC;oBACrE,IAAI,IAAI,EAAE,CAAC;wBACV,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;oBACzC,CAAC;gBACF,CAAC,CAAC,CAAC;YACJ,CAAC,CAAC,CAAC;QACJ,CAAC;KACD;IAED,OAAO,UAAwC,CAAC;AACjD,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,oBAAoB,CAA+B,GAAG,OAAU;IAC/E,MAAM,UAAU,GAAG,UAAU,CAAC,GAAG,OAAO,CAAC,CAAC;IAC1C,OAAO,IAAI,UAAU,EAAmB,CAAC;AAC1C,CAAC"}
|
package/shell/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from './interactive/CommandoInteractive';
|
|
2
|
-
export * from './simple/Commando';
|
|
1
|
+
export * from './interactive/CommandoInteractive.js';
|
|
2
|
+
export * from './simple/Commando.js';
|
package/shell/index.js
CHANGED
|
@@ -1,18 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./interactive/CommandoInteractive"), exports);
|
|
18
|
-
__exportStar(require("./simple/Commando"), exports);
|
|
1
|
+
export * from './interactive/CommandoInteractive.js';
|
|
2
|
+
export * from './simple/Commando.js';
|
|
3
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"/Users/tacb0ss/dev/nu-art/beamz/_thunderstorm/commando/src/main/","sources":["shell/index.ts"],"names":[],"mappings":"AAAA,cAAc,sCAAsC,CAAC;AACrD,cAAc,sBAAsB,CAAC"}
|