@bemoje/cli 0.0.20 → 0.0.21
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 +3 -3
- package/cjs/arg/ArgumentBuilder.d.ts +0 -23
- package/cjs/arg/ArgumentBuilder.d.ts.map +0 -1
- package/cjs/arg/ArgumentBuilder.js +0 -52
- package/cjs/arg/ArgumentBuilder.js.map +0 -1
- package/cjs/arg/ArgumentParserSelector.d.ts +0 -9
- package/cjs/arg/ArgumentParserSelector.d.ts.map +0 -1
- package/cjs/arg/ArgumentParserSelector.js +0 -15
- package/cjs/arg/ArgumentParserSelector.js.map +0 -1
- package/cjs/arg/ArgumentReader.d.ts +0 -15
- package/cjs/arg/ArgumentReader.d.ts.map +0 -1
- package/cjs/arg/ArgumentReader.js +0 -38
- package/cjs/arg/ArgumentReader.js.map +0 -1
- package/cjs/arg/ArgumentValidatorSelector.d.ts +0 -8
- package/cjs/arg/ArgumentValidatorSelector.d.ts.map +0 -1
- package/cjs/arg/ArgumentValidatorSelector.js +0 -16
- package/cjs/arg/ArgumentValidatorSelector.js.map +0 -1
- package/cjs/cmd/CommandBuilder.d.ts +0 -382
- package/cjs/cmd/CommandBuilder.d.ts.map +0 -1
- package/cjs/cmd/CommandBuilder.js +0 -1235
- package/cjs/cmd/CommandBuilder.js.map +0 -1
- package/cjs/cmd/CommandBuilderMetaData.d.ts +0 -26
- package/cjs/cmd/CommandBuilderMetaData.d.ts.map +0 -1
- package/cjs/cmd/CommandBuilderMetaData.js +0 -45
- package/cjs/cmd/CommandBuilderMetaData.js.map +0 -1
- package/cjs/cmd/CommandFeatureSelector.d.ts +0 -80
- package/cjs/cmd/CommandFeatureSelector.d.ts.map +0 -1
- package/cjs/cmd/CommandFeatureSelector.js +0 -112
- package/cjs/cmd/CommandFeatureSelector.js.map +0 -1
- package/cjs/cmd/DefaultHelpConfig.d.ts +0 -29
- package/cjs/cmd/DefaultHelpConfig.d.ts.map +0 -1
- package/cjs/cmd/DefaultHelpConfig.js +0 -141
- package/cjs/cmd/DefaultHelpConfig.js.map +0 -1
- package/cjs/core/OutputManager.d.ts +0 -64
- package/cjs/core/OutputManager.d.ts.map +0 -1
- package/cjs/core/OutputManager.js +0 -97
- package/cjs/core/OutputManager.js.map +0 -1
- package/cjs/core/ParserSelector.d.ts +0 -17
- package/cjs/core/ParserSelector.d.ts.map +0 -1
- package/cjs/core/ParserSelector.js +0 -36
- package/cjs/core/ParserSelector.js.map +0 -1
- package/cjs/core/ValidatorSelector.d.ts +0 -17
- package/cjs/core/ValidatorSelector.d.ts.map +0 -1
- package/cjs/core/ValidatorSelector.js +0 -36
- package/cjs/core/ValidatorSelector.js.map +0 -1
- package/cjs/core/splitCombinedArgvShorts.d.ts +0 -2
- package/cjs/core/splitCombinedArgvShorts.d.ts.map +0 -1
- package/cjs/core/splitCombinedArgvShorts.js +0 -15
- package/cjs/core/splitCombinedArgvShorts.js.map +0 -1
- package/cjs/db/AbstractJsonFileSection.d.ts +0 -136
- package/cjs/db/AbstractJsonFileSection.d.ts.map +0 -1
- package/cjs/db/AbstractJsonFileSection.js +0 -189
- package/cjs/db/AbstractJsonFileSection.js.map +0 -1
- package/cjs/db/AppDataSection.d.ts +0 -30
- package/cjs/db/AppDataSection.d.ts.map +0 -1
- package/cjs/db/AppDataSection.js +0 -48
- package/cjs/db/AppDataSection.js.map +0 -1
- package/cjs/db/ConfigSection.d.ts +0 -46
- package/cjs/db/ConfigSection.d.ts.map +0 -1
- package/cjs/db/ConfigSection.js +0 -70
- package/cjs/db/ConfigSection.js.map +0 -1
- package/cjs/db/JsonFile.d.ts +0 -36
- package/cjs/db/JsonFile.d.ts.map +0 -1
- package/cjs/db/JsonFile.js +0 -54
- package/cjs/db/JsonFile.js.map +0 -1
- package/cjs/db/PresetsSection.d.ts +0 -45
- package/cjs/db/PresetsSection.d.ts.map +0 -1
- package/cjs/db/PresetsSection.js +0 -92
- package/cjs/db/PresetsSection.js.map +0 -1
- package/cjs/index.d.ts +0 -25
- package/cjs/index.d.ts.map +0 -1
- package/cjs/index.js +0 -28
- package/cjs/index.js.map +0 -1
- package/cjs/opt/OptionArgumentParserSelector.d.ts +0 -8
- package/cjs/opt/OptionArgumentParserSelector.d.ts.map +0 -1
- package/cjs/opt/OptionArgumentParserSelector.js +0 -16
- package/cjs/opt/OptionArgumentParserSelector.js.map +0 -1
- package/cjs/opt/OptionArgumentValidatorSelector.d.ts +0 -8
- package/cjs/opt/OptionArgumentValidatorSelector.d.ts.map +0 -1
- package/cjs/opt/OptionArgumentValidatorSelector.js +0 -19
- package/cjs/opt/OptionArgumentValidatorSelector.js.map +0 -1
- package/cjs/opt/OptionBuilder.d.ts +0 -32
- package/cjs/opt/OptionBuilder.d.ts.map +0 -1
- package/cjs/opt/OptionBuilder.js +0 -94
- package/cjs/opt/OptionBuilder.js.map +0 -1
- package/cjs/opt/OptionHelpers.d.ts +0 -33
- package/cjs/opt/OptionHelpers.d.ts.map +0 -1
- package/cjs/opt/OptionHelpers.js +0 -57
- package/cjs/opt/OptionHelpers.js.map +0 -1
- package/cjs/opt/OptionReader.d.ts +0 -24
- package/cjs/opt/OptionReader.d.ts.map +0 -1
- package/cjs/opt/OptionReader.js +0 -66
- package/cjs/opt/OptionReader.js.map +0 -1
- package/cjs/types/IConfig.d.ts +0 -22
- package/cjs/types/IConfig.d.ts.map +0 -1
- package/cjs/types/IConfig.js +0 -3
- package/cjs/types/IConfig.js.map +0 -1
- package/cjs/types/IPreset.d.ts +0 -15
- package/cjs/types/IPreset.d.ts.map +0 -1
- package/cjs/types/IPreset.js +0 -3
- package/cjs/types/IPreset.js.map +0 -1
- package/esm/arg/ArgumentBuilder.js +0 -48
- package/esm/arg/ArgumentBuilder.js.map +0 -1
- package/esm/arg/ArgumentParserSelector.js +0 -11
- package/esm/arg/ArgumentParserSelector.js.map +0 -1
- package/esm/arg/ArgumentReader.js +0 -34
- package/esm/arg/ArgumentReader.js.map +0 -1
- package/esm/arg/ArgumentValidatorSelector.js +0 -12
- package/esm/arg/ArgumentValidatorSelector.js.map +0 -1
- package/esm/cmd/CommandBuilder.js +0 -1229
- package/esm/cmd/CommandBuilder.js.map +0 -1
- package/esm/cmd/CommandBuilderMetaData.js +0 -41
- package/esm/cmd/CommandBuilderMetaData.js.map +0 -1
- package/esm/cmd/CommandFeatureSelector.js +0 -108
- package/esm/cmd/CommandFeatureSelector.js.map +0 -1
- package/esm/cmd/DefaultHelpConfig.js +0 -137
- package/esm/cmd/DefaultHelpConfig.js.map +0 -1
- package/esm/core/OutputManager.js +0 -92
- package/esm/core/OutputManager.js.map +0 -1
- package/esm/core/ParserSelector.js +0 -32
- package/esm/core/ParserSelector.js.map +0 -1
- package/esm/core/ValidatorSelector.js +0 -32
- package/esm/core/ValidatorSelector.js.map +0 -1
- package/esm/core/splitCombinedArgvShorts.js +0 -11
- package/esm/core/splitCombinedArgvShorts.js.map +0 -1
- package/esm/db/AbstractJsonFileSection.js +0 -185
- package/esm/db/AbstractJsonFileSection.js.map +0 -1
- package/esm/db/AppDataSection.js +0 -44
- package/esm/db/AppDataSection.js.map +0 -1
- package/esm/db/ConfigSection.js +0 -66
- package/esm/db/ConfigSection.js.map +0 -1
- package/esm/db/JsonFile.js +0 -50
- package/esm/db/JsonFile.js.map +0 -1
- package/esm/db/PresetsSection.js +0 -88
- package/esm/db/PresetsSection.js.map +0 -1
- package/esm/index.js +0 -25
- package/esm/index.js.map +0 -1
- package/esm/opt/OptionArgumentParserSelector.js +0 -12
- package/esm/opt/OptionArgumentParserSelector.js.map +0 -1
- package/esm/opt/OptionArgumentValidatorSelector.js +0 -15
- package/esm/opt/OptionArgumentValidatorSelector.js.map +0 -1
- package/esm/opt/OptionBuilder.js +0 -90
- package/esm/opt/OptionBuilder.js.map +0 -1
- package/esm/opt/OptionHelpers.js +0 -54
- package/esm/opt/OptionHelpers.js.map +0 -1
- package/esm/opt/OptionReader.js +0 -62
- package/esm/opt/OptionReader.js.map +0 -1
- package/esm/types/IConfig.js +0 -2
- package/esm/types/IConfig.js.map +0 -1
- package/esm/types/IPreset.js +0 -2
- package/esm/types/IPreset.js.map +0 -1
package/cjs/db/AppDataSection.js
DELETED
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.AppDataSection = void 0;
|
|
4
|
-
const AbstractJsonFileSection_1 = require("./AbstractJsonFileSection");
|
|
5
|
-
/**
|
|
6
|
-
* A class that represents the appdata section of the JSON file used as simple database.
|
|
7
|
-
*/
|
|
8
|
-
class AppDataSection extends AbstractJsonFileSection_1.AbstractJsonFileSection {
|
|
9
|
-
/**
|
|
10
|
-
* Creates an instance of AppDataSection.
|
|
11
|
-
* @param file - The parent JsonFile instance.
|
|
12
|
-
* @param name - The name of the section.
|
|
13
|
-
*/
|
|
14
|
-
constructor(file, name) {
|
|
15
|
-
super(file, name, false);
|
|
16
|
-
}
|
|
17
|
-
/**
|
|
18
|
-
* Does nothing
|
|
19
|
-
*/
|
|
20
|
-
assertValid() {
|
|
21
|
-
return;
|
|
22
|
-
}
|
|
23
|
-
/**
|
|
24
|
-
* Defines a property for the section.
|
|
25
|
-
* @param key - The key of the property.
|
|
26
|
-
*/
|
|
27
|
-
defineProperty(key, value) {
|
|
28
|
-
if (typeof value === 'object')
|
|
29
|
-
value = JSON.parse(JSON.stringify(value));
|
|
30
|
-
this.defaultValues[key] = value;
|
|
31
|
-
this.isInitialized = false;
|
|
32
|
-
}
|
|
33
|
-
/**
|
|
34
|
-
* Initializes the section.
|
|
35
|
-
* @param save - Indicates whether to save the section after initialization.
|
|
36
|
-
* @returns A string if an error occurred during initialization, otherwise void.
|
|
37
|
-
*/
|
|
38
|
-
initialize(save = false) {
|
|
39
|
-
if (this.isInitialized)
|
|
40
|
-
return;
|
|
41
|
-
const data = this.db.getSafe(this.prefix());
|
|
42
|
-
if (!data)
|
|
43
|
-
this.db.set(this.prefix(), this.defaultValues, save);
|
|
44
|
-
this.isInitialized = true;
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
exports.AppDataSection = AppDataSection;
|
|
48
|
-
//# sourceMappingURL=AppDataSection.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"AppDataSection.js","sourceRoot":"","sources":["../../../../../packages/cli/src/db/AppDataSection.ts"],"names":[],"mappings":";;;AAAA,uEAAmE;AAInE;;GAEG;AACH,MAAa,cAAkD,SAAQ,iDAA4B;IACjG;;;;OAIG;IACH,YAAY,IAAc,EAAE,IAAY;QACtC,KAAK,CAAC,IAAI,EAAE,IAAI,EAAE,KAAK,CAAC,CAAA;IAC1B,CAAC;IAED;;OAEG;IACM,WAAW;QAClB,OAAM;IACR,CAAC;IAED;;;OAGG;IACM,cAAc,CAAC,GAAW,EAAE,KAAU;QAC7C,IAAI,OAAO,KAAK,KAAK,QAAQ;YAAE,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAQ,CAAA;QAC/E,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,GAAG,KAAK,CAAA;QAC/B,IAAI,CAAC,aAAa,GAAG,KAAK,CAAA;IAC5B,CAAC;IAED;;;;OAIG;IACM,UAAU,CAAC,IAAI,GAAG,KAAK;QAC9B,IAAI,IAAI,CAAC,aAAa;YAAE,OAAM;QAC9B,MAAM,IAAI,GAAG,IAAI,CAAC,EAAE,CAAC,OAAO,CAAsB,IAAI,CAAC,MAAM,EAAE,CAAC,CAAA;QAChE,IAAI,CAAC,IAAI;YAAE,IAAI,CAAC,EAAE,CAAC,GAAG,CAAC,IAAI,CAAC,MAAM,EAAE,EAAE,IAAI,CAAC,aAAa,EAAE,IAAI,CAAC,CAAA;QAC/D,IAAI,CAAC,aAAa,GAAG,IAAI,CAAA;IAC3B,CAAC;CACF;AAtCD,wCAsCC"}
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import { AbstractJsonFileSection } from './AbstractJsonFileSection';
|
|
2
|
-
import { JsonValue, TStringParser, TValidator } from '@bemoje/util';
|
|
3
|
-
import type { IConfig } from '../types/IConfig';
|
|
4
|
-
import { JsonFile } from './JsonFile';
|
|
5
|
-
/**
|
|
6
|
-
* A class that represents the user-config section of the JSON file used as simple database.
|
|
7
|
-
*/
|
|
8
|
-
export declare class ConfigSection<Val extends JsonValue = JsonValue> extends AbstractJsonFileSection<Val> {
|
|
9
|
-
/**
|
|
10
|
-
* String parsers for when editing config from command-line.
|
|
11
|
-
*/
|
|
12
|
-
readonly parsers: Record<string, TStringParser<Val>>;
|
|
13
|
-
/**
|
|
14
|
-
* Descriptions for each property key.
|
|
15
|
-
*/
|
|
16
|
-
readonly descriptions: Record<string, string>;
|
|
17
|
-
/**
|
|
18
|
-
* Validators for each property key.
|
|
19
|
-
*/
|
|
20
|
-
readonly validators: Record<string, TValidator<Val>>;
|
|
21
|
-
/**
|
|
22
|
-
* Creates an instance of AbstractJsonFileSection.
|
|
23
|
-
* @param file - The parent JsonFile instance.
|
|
24
|
-
* @param name - The name of the section.
|
|
25
|
-
*/
|
|
26
|
-
constructor(file: JsonFile, name: string);
|
|
27
|
-
/**
|
|
28
|
-
* Asserts that a key-value pair is valid.
|
|
29
|
-
* @param key - The key to assert.
|
|
30
|
-
* @param value - The value to assert.
|
|
31
|
-
*/
|
|
32
|
-
assertValid(key: string, value: Val): void;
|
|
33
|
-
/**
|
|
34
|
-
* Defines a property for the section.
|
|
35
|
-
* @param key - The key of the property.
|
|
36
|
-
* @param options - The options for the property.
|
|
37
|
-
*/
|
|
38
|
-
defineProperty(key: string, options: IConfig<Val>): void;
|
|
39
|
-
/**
|
|
40
|
-
* Initializes the section.
|
|
41
|
-
* @param save - Indicates whether to save the section after initialization.
|
|
42
|
-
* @returns A string if an error occurred during initialization, otherwise void.
|
|
43
|
-
*/
|
|
44
|
-
initialize(save?: boolean): void;
|
|
45
|
-
}
|
|
46
|
-
//# sourceMappingURL=ConfigSection.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ConfigSection.d.ts","sourceRoot":"","sources":["../../../../../packages/cli/src/db/ConfigSection.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAA;AACnE,OAAO,EAAc,SAAS,EAAa,aAAa,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AAC1F,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAA;AAC/C,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AAErC;;GAEG;AACH,qBAAa,aAAa,CAAC,GAAG,SAAS,SAAS,GAAG,SAAS,CAAE,SAAQ,uBAAuB,CAAC,GAAG,CAAC;IAChG;;OAEG;IACH,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,GAAG,CAAC,CAAC,CAAK;IAEzD;;OAEG;IACH,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAK;IAElD;;OAEG;IACH,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,GAAG,CAAC,CAAC,CAAK;IAEzD;;;;OAIG;gBACS,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM;IAIxC;;;;OAIG;IACM,WAAW,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG;IAK5C;;;;OAIG;IACM,cAAc,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,CAAC,GAAG,CAAC;IAS1D;;;;OAIG;IACM,UAAU,CAAC,IAAI,UAAQ;CAOjC"}
|
package/cjs/db/ConfigSection.js
DELETED
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ConfigSection = void 0;
|
|
4
|
-
const AbstractJsonFileSection_1 = require("./AbstractJsonFileSection");
|
|
5
|
-
const util_1 = require("@bemoje/util");
|
|
6
|
-
/**
|
|
7
|
-
* A class that represents the user-config section of the JSON file used as simple database.
|
|
8
|
-
*/
|
|
9
|
-
class ConfigSection extends AbstractJsonFileSection_1.AbstractJsonFileSection {
|
|
10
|
-
/**
|
|
11
|
-
* String parsers for when editing config from command-line.
|
|
12
|
-
*/
|
|
13
|
-
parsers = {};
|
|
14
|
-
/**
|
|
15
|
-
* Descriptions for each property key.
|
|
16
|
-
*/
|
|
17
|
-
descriptions = {};
|
|
18
|
-
/**
|
|
19
|
-
* Validators for each property key.
|
|
20
|
-
*/
|
|
21
|
-
validators = {};
|
|
22
|
-
/**
|
|
23
|
-
* Creates an instance of AbstractJsonFileSection.
|
|
24
|
-
* @param file - The parent JsonFile instance.
|
|
25
|
-
* @param name - The name of the section.
|
|
26
|
-
*/
|
|
27
|
-
constructor(file, name) {
|
|
28
|
-
super(file, name, true);
|
|
29
|
-
}
|
|
30
|
-
/**
|
|
31
|
-
* Asserts that a key-value pair is valid.
|
|
32
|
-
* @param key - The key to assert.
|
|
33
|
-
* @param value - The value to assert.
|
|
34
|
-
*/
|
|
35
|
-
assertValid(key, value) {
|
|
36
|
-
if (!this.validators[key])
|
|
37
|
-
return;
|
|
38
|
-
(0, util_1.ensureThat)(value, this.validators[key]);
|
|
39
|
-
}
|
|
40
|
-
/**
|
|
41
|
-
* Defines a property for the section.
|
|
42
|
-
* @param key - The key of the property.
|
|
43
|
-
* @param options - The options for the property.
|
|
44
|
-
*/
|
|
45
|
-
defineProperty(key, options) {
|
|
46
|
-
const { description, defaultValue, parse, validate } = options;
|
|
47
|
-
this.descriptions[key] = description;
|
|
48
|
-
this.defaultValues[key] = typeof defaultValue === 'object' ? JSON.parse(JSON.stringify(defaultValue)) : defaultValue;
|
|
49
|
-
if (parse)
|
|
50
|
-
this.parsers[key] = parse;
|
|
51
|
-
if (validate)
|
|
52
|
-
this.validators[key] = validate;
|
|
53
|
-
this.assertValid(key, options.defaultValue);
|
|
54
|
-
}
|
|
55
|
-
/**
|
|
56
|
-
* Initializes the section.
|
|
57
|
-
* @param save - Indicates whether to save the section after initialization.
|
|
58
|
-
* @returns A string if an error occurred during initialization, otherwise void.
|
|
59
|
-
*/
|
|
60
|
-
initialize(save = false) {
|
|
61
|
-
if (this.isInitialized)
|
|
62
|
-
return;
|
|
63
|
-
const data = this.db.getSafe(this.prefix());
|
|
64
|
-
const result = (0, util_1.objAssign)({}, JSON.parse(JSON.stringify(this.defaultValues)), data || {});
|
|
65
|
-
this.db.set(this.prefix(), result, save);
|
|
66
|
-
this.isInitialized = true;
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
exports.ConfigSection = ConfigSection;
|
|
70
|
-
//# sourceMappingURL=ConfigSection.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ConfigSection.js","sourceRoot":"","sources":["../../../../../packages/cli/src/db/ConfigSection.ts"],"names":[],"mappings":";;;AAAA,uEAAmE;AACnE,uCAA0F;AAI1F;;GAEG;AACH,MAAa,aAAiD,SAAQ,iDAA4B;IAChG;;OAEG;IACM,OAAO,GAAuC,EAAE,CAAA;IAEzD;;OAEG;IACM,YAAY,GAA2B,EAAE,CAAA;IAElD;;OAEG;IACM,UAAU,GAAoC,EAAE,CAAA;IAEzD;;;;OAIG;IACH,YAAY,IAAc,EAAE,IAAY;QACtC,KAAK,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,CAAA;IACzB,CAAC;IAED;;;;OAIG;IACM,WAAW,CAAC,GAAW,EAAE,KAAU;QAC1C,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC;YAAE,OAAM;QACjC,IAAA,iBAAU,EAAC,KAAK,EAAE,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAA;IACzC,CAAC;IAED;;;;OAIG;IACM,cAAc,CAAC,GAAW,EAAE,OAAqB;QACxD,MAAM,EAAE,WAAW,EAAE,YAAY,EAAE,KAAK,EAAE,QAAQ,EAAE,GAAG,OAAO,CAAA;QAC9D,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,GAAG,WAAW,CAAA;QACpC,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,GAAG,OAAO,YAAY,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,CAAC,YAAY,CAAA;QACpH,IAAI,KAAK;YAAE,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,KAAK,CAAA;QACpC,IAAI,QAAQ;YAAE,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,GAAG,QAAQ,CAAA;QAC7C,IAAI,CAAC,WAAW,CAAC,GAAG,EAAE,OAAO,CAAC,YAAY,CAAC,CAAA;IAC7C,CAAC;IAED;;;;OAIG;IACM,UAAU,CAAC,IAAI,GAAG,KAAK;QAC9B,IAAI,IAAI,CAAC,aAAa;YAAE,OAAM;QAC9B,MAAM,IAAI,GAAG,IAAI,CAAC,EAAE,CAAC,OAAO,CAAsB,IAAI,CAAC,MAAM,EAAE,CAAC,CAAA;QAChE,MAAM,MAAM,GAAG,IAAA,gBAAS,EAAC,EAAE,EAAE,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,EAAE,IAAI,IAAI,EAAE,CAAC,CAAA;QACxF,IAAI,CAAC,EAAE,CAAC,GAAG,CAAC,IAAI,CAAC,MAAM,EAAE,EAAE,MAAM,EAAE,IAAI,CAAC,CAAA;QACxC,IAAI,CAAC,aAAa,GAAG,IAAI,CAAA;IAC3B,CAAC;CACF;AA7DD,sCA6DC"}
|
package/cjs/db/JsonFile.d.ts
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { AppDataSection } from './AppDataSection';
|
|
2
|
-
import { CommandBuilder } from '../cmd/CommandBuilder';
|
|
3
|
-
import { ConfigSection } from './ConfigSection';
|
|
4
|
-
import { JsonDB } from '@bemoje/util';
|
|
5
|
-
import { PresetsSection } from './PresetsSection';
|
|
6
|
-
/**
|
|
7
|
-
* A class that represents the JSON file used as a simple database.
|
|
8
|
-
*/
|
|
9
|
-
export declare class JsonFile {
|
|
10
|
-
readonly cmd: CommandBuilder;
|
|
11
|
-
/**
|
|
12
|
-
* @param cmd The parent CommandBuilder instance.
|
|
13
|
-
*/
|
|
14
|
-
constructor(cmd: CommandBuilder);
|
|
15
|
-
/**
|
|
16
|
-
* A lazy-loaded instance of the JsonDB instance containing the data.
|
|
17
|
-
* Upon first property access, it is stored as a property on the instance.
|
|
18
|
-
* If the command is a subcommand, the root command's JsonDB instance is returned.
|
|
19
|
-
*/
|
|
20
|
-
get db(): JsonDB;
|
|
21
|
-
/**
|
|
22
|
-
* A lazy-loaded instance of the `config` section of the JSON file.
|
|
23
|
-
* Upon first property access, it is stored as a property on the instance.
|
|
24
|
-
*/
|
|
25
|
-
get config(): ConfigSection;
|
|
26
|
-
/**
|
|
27
|
-
* A lazy-loaded instance of the `appData` section of the JSON file.
|
|
28
|
-
* Upon first property access, it is stored as a property on the instance.
|
|
29
|
-
*/
|
|
30
|
-
get appData(): AppDataSection;
|
|
31
|
-
/**
|
|
32
|
-
* A lazy-loaded instance of the `presets` section of the JSON file.
|
|
33
|
-
*/
|
|
34
|
-
get presets(): PresetsSection;
|
|
35
|
-
}
|
|
36
|
-
//# sourceMappingURL=JsonFile.d.ts.map
|
package/cjs/db/JsonFile.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"JsonFile.d.ts","sourceRoot":"","sources":["../../../../../packages/cli/src/db/JsonFile.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;AACjD,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAA;AACtD,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAC/C,OAAO,EAAE,MAAM,EAAuB,MAAM,cAAc,CAAA;AAC1D,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;AAEjD;;GAEG;AACH,qBAAa,QAAQ;IAIP,QAAQ,CAAC,GAAG,EAAE,cAAc;IAHxC;;OAEG;gBACkB,GAAG,EAAE,cAAc;IAExC;;;;OAIG;IACH,IAAI,EAAE,IAAI,MAAM,CAMf;IAED;;;OAGG;IACH,IAAI,MAAM,IAAI,aAAa,CAE1B;IAED;;;OAGG;IACH,IAAI,OAAO,IAAI,cAAc,CAE5B;IAED;;OAEG;IACH,IAAI,OAAO,IAAI,cAAc,CAE5B;CACF"}
|
package/cjs/db/JsonFile.js
DELETED
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.JsonFile = void 0;
|
|
4
|
-
const AppDataSection_1 = require("./AppDataSection");
|
|
5
|
-
const ConfigSection_1 = require("./ConfigSection");
|
|
6
|
-
const util_1 = require("@bemoje/util");
|
|
7
|
-
const PresetsSection_1 = require("./PresetsSection");
|
|
8
|
-
/**
|
|
9
|
-
* A class that represents the JSON file used as a simple database.
|
|
10
|
-
*/
|
|
11
|
-
class JsonFile {
|
|
12
|
-
cmd;
|
|
13
|
-
/**
|
|
14
|
-
* @param cmd The parent CommandBuilder instance.
|
|
15
|
-
*/
|
|
16
|
-
constructor(cmd) {
|
|
17
|
-
this.cmd = cmd;
|
|
18
|
-
}
|
|
19
|
-
/**
|
|
20
|
-
* A lazy-loaded instance of the JsonDB instance containing the data.
|
|
21
|
-
* Upon first property access, it is stored as a property on the instance.
|
|
22
|
-
* If the command is a subcommand, the root command's JsonDB instance is returned.
|
|
23
|
-
*/
|
|
24
|
-
get db() {
|
|
25
|
-
if (this.cmd.isRoot) {
|
|
26
|
-
return (0, util_1.realizeLazyProperty)(this, 'db', new util_1.JsonDB(this.cmd.jsonFilepath, 2));
|
|
27
|
-
}
|
|
28
|
-
else {
|
|
29
|
-
return this.cmd.root.db.db;
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
/**
|
|
33
|
-
* A lazy-loaded instance of the `config` section of the JSON file.
|
|
34
|
-
* Upon first property access, it is stored as a property on the instance.
|
|
35
|
-
*/
|
|
36
|
-
get config() {
|
|
37
|
-
return (0, util_1.realizeLazyProperty)(this, 'config', new ConfigSection_1.ConfigSection(this, 'config'));
|
|
38
|
-
}
|
|
39
|
-
/**
|
|
40
|
-
* A lazy-loaded instance of the `appData` section of the JSON file.
|
|
41
|
-
* Upon first property access, it is stored as a property on the instance.
|
|
42
|
-
*/
|
|
43
|
-
get appData() {
|
|
44
|
-
return (0, util_1.realizeLazyProperty)(this, 'appData', new AppDataSection_1.AppDataSection(this, 'appData'));
|
|
45
|
-
}
|
|
46
|
-
/**
|
|
47
|
-
* A lazy-loaded instance of the `presets` section of the JSON file.
|
|
48
|
-
*/
|
|
49
|
-
get presets() {
|
|
50
|
-
return (0, util_1.realizeLazyProperty)(this, 'presets', new PresetsSection_1.PresetsSection(this, 'presets'));
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
exports.JsonFile = JsonFile;
|
|
54
|
-
//# sourceMappingURL=JsonFile.js.map
|
package/cjs/db/JsonFile.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"JsonFile.js","sourceRoot":"","sources":["../../../../../packages/cli/src/db/JsonFile.ts"],"names":[],"mappings":";;;AAAA,qDAAiD;AAEjD,mDAA+C;AAC/C,uCAA0D;AAC1D,qDAAiD;AAEjD;;GAEG;AACH,MAAa,QAAQ;IAIE;IAHrB;;OAEG;IACH,YAAqB,GAAmB;QAAnB,QAAG,GAAH,GAAG,CAAgB;IAAG,CAAC;IAE5C;;;;OAIG;IACH,IAAI,EAAE;QACJ,IAAI,IAAI,CAAC,GAAG,CAAC,MAAM,EAAE;YACnB,OAAO,IAAA,0BAAmB,EAAC,IAAI,EAAE,IAAI,EAAE,IAAI,aAAM,CAAC,IAAI,CAAC,GAAG,CAAC,YAAY,EAAE,CAAC,CAAC,CAAC,CAAA;SAC7E;aAAM;YACL,OAAO,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,CAAA;SAC3B;IACH,CAAC;IAED;;;OAGG;IACH,IAAI,MAAM;QACR,OAAO,IAAA,0BAAmB,EAAC,IAAI,EAAE,QAAQ,EAAE,IAAI,6BAAa,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC,CAAA;IAC/E,CAAC;IAED;;;OAGG;IACH,IAAI,OAAO;QACT,OAAO,IAAA,0BAAmB,EAAC,IAAI,EAAE,SAAS,EAAE,IAAI,+BAAc,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC,CAAA;IAClF,CAAC;IAED;;OAEG;IACH,IAAI,OAAO;QACT,OAAO,IAAA,0BAAmB,EAAC,IAAI,EAAE,SAAS,EAAE,IAAI,+BAAc,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC,CAAA;IAClF,CAAC;CACF;AAzCD,4BAyCC"}
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import { AbstractJsonFileSection } from './AbstractJsonFileSection';
|
|
2
|
-
import type { IPreset } from '../types/IPreset';
|
|
3
|
-
import { JsonFile } from './JsonFile';
|
|
4
|
-
/**
|
|
5
|
-
* A class that represents the user-presets section of the JSON file used as simple database.
|
|
6
|
-
*/
|
|
7
|
-
export declare class PresetsSection extends AbstractJsonFileSection<IPreset> {
|
|
8
|
-
/**
|
|
9
|
-
* Creates an instance of AppDataSection.
|
|
10
|
-
* @param file - The parent JsonFile instance.
|
|
11
|
-
* @param name - The name of the section.
|
|
12
|
-
*/
|
|
13
|
-
constructor(file: JsonFile, name: string);
|
|
14
|
-
/**
|
|
15
|
-
* Asserts that a key-value pair is valid.
|
|
16
|
-
* @param key - The key to assert.
|
|
17
|
-
* @param value - The preset options to validate.
|
|
18
|
-
*/
|
|
19
|
-
assertValid(key: string, value: IPreset): void;
|
|
20
|
-
/**
|
|
21
|
-
* Defines a property for the section.
|
|
22
|
-
* @param key - The key of the property.
|
|
23
|
-
* @param options - The options for the property.
|
|
24
|
-
*/
|
|
25
|
-
defineProperty(key: string, options: IPreset): void;
|
|
26
|
-
/**
|
|
27
|
-
* Initializes the section.
|
|
28
|
-
* @param save - Indicates whether to save the section after initialization.
|
|
29
|
-
* @returns A string if an error occurred during initialization, otherwise void.
|
|
30
|
-
*/
|
|
31
|
-
initialize(save?: boolean): void;
|
|
32
|
-
/**
|
|
33
|
-
* Sets all the values in the section.
|
|
34
|
-
* @param values - The values to set.
|
|
35
|
-
* @param save - Indicates whether to save the section after setting the values.
|
|
36
|
-
*/
|
|
37
|
-
setAll(presets: Record<string, IPreset>, save?: boolean): Promise<void>;
|
|
38
|
-
/**
|
|
39
|
-
* Deletes the value associated with the specified key.
|
|
40
|
-
* @param key - The key to delete.
|
|
41
|
-
* @param save - Indicates whether to save the section after deleting the value.
|
|
42
|
-
*/
|
|
43
|
-
delete(name: string, save?: boolean): void;
|
|
44
|
-
}
|
|
45
|
-
//# sourceMappingURL=PresetsSection.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"PresetsSection.d.ts","sourceRoot":"","sources":["../../../../../packages/cli/src/db/PresetsSection.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAA;AACnE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAA;AAC/C,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AAIrC;;GAEG;AACH,qBAAa,cAAe,SAAQ,uBAAuB,CAAC,OAAO,CAAC;IAClE;;;;OAIG;gBACS,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM;IAaxC;;;;OAIG;IACM,WAAW,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO;IAIhD;;;;OAIG;IACM,cAAc,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO;IAOrD;;;;OAIG;IACM,UAAU,CAAC,IAAI,UAAQ;IAkBhC;;;;OAIG;IACY,MAAM,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,IAAI,UAAO;IAKnE;;;;OAIG;IACM,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,UAAO;CAI1C"}
|
package/cjs/db/PresetsSection.js
DELETED
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.PresetsSection = void 0;
|
|
4
|
-
const AbstractJsonFileSection_1 = require("./AbstractJsonFileSection");
|
|
5
|
-
const util_1 = require("@bemoje/util");
|
|
6
|
-
/**
|
|
7
|
-
* A class that represents the user-presets section of the JSON file used as simple database.
|
|
8
|
-
*/
|
|
9
|
-
class PresetsSection extends AbstractJsonFileSection_1.AbstractJsonFileSection {
|
|
10
|
-
/**
|
|
11
|
-
* Creates an instance of AppDataSection.
|
|
12
|
-
* @param file - The parent JsonFile instance.
|
|
13
|
-
* @param name - The name of the section.
|
|
14
|
-
*/
|
|
15
|
-
constructor(file, name) {
|
|
16
|
-
super(file, name, false);
|
|
17
|
-
this.defineProperty('defaults', {
|
|
18
|
-
description: 'All presets inherit from this preset',
|
|
19
|
-
presets: [],
|
|
20
|
-
args: this.cmd.arguments.map((arg) => arg.defaultValue ?? null),
|
|
21
|
-
options: this.cmd.getOwnAndGlobalOptions().reduce((acc, opt) => {
|
|
22
|
-
acc[opt.attributeName()] = opt.defaultValue ?? (opt.isBoolean() ? false : null);
|
|
23
|
-
return acc;
|
|
24
|
-
}, {}),
|
|
25
|
-
});
|
|
26
|
-
}
|
|
27
|
-
/**
|
|
28
|
-
* Asserts that a key-value pair is valid.
|
|
29
|
-
* @param key - The key to assert.
|
|
30
|
-
* @param value - The preset options to validate.
|
|
31
|
-
*/
|
|
32
|
-
assertValid(key, value) {
|
|
33
|
-
this.cmd.assertValidPreset(key, value);
|
|
34
|
-
}
|
|
35
|
-
/**
|
|
36
|
-
* Defines a property for the section.
|
|
37
|
-
* @param key - The key of the property.
|
|
38
|
-
* @param options - The options for the property.
|
|
39
|
-
*/
|
|
40
|
-
defineProperty(key, options) {
|
|
41
|
-
if (this.defaultValues[key])
|
|
42
|
-
throw new Error(`Cannot redefine preset '${key}'.`);
|
|
43
|
-
this.defaultValues[key] = JSON.parse(JSON.stringify(options));
|
|
44
|
-
this.assertValid(key, options);
|
|
45
|
-
this.isInitialized = false;
|
|
46
|
-
}
|
|
47
|
-
/**
|
|
48
|
-
* Initializes the section.
|
|
49
|
-
* @param save - Indicates whether to save the section after initialization.
|
|
50
|
-
* @returns A string if an error occurred during initialization, otherwise void.
|
|
51
|
-
*/
|
|
52
|
-
initialize(save = false) {
|
|
53
|
-
if (this.isInitialized)
|
|
54
|
-
return;
|
|
55
|
-
const data = this.db.getSafe(this.prefix());
|
|
56
|
-
const presets = (0, util_1.objAssign)({}, this.defaultValues, data || {});
|
|
57
|
-
const presetNames = Object.keys(presets);
|
|
58
|
-
for (const preset of Object.values(presets)) {
|
|
59
|
-
for (const pname of presetNames) {
|
|
60
|
-
if (preset.options[pname]) {
|
|
61
|
-
preset.presets.push(pname);
|
|
62
|
-
delete preset.options[pname];
|
|
63
|
-
save = true;
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
this.db.set(this.prefix(), presets, save);
|
|
68
|
-
this.isInitialized = true;
|
|
69
|
-
}
|
|
70
|
-
/**
|
|
71
|
-
* Sets all the values in the section.
|
|
72
|
-
* @param values - The values to set.
|
|
73
|
-
* @param save - Indicates whether to save the section after setting the values.
|
|
74
|
-
*/
|
|
75
|
-
async setAll(presets, save = true) {
|
|
76
|
-
if (!presets['defaults'])
|
|
77
|
-
presets['defaults'] = JSON.parse(JSON.stringify(this.defaultValues['defaults']));
|
|
78
|
-
super.setAll(presets, save);
|
|
79
|
-
}
|
|
80
|
-
/**
|
|
81
|
-
* Deletes the value associated with the specified key.
|
|
82
|
-
* @param key - The key to delete.
|
|
83
|
-
* @param save - Indicates whether to save the section after deleting the value.
|
|
84
|
-
*/
|
|
85
|
-
delete(name, save = true) {
|
|
86
|
-
if (Object.hasOwn(this.defaultValues, name))
|
|
87
|
-
throw new Error('Cannot delete the builtin presets.');
|
|
88
|
-
super.delete(name, save);
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
exports.PresetsSection = PresetsSection;
|
|
92
|
-
//# sourceMappingURL=PresetsSection.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"PresetsSection.js","sourceRoot":"","sources":["../../../../../packages/cli/src/db/PresetsSection.ts"],"names":[],"mappings":"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"}
|
package/cjs/index.d.ts
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
export * from './arg/ArgumentBuilder';
|
|
2
|
-
export * from './arg/ArgumentParserSelector';
|
|
3
|
-
export * from './arg/ArgumentReader';
|
|
4
|
-
export * from './arg/ArgumentValidatorSelector';
|
|
5
|
-
export * from './cmd/CommandBuilder';
|
|
6
|
-
export * from './cmd/CommandBuilderMetaData';
|
|
7
|
-
export * from './cmd/CommandFeatureSelector';
|
|
8
|
-
export * from './cmd/DefaultHelpConfig';
|
|
9
|
-
export * from './core/OutputManager';
|
|
10
|
-
export * from './core/ParserSelector';
|
|
11
|
-
export * from './core/splitCombinedArgvShorts';
|
|
12
|
-
export * from './core/ValidatorSelector';
|
|
13
|
-
export * from './db/AbstractJsonFileSection';
|
|
14
|
-
export * from './db/AppDataSection';
|
|
15
|
-
export * from './db/ConfigSection';
|
|
16
|
-
export * from './db/JsonFile';
|
|
17
|
-
export * from './db/PresetsSection';
|
|
18
|
-
export * from './opt/OptionArgumentParserSelector';
|
|
19
|
-
export * from './opt/OptionArgumentValidatorSelector';
|
|
20
|
-
export * from './opt/OptionBuilder';
|
|
21
|
-
export * from './opt/OptionHelpers';
|
|
22
|
-
export * from './opt/OptionReader';
|
|
23
|
-
export * from './types/IConfig';
|
|
24
|
-
export * from './types/IPreset';
|
|
25
|
-
//# sourceMappingURL=index.d.ts.map
|
package/cjs/index.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../packages/cli/src/index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAA;AACrC,cAAc,8BAA8B,CAAA;AAC5C,cAAc,sBAAsB,CAAA;AACpC,cAAc,iCAAiC,CAAA;AAC/C,cAAc,sBAAsB,CAAA;AACpC,cAAc,8BAA8B,CAAA;AAC5C,cAAc,8BAA8B,CAAA;AAC5C,cAAc,yBAAyB,CAAA;AACvC,cAAc,sBAAsB,CAAA;AACpC,cAAc,uBAAuB,CAAA;AACrC,cAAc,gCAAgC,CAAA;AAC9C,cAAc,0BAA0B,CAAA;AACxC,cAAc,8BAA8B,CAAA;AAC5C,cAAc,qBAAqB,CAAA;AACnC,cAAc,oBAAoB,CAAA;AAClC,cAAc,eAAe,CAAA;AAC7B,cAAc,qBAAqB,CAAA;AACnC,cAAc,oCAAoC,CAAA;AAClD,cAAc,uCAAuC,CAAA;AACrD,cAAc,qBAAqB,CAAA;AACnC,cAAc,qBAAqB,CAAA;AACnC,cAAc,oBAAoB,CAAA;AAClC,cAAc,iBAAiB,CAAA;AAC/B,cAAc,iBAAiB,CAAA"}
|
package/cjs/index.js
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const tslib_1 = require("tslib");
|
|
4
|
-
tslib_1.__exportStar(require("./arg/ArgumentBuilder"), exports);
|
|
5
|
-
tslib_1.__exportStar(require("./arg/ArgumentParserSelector"), exports);
|
|
6
|
-
tslib_1.__exportStar(require("./arg/ArgumentReader"), exports);
|
|
7
|
-
tslib_1.__exportStar(require("./arg/ArgumentValidatorSelector"), exports);
|
|
8
|
-
tslib_1.__exportStar(require("./cmd/CommandBuilder"), exports);
|
|
9
|
-
tslib_1.__exportStar(require("./cmd/CommandBuilderMetaData"), exports);
|
|
10
|
-
tslib_1.__exportStar(require("./cmd/CommandFeatureSelector"), exports);
|
|
11
|
-
tslib_1.__exportStar(require("./cmd/DefaultHelpConfig"), exports);
|
|
12
|
-
tslib_1.__exportStar(require("./core/OutputManager"), exports);
|
|
13
|
-
tslib_1.__exportStar(require("./core/ParserSelector"), exports);
|
|
14
|
-
tslib_1.__exportStar(require("./core/splitCombinedArgvShorts"), exports);
|
|
15
|
-
tslib_1.__exportStar(require("./core/ValidatorSelector"), exports);
|
|
16
|
-
tslib_1.__exportStar(require("./db/AbstractJsonFileSection"), exports);
|
|
17
|
-
tslib_1.__exportStar(require("./db/AppDataSection"), exports);
|
|
18
|
-
tslib_1.__exportStar(require("./db/ConfigSection"), exports);
|
|
19
|
-
tslib_1.__exportStar(require("./db/JsonFile"), exports);
|
|
20
|
-
tslib_1.__exportStar(require("./db/PresetsSection"), exports);
|
|
21
|
-
tslib_1.__exportStar(require("./opt/OptionArgumentParserSelector"), exports);
|
|
22
|
-
tslib_1.__exportStar(require("./opt/OptionArgumentValidatorSelector"), exports);
|
|
23
|
-
tslib_1.__exportStar(require("./opt/OptionBuilder"), exports);
|
|
24
|
-
tslib_1.__exportStar(require("./opt/OptionHelpers"), exports);
|
|
25
|
-
tslib_1.__exportStar(require("./opt/OptionReader"), exports);
|
|
26
|
-
tslib_1.__exportStar(require("./types/IConfig"), exports);
|
|
27
|
-
tslib_1.__exportStar(require("./types/IPreset"), exports);
|
|
28
|
-
//# sourceMappingURL=index.js.map
|
package/cjs/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../packages/cli/src/index.ts"],"names":[],"mappings":";;;AAAA,gEAAqC;AACrC,uEAA4C;AAC5C,+DAAoC;AACpC,0EAA+C;AAC/C,+DAAoC;AACpC,uEAA4C;AAC5C,uEAA4C;AAC5C,kEAAuC;AACvC,+DAAoC;AACpC,gEAAqC;AACrC,yEAA8C;AAC9C,mEAAwC;AACxC,uEAA4C;AAC5C,8DAAmC;AACnC,6DAAkC;AAClC,wDAA6B;AAC7B,8DAAmC;AACnC,6EAAkD;AAClD,gFAAqD;AACrD,8DAAmC;AACnC,8DAAmC;AACnC,6DAAkC;AAClC,0DAA+B;AAC/B,0DAA+B"}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { OptionBuilder } from './OptionBuilder';
|
|
2
|
-
import { ParserSelector } from '../core/ParserSelector';
|
|
3
|
-
import type { TStringParser } from '@bemoje/util';
|
|
4
|
-
export declare class OptionArgumentParserSelector extends ParserSelector<OptionBuilder> {
|
|
5
|
-
constructor(builder: OptionBuilder);
|
|
6
|
-
custom<T>(parser: TStringParser<T>): OptionBuilder;
|
|
7
|
-
}
|
|
8
|
-
//# sourceMappingURL=OptionArgumentParserSelector.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"OptionArgumentParserSelector.d.ts","sourceRoot":"","sources":["../../../../../packages/cli/src/opt/OptionArgumentParserSelector.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAC/C,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAA;AACvD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAA;AAEjD,qBAAa,4BAA6B,SAAQ,cAAc,CAAC,aAAa,CAAC;gBACjE,OAAO,EAAE,aAAa;IAGlC,MAAM,CAAC,CAAC,EAAE,MAAM,EAAE,aAAa,CAAC,CAAC,CAAC;CAKnC"}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.OptionArgumentParserSelector = void 0;
|
|
4
|
-
const ParserSelector_1 = require("../core/ParserSelector");
|
|
5
|
-
class OptionArgumentParserSelector extends ParserSelector_1.ParserSelector {
|
|
6
|
-
constructor(builder) {
|
|
7
|
-
super(builder);
|
|
8
|
-
}
|
|
9
|
-
custom(parser) {
|
|
10
|
-
const name = this.builder.$.attributeName();
|
|
11
|
-
this.builder.cmd.meta.optParsers[name] = parser;
|
|
12
|
-
return this.builder;
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
exports.OptionArgumentParserSelector = OptionArgumentParserSelector;
|
|
16
|
-
//# sourceMappingURL=OptionArgumentParserSelector.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"OptionArgumentParserSelector.js","sourceRoot":"","sources":["../../../../../packages/cli/src/opt/OptionArgumentParserSelector.ts"],"names":[],"mappings":";;;AACA,2DAAuD;AAGvD,MAAa,4BAA6B,SAAQ,+BAA6B;IAC7E,YAAY,OAAsB;QAChC,KAAK,CAAC,OAAO,CAAC,CAAA;IAChB,CAAC;IACD,MAAM,CAAI,MAAwB;QAChC,MAAM,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,aAAa,EAAE,CAAA;QAC3C,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,GAAG,MAAM,CAAA;QAC/C,OAAO,IAAI,CAAC,OAAO,CAAA;IACrB,CAAC;CACF;AATD,oEASC"}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { OptionBuilder } from './OptionBuilder';
|
|
2
|
-
import type { TValidator } from '@bemoje/util';
|
|
3
|
-
import { ValidatorSelector } from '../core/ValidatorSelector';
|
|
4
|
-
export declare class OptionArgumentValidatorSelector extends ValidatorSelector<OptionBuilder> {
|
|
5
|
-
constructor(builder: OptionBuilder);
|
|
6
|
-
custom<T>(validator: TValidator<T>): OptionBuilder;
|
|
7
|
-
}
|
|
8
|
-
//# sourceMappingURL=OptionArgumentValidatorSelector.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"OptionArgumentValidatorSelector.d.ts","sourceRoot":"","sources":["../../../../../packages/cli/src/opt/OptionArgumentValidatorSelector.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAC/C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AAC9C,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAA;AAE7D,qBAAa,+BAAgC,SAAQ,iBAAiB,CAAC,aAAa,CAAC;gBACvE,OAAO,EAAE,aAAa;IAGlC,MAAM,CAAC,CAAC,EAAE,SAAS,EAAE,UAAU,CAAC,CAAC,CAAC;CAOnC"}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.OptionArgumentValidatorSelector = void 0;
|
|
4
|
-
const ValidatorSelector_1 = require("../core/ValidatorSelector");
|
|
5
|
-
class OptionArgumentValidatorSelector extends ValidatorSelector_1.ValidatorSelector {
|
|
6
|
-
constructor(builder) {
|
|
7
|
-
super(builder);
|
|
8
|
-
}
|
|
9
|
-
custom(validator) {
|
|
10
|
-
const name = this.builder.$.attributeName();
|
|
11
|
-
const obj = this.builder.cmd.meta.optValidators;
|
|
12
|
-
if (!obj[name])
|
|
13
|
-
obj[name] = [];
|
|
14
|
-
obj[name].push(validator);
|
|
15
|
-
return this.builder;
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
exports.OptionArgumentValidatorSelector = OptionArgumentValidatorSelector;
|
|
19
|
-
//# sourceMappingURL=OptionArgumentValidatorSelector.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"OptionArgumentValidatorSelector.js","sourceRoot":"","sources":["../../../../../packages/cli/src/opt/OptionArgumentValidatorSelector.ts"],"names":[],"mappings":";;;AAEA,iEAA6D;AAE7D,MAAa,+BAAgC,SAAQ,qCAAgC;IACnF,YAAY,OAAsB;QAChC,KAAK,CAAC,OAAO,CAAC,CAAA;IAChB,CAAC;IACD,MAAM,CAAI,SAAwB;QAChC,MAAM,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,aAAa,EAAE,CAAA;QAC3C,MAAM,GAAG,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,aAAa,CAAA;QAC/C,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC;YAAE,GAAG,CAAC,IAAI,CAAC,GAAG,EAAE,CAAA;QAC9B,GAAG,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,CAAA;QACzB,OAAO,IAAI,CAAC,OAAO,CAAA;IACrB,CAAC;CACF;AAXD,0EAWC"}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { CommandBuilder } from '../cmd/CommandBuilder';
|
|
2
|
-
import { Option } from '@commander-js/extra-typings';
|
|
3
|
-
import { OptionArgumentParserSelector } from './OptionArgumentParserSelector';
|
|
4
|
-
import { OptionArgumentValidatorSelector } from './OptionArgumentValidatorSelector';
|
|
5
|
-
import { OptionReader } from './OptionReader';
|
|
6
|
-
import type { OptionValues } from '@commander-js/extra-typings';
|
|
7
|
-
/**
|
|
8
|
-
* Wrapper around the @see Option class, for more intuitive construction.
|
|
9
|
-
* @remarks Options are one of boolean, negated, required argument, or optional argument.
|
|
10
|
-
*/
|
|
11
|
-
export declare class OptionBuilder {
|
|
12
|
-
readonly cmd: CommandBuilder;
|
|
13
|
-
readonly $: Option;
|
|
14
|
-
constructor(cmd: CommandBuilder, flags: string);
|
|
15
|
-
get hasValidators(): boolean;
|
|
16
|
-
get hasParser(): boolean;
|
|
17
|
-
description(string: string): this;
|
|
18
|
-
mandatory(mandatory?: boolean): this;
|
|
19
|
-
hideHelp(hide?: boolean): this;
|
|
20
|
-
hidden(hidden?: boolean): this;
|
|
21
|
-
preset(arg: unknown): this;
|
|
22
|
-
default(value: unknown, description?: string): this;
|
|
23
|
-
choices(values: readonly string[]): this;
|
|
24
|
-
conflicts(names: string | string[]): this;
|
|
25
|
-
implies(optionValues: OptionValues): this;
|
|
26
|
-
env(name: string): this;
|
|
27
|
-
short(short: string): this;
|
|
28
|
-
get parser(): OptionArgumentParserSelector;
|
|
29
|
-
get validator(): OptionArgumentValidatorSelector;
|
|
30
|
-
get get(): OptionReader;
|
|
31
|
-
}
|
|
32
|
-
//# sourceMappingURL=OptionBuilder.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"OptionBuilder.d.ts","sourceRoot":"","sources":["../../../../../packages/cli/src/opt/OptionBuilder.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAA;AACtD,OAAO,EAAE,MAAM,EAAE,MAAM,6BAA6B,CAAA;AACpD,OAAO,EAAE,4BAA4B,EAAE,MAAM,gCAAgC,CAAA;AAC7E,OAAO,EAAE,+BAA+B,EAAE,MAAM,mCAAmC,CAAA;AAEnF,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAC7C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAA;AAG/D;;;GAGG;AACH,qBAAa,aAAa;IAGZ,QAAQ,CAAC,GAAG,EAAE,cAAc;IAFxC,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAA;gBAEG,GAAG,EAAE,cAAc,EAAE,KAAK,EAAE,MAAM;IAMvD,IAAI,aAAa,YAEhB;IACD,IAAI,SAAS,YAEZ;IACD,WAAW,CAAC,MAAM,EAAE,MAAM;IAI1B,SAAS,CAAC,SAAS,UAAO;IAI1B,QAAQ,CAAC,IAAI,UAAO;IAIpB,MAAM,CAAC,MAAM,UAAO;IAIpB,MAAM,CAAC,GAAG,EAAE,OAAO;IAInB,OAAO,CAAC,KAAK,EAAE,OAAO,EAAE,WAAW,CAAC,EAAE,MAAM;IAI5C,OAAO,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE;IAOjC,SAAS,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE;IAIlC,OAAO,CAAC,YAAY,EAAE,YAAY;IAIlC,GAAG,CAAC,IAAI,EAAE,MAAM;IAIhB,KAAK,CAAC,KAAK,EAAE,MAAM;IAInB,IAAI,MAAM,iCAKT;IACD,IAAI,SAAS,oCAKZ;IACD,IAAI,GAAG,iBAEN;CACF"}
|