@bemoje/cli 0.0.2 → 0.0.3
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/index.cjs.js +2338 -1764
- package/index.esm.js +2243 -1659
- package/package.json +5 -3
- package/src/{core/CommandBuilder → arg}/ArgumentBuilder.d.ts +5 -6
- package/src/arg/ArgumentParserSelector.d.ts +8 -0
- package/src/{core/CommandBuilder → arg}/ArgumentReader.d.ts +1 -2
- package/src/arg/ArgumentValidatorSelector.d.ts +7 -0
- package/src/cmd/CLI.d.ts +2 -0
- package/src/cmd/CommandBuilder.d.ts +238 -0
- package/src/cmd/CommandBuilderMetaData.d.ts +23 -0
- package/src/cmd/CommandFeatureSelector.d.ts +79 -0
- package/src/cmd/DefaultHelpConfig.d.ts +2 -0
- package/src/core/OutputManager.d.ts +63 -0
- package/src/{parsers/selector/AbstractStringParserSelector.d.ts → core/ParserSelector.d.ts} +5 -6
- package/src/core/ValidatorSelector.d.ts +16 -0
- package/src/core/counter.d.ts +3 -0
- package/src/db/AbstractJsonFileSection.d.ts +136 -0
- package/src/db/AppDataSection.d.ts +29 -0
- package/src/db/ConfigSection.d.ts +47 -0
- package/src/db/JsonFile.d.ts +35 -0
- package/src/db/PresetsSection.d.ts +44 -0
- package/src/index.d.ts +102 -112
- package/src/opt/OptionArgumentParserSelector.d.ts +7 -0
- package/src/opt/OptionArgumentValidatorSelector.d.ts +7 -0
- package/src/{core/CommandBuilder → opt}/OptionBuilder.d.ts +6 -5
- package/src/opt/OptionHelpers.d.ts +32 -0
- package/src/{core/CommandBuilder → opt}/OptionReader.d.ts +2 -3
- package/src/proto/overrideCommanderPrototype.d.ts +8 -0
- package/src/types/IConfig.d.ts +21 -0
- package/src/types/IPreset.d.ts +6 -7
- package/src/util/array/arrLast.d.ts +12 -0
- package/src/util/array/arrSome.d.ts +15 -0
- package/src/util/array/types/ArrayPredicate.d.ts +10 -0
- package/src/util/db/JsonDB.d.ts +65 -0
- package/src/util/fs/promptUserEditInTextEditor/IGetUserInputFromEditorOptions.d.ts +15 -0
- package/src/util/fs/promptUserEditInTextEditor/promptUserEditInTextEditorSync.d.ts +9 -0
- package/src/util/fs/promptUserEditInTextEditor/promptUserEditJsonInTextEditorSync.d.ts +13 -0
- package/src/util/fs/readFile/readFileSafeSync.d.ts +13 -0
- package/src/util/fs/readFile/readFileSync.d.ts +10 -0
- package/src/util/fs/readJsonFile/readJsonFileSafeSync.d.ts +9 -0
- package/src/util/fs/removeFile/removeFile.d.ts +1 -0
- package/src/util/fs/tempFile/tempFileSync.d.ts +7 -0
- package/src/util/fs/types/IReadJsonFileOptions.d.ts +1 -0
- package/src/util/fs/writeFile/writeFileSafeSync.d.ts +1 -0
- package/src/util/fs/writeFile/writeFileSync.d.ts +1 -0
- package/src/util/fs/writeJsonFile/writeJsonFileSafe.d.ts +1 -0
- package/src/{core/util → util/function}/MethodDisabler.d.ts +4 -3
- package/src/util/function/funSetName.d.ts +13 -0
- package/src/util/node/execInherit.d.ts +1 -0
- package/src/{core/util → util/object}/createArrayMerger.d.ts +3 -0
- package/src/{core/util → util/object}/createObjectMerger.d.ts +4 -1
- package/src/util/object/objUpdatePropertyDescriptors.d.ts +16 -0
- package/src/util/object/setNonEnumerable.d.ts +15 -0
- package/src/util/os/defaultOpenInEditorCommand.d.ts +5 -0
- package/src/util/os/isOSX.d.ts +6 -0
- package/src/util/os/isVsCodeInstalled.d.ts +5 -0
- package/src/util/os/isWindows.d.ts +8 -0
- package/src/util/path/getTempDataPath.d.ts +6 -0
- package/src/util/regex/regexEscapeString.d.ts +11 -0
- package/src/util/string/strEnsureStartsWith.d.ts +12 -0
- package/src/util/string/strFirstCharToUpperCase.d.ts +9 -0
- package/src/util/string/strIsLowerCase.d.ts +11 -0
- package/src/util/string/strIsUpperCase.d.ts +11 -0
- package/src/util/string/strSplitCamelCase.d.ts +11 -0
- package/src/util/types/Any.d.ts +1 -0
- package/src/util/types/DeepArray.d.ts +10 -0
- package/src/util/types/DeepObject.d.ts +14 -0
- package/src/util/types/JsonArray.d.ts +6 -0
- package/src/util/types/JsonDefinedPrimitive.d.ts +4 -0
- package/src/util/types/JsonObject.d.ts +6 -0
- package/src/util/types/JsonRawPrimitive.d.ts +5 -0
- package/src/util/types/JsonValue.d.ts +7 -0
- package/src/util/types/ObjectKey.d.ts +1 -0
- package/src/util/types/TConstructor.d.ts +5 -0
- package/src/util/types/TFunction.d.ts +4 -0
- package/src/util/types/TFunctionNoNew.d.ts +2 -0
- package/src/util/types/TPlainObject.d.ts +2 -0
- package/src/util/types/TPrimitive.d.ts +1 -0
- package/src/util/types/TValidator.d.ts +1 -0
- package/src/{validators → util/validation}/createTypedArrayValidator.d.ts +1 -3
- package/src/util/validation/ensureThat.d.ts +6 -0
- package/src/util/validation/isFunction.d.ts +11 -0
- package/src/{validators → util/validation}/isNamedFunction.d.ts +1 -1
- package/src/util/validation/isObject.d.ts +15 -0
- package/src/util/validation/isPlainObject.d.ts +6 -0
- package/src/util/validation/isPrimitive.d.ts +12 -0
- package/src/util/validation/numbers/isInteger.d.ts +13 -0
- package/src/util/validation/numbers/isValidNumber.d.ts +15 -0
- package/src/core/CommandBuilder/Base.d.ts +0 -5
- package/src/core/CommandBuilder/CommandBuilder.d.ts +0 -80
- package/src/core/CommandBuilder/CommandBuilder.example.d.ts +0 -1
- package/src/core/CommandBuilder/CommandBuilderMetaData.d.ts +0 -17
- package/src/core/CommandBuilder/CommandFeatureSelector.d.ts +0 -26
- package/src/core/CommandBuilder/OutputManager.d.ts +0 -47
- package/src/core/CommandBuilder/assertCommandNameNotReserved.d.ts +0 -1
- package/src/core/CommandBuilder/ensureBackRefToCommandBuilder.d.ts +0 -7
- package/src/core/CommandBuilder/features/action/actionWrapper.d.ts +0 -5
- package/src/core/CommandBuilder/features/action/combineVariadicArgs.d.ts +0 -3
- package/src/core/CommandBuilder/features/action/debugLogArgsOpts.d.ts +0 -4
- package/src/core/CommandBuilder/features/action/deleteOptionsWithDefaultOrNoValue.d.ts +0 -3
- package/src/core/CommandBuilder/features/action/getPresetArgsAndOpts.d.ts +0 -3
- package/src/core/CommandBuilder/features/action/handleError.d.ts +0 -2
- package/src/core/CommandBuilder/features/action/handleOutputOptions.d.ts +0 -2
- package/src/core/CommandBuilder/features/action/optsWithGlobalsParsed.d.ts +0 -2
- package/src/core/CommandBuilder/features/action/padArgsWithUndefinedUntilExpectedLength.d.ts +0 -3
- package/src/core/CommandBuilder/features/action/parseArguments.d.ts +0 -2
- package/src/core/CommandBuilder/features/action/parseOptions.d.ts +0 -6
- package/src/core/CommandBuilder/features/action/parsedValidArgsOptsWithPresets.d.ts +0 -2
- package/src/core/CommandBuilder/features/action/parsedValidArgsWithPresets.d.ts +0 -2
- package/src/core/CommandBuilder/features/action/parsedValidOptsWithPresets.d.ts +0 -3
- package/src/core/CommandBuilder/features/addConfigCommands.d.ts +0 -3
- package/src/core/CommandBuilder/features/addPresetsCommands.d.ts +0 -3
- package/src/core/CommandBuilder/features/addUtilCommands.d.ts +0 -2
- package/src/core/CommandBuilder/features/assertNoDuplicateCommandNames.d.ts +0 -2
- package/src/core/CommandBuilder/features/assertNoDuplicateOptionNames.d.ts +0 -2
- package/src/core/CommandBuilder/features/autoAssignMissingOptionFlags.d.ts +0 -14
- package/src/core/CommandBuilder/features/autoAssignSubCommandAliases.d.ts +0 -13
- package/src/core/CommandBuilder/features/getClosestNonNativeParent.d.ts +0 -2
- package/src/core/CommandBuilder/getGlobalOptions.d.ts +0 -3
- package/src/core/CommandBuilder/getOwnAndGlobalOptions.d.ts +0 -3
- package/src/core/CommandBuilder/initializeCommand.d.ts +0 -2
- package/src/core/db/AbstractJsonFileSection.d.ts +0 -45
- package/src/core/db/ConfigSection.d.ts +0 -19
- package/src/core/db/JsonDB.d.ts +0 -19
- package/src/core/db/JsonFile.d.ts +0 -25
- package/src/core/db/JsonFileError.d.ts +0 -6
- package/src/core/db/PresetsSection.d.ts +0 -14
- package/src/core/help/configureHelp.d.ts +0 -2
- package/src/core/util/assertPresetArgsOptional.d.ts +0 -3
- package/src/core/util/assertValidArguments.d.ts +0 -6
- package/src/core/util/assertValidOptions.d.ts +0 -6
- package/src/core/util/assertValidPreset.d.ts +0 -3
- package/src/core/util/commandExists.d.ts +0 -5
- package/src/core/util/commandLocation.d.ts +0 -5
- package/src/core/util/errorToString.d.ts +0 -1
- package/src/core/util/escapeShellCommandArgument.d.ts +0 -5
- package/src/core/util/forEachChildRecursive.d.ts +0 -4
- package/src/core/util/getARGV.d.ts +0 -1
- package/src/core/util/getAncestors.d.ts +0 -7
- package/src/core/util/getChildren.d.ts +0 -4
- package/src/core/util/getJsonFilepath.d.ts +0 -2
- package/src/core/util/getOptionArgumentName.d.ts +0 -5
- package/src/core/util/getRootCommand.d.ts +0 -5
- package/src/core/util/getSiblings.d.ts +0 -5
- package/src/core/util/hasVariadicArguments.d.ts +0 -5
- package/src/core/util/objDestroy.d.ts +0 -2
- package/src/core/util/optHasArgument.d.ts +0 -2
- package/src/core/util/prefixArray.d.ts +0 -5
- package/src/core/util/prefixString.d.ts +0 -5
- package/src/core/util/prefixStringsRecursive.d.ts +0 -5
- package/src/core/util/renderOptionFlags.d.ts +0 -6
- package/src/core/util/setOptionLongName.d.ts +0 -6
- package/src/core/util/setOptionShortName.d.ts +0 -6
- package/src/core/util/walkAncestors.d.ts +0 -7
- package/src/core/util/walkChildren.d.ts +0 -4
- package/src/core/util/walkSiblings.d.ts +0 -5
- package/src/parsers/createTupleListParser.d.ts +0 -11
- package/src/parsers/selector/ArgumentParserSelector.d.ts +0 -7
- package/src/parsers/selector/OptionArgumentParserSelector.d.ts +0 -7
- package/src/types/IDefinePropertyOptions.d.ts +0 -9
- package/src/types/IPresets.d.ts +0 -6
- package/src/types/TValidator.d.ts +0 -2
- package/src/validators/createLengthValidator.d.ts +0 -7
- package/src/validators/isInteger.d.ts +0 -1
- package/src/validators/isIntegerArray.d.ts +0 -4
- package/src/validators/isNull.d.ts +0 -1
- package/src/validators/isNumber.d.ts +0 -1
- package/src/validators/isNumberArray.d.ts +0 -4
- package/src/validators/isNumericString.d.ts +0 -1
- package/src/validators/selector/ArgumentValidatorSelector.d.ts +0 -6
- package/src/validators/selector/OptionArgumentValidatorSelector.d.ts +0 -6
- package/src/validators/selector/ValidatorSelector.d.ts +0 -17
- /package/src/core/{util/splitCombinedArgvShorts.d.ts → splitCombinedArgvShorts.d.ts} +0 -0
- /package/src/{core/CommandBuilder → util/errors}/ErrorParser.d.ts +0 -0
- /package/src/{core/CommandBuilder/features → util/node}/formatTableForTerminal.d.ts +0 -0
- /package/src/{core/util → util/object}/arrAssign.d.ts +0 -0
- /package/src/{core/util → util/object}/objAssign.d.ts +0 -0
- /package/src/{core/util → util/object}/realizeLazyProperty.d.ts +0 -0
- /package/src/{parsers → util/string-parsers}/createBooleanParser.d.ts +0 -0
- /package/src/{parsers → util/string-parsers}/createTypedListParser.d.ts +0 -0
- /package/src/{parsers → util/string-parsers}/parseBoolean.d.ts +0 -0
- /package/src/{parsers → util/string-parsers}/parseInteger.d.ts +0 -0
- /package/src/{parsers → util/string-parsers}/parseNumber.d.ts +0 -0
- /package/src/{parsers → util/string-parsers}/parseString.d.ts +0 -0
- /package/src/{types → util/types}/TStringParser.d.ts +0 -0
- /package/src/{validators → util/validation}/isArray.d.ts +0 -0
- /package/src/{validators → util/validation}/isBoolean.d.ts +0 -0
- /package/src/{validators → util/validation}/isNamedFunctionArray.d.ts +0 -0
- /package/src/{validators → util/validation}/isString.d.ts +0 -0
- /package/src/{validators → util/validation}/isStringArray.d.ts +0 -0
- /package/src/{validators → util/validation}/isStringWithNoSpacesOrDashes.d.ts +0 -0
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { Base } from './Base';
|
|
2
|
-
import { CommandBuilder } from './CommandBuilder';
|
|
3
|
-
/**
|
|
4
|
-
*
|
|
5
|
-
*/
|
|
6
|
-
export declare class CommandFeatureSelector extends Base {
|
|
7
|
-
protected readonly cmd: CommandBuilder;
|
|
8
|
-
protected _utils: boolean;
|
|
9
|
-
protected _config: boolean;
|
|
10
|
-
protected _presets: boolean;
|
|
11
|
-
protected _autoAssignMissingOptionFlags: boolean;
|
|
12
|
-
protected _autoAssignSubCommandAliases: boolean;
|
|
13
|
-
constructor(cmd: CommandBuilder);
|
|
14
|
-
protected debugToggle(info: Record<string, boolean>): void;
|
|
15
|
-
utils(boolean?: boolean): this;
|
|
16
|
-
config(boolean?: boolean): this;
|
|
17
|
-
presets(boolean?: boolean): this;
|
|
18
|
-
autoAssignMissingOptionFlags(boolean?: boolean): this;
|
|
19
|
-
autoAssignSubCommandAliases(boolean?: boolean): this;
|
|
20
|
-
all(boolean?: boolean): CommandBuilder;
|
|
21
|
-
get isUtilsEnabled(): boolean;
|
|
22
|
-
get isConfigEnabled(): boolean;
|
|
23
|
-
get isPresetsEnabled(): boolean;
|
|
24
|
-
get isAutoAssignMissingOptionFlagsEnabled(): boolean;
|
|
25
|
-
get isAutoAssignSubCommandAliasesEnabled(): boolean;
|
|
26
|
-
}
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import { Any } from '@bemoje/util';
|
|
2
|
-
import { MethodDisabler } from '../util/MethodDisabler';
|
|
3
|
-
/**
|
|
4
|
-
*
|
|
5
|
-
*/
|
|
6
|
-
export declare class OutputManager {
|
|
7
|
-
private static instance;
|
|
8
|
-
static getInstance(): OutputManager;
|
|
9
|
-
readonly colors: {
|
|
10
|
-
enable: () => void;
|
|
11
|
-
disable: () => void;
|
|
12
|
-
reset: (this: any, txt: string) => any;
|
|
13
|
-
bold: (this: any, txt: string) => any;
|
|
14
|
-
dim: (this: any, txt: string) => any;
|
|
15
|
-
italic: (this: any, txt: string) => any;
|
|
16
|
-
underline: (this: any, txt: string) => any;
|
|
17
|
-
inverse: (this: any, txt: string) => any;
|
|
18
|
-
hidden: (this: any, txt: string) => any;
|
|
19
|
-
strikethrough: (this: any, txt: string) => any;
|
|
20
|
-
black: (this: any, txt: string) => any;
|
|
21
|
-
red: (this: any, txt: string) => any;
|
|
22
|
-
green: (this: any, txt: string) => any;
|
|
23
|
-
yellow: (this: any, txt: string) => any;
|
|
24
|
-
blue: (this: any, txt: string) => any;
|
|
25
|
-
magenta: (this: any, txt: string) => any;
|
|
26
|
-
cyan: (this: any, txt: string) => any;
|
|
27
|
-
white: (this: any, txt: string) => any;
|
|
28
|
-
gray: (this: any, txt: string) => any;
|
|
29
|
-
grey: (this: any, txt: string) => any;
|
|
30
|
-
bgBlack: (this: any, txt: string) => any;
|
|
31
|
-
bgRed: (this: any, txt: string) => any;
|
|
32
|
-
bgGreen: (this: any, txt: string) => any;
|
|
33
|
-
bgYellow: (this: any, txt: string) => any;
|
|
34
|
-
bgBlue: (this: any, txt: string) => any;
|
|
35
|
-
bgMagenta: (this: any, txt: string) => any;
|
|
36
|
-
bgCyan: (this: any, txt: string) => any;
|
|
37
|
-
bgWhite: (this: any, txt: string) => any;
|
|
38
|
-
};
|
|
39
|
-
readonly stdout: MethodDisabler;
|
|
40
|
-
readonly stderr: MethodDisabler;
|
|
41
|
-
readonly debug: MethodDisabler;
|
|
42
|
-
debugMsgs: (() => Any)[];
|
|
43
|
-
private constructor();
|
|
44
|
-
reset(): this;
|
|
45
|
-
outputDebug(fn: () => Any): void;
|
|
46
|
-
outputDebugMessages(): void;
|
|
47
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function assertCommandNameNotReserved(name: string): void;
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import { Any } from '@bemoje/util';
|
|
2
|
-
import { CommandBuilder } from '../../CommandBuilder';
|
|
3
|
-
import { OptionValues } from 'commander';
|
|
4
|
-
export declare function debugLogArgsOpts(cb: CommandBuilder, args: Any[], opts: OptionValues, presetArgs: string[][], presetOpts: OptionValues[], presetOrder: string[]): void;
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { CommandBuilder } from '../../CommandBuilder';
|
|
2
|
-
import { OptionValues } from 'commander';
|
|
3
|
-
/**
|
|
4
|
-
* Parses (and validates) options using the parsers defined in the command builder.
|
|
5
|
-
*/
|
|
6
|
-
export declare function parseOptions(cmd: CommandBuilder, opts: OptionValues): OptionValues;
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { CommandBuilder } from '../CommandBuilder';
|
|
2
|
-
/**
|
|
3
|
-
* Automatically set 'short' and 'long' names to options that don't have one assigned yet.
|
|
4
|
-
*
|
|
5
|
-
* First, it tries to assign a short name based on the first letter of the option's attribute name
|
|
6
|
-
* Both lower and upper case are tried. If these is not available, the next letter of the option name is tried.
|
|
7
|
-
*
|
|
8
|
-
* If none of the letters of the option name are available, the option is skipped until all other
|
|
9
|
-
* options have had letters from their names attempted assigned.
|
|
10
|
-
* Those that remain are assigned the first available letter of the alphabet + 0-9.
|
|
11
|
-
* If there are 64 options for the command and no more alphanumeric characters are available,
|
|
12
|
-
* the option is not assigned a short name.
|
|
13
|
-
*/
|
|
14
|
-
export declare function autoAssignMissingOptionFlags(cmd: CommandBuilder): void;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { CommandBuilder } from '../CommandBuilder';
|
|
2
|
-
/**
|
|
3
|
-
* Makes aliases for the command.
|
|
4
|
-
* The idea is to be able to navigate the command tree by only typing the first letter(s) of the command names.
|
|
5
|
-
*
|
|
6
|
-
* Example: A command 'cola' would get these aliases: ['c', 'co', 'col'].
|
|
7
|
-
* However, if there are namespace clashes with sibling subcommands that start with the same letter,
|
|
8
|
-
* eg. like 'cola' and 'coal' where the first two letters clash, cola's aliases are reduced to only ['col'] and similarly for 'coal'.
|
|
9
|
-
*
|
|
10
|
-
* This method creates the aliases, ensuring there are no clashes with sublings, why it is important that the
|
|
11
|
-
* entire command tree is built before invoking this method.
|
|
12
|
-
*/
|
|
13
|
-
export declare function autoAssignSubCommandAliases(cmd: CommandBuilder): void;
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import { Any, JsonValue } from '@bemoje/util';
|
|
2
|
-
import { Base } from '../CommandBuilder/Base';
|
|
3
|
-
import { JsonFile } from './JsonFile';
|
|
4
|
-
/**
|
|
5
|
-
* A class that represents the a section of the JSON file used as simple database.
|
|
6
|
-
*/
|
|
7
|
-
export declare abstract class AbstractJsonFileSection<Val = JsonValue> extends Base {
|
|
8
|
-
protected readonly file: JsonFile;
|
|
9
|
-
protected readonly name: string;
|
|
10
|
-
protected readonly hasFixedKeysForUser: boolean;
|
|
11
|
-
protected isInitialized: boolean;
|
|
12
|
-
protected isInitializing: boolean;
|
|
13
|
-
protected readonly _defaultValues: Record<string, Val>;
|
|
14
|
-
/**
|
|
15
|
-
* @param file The parent JsonFile instance.
|
|
16
|
-
* @param name The name of the section.
|
|
17
|
-
*/
|
|
18
|
-
constructor(file: JsonFile, name: string, hasFixedKeysForUser: boolean);
|
|
19
|
-
abstract assertValid(key: string, value: Val): void;
|
|
20
|
-
abstract defineProperty(key: string, options: Any): void;
|
|
21
|
-
abstract initialize(save?: boolean): void | string;
|
|
22
|
-
get defaultValues(): Record<string, Val>;
|
|
23
|
-
/**
|
|
24
|
-
* Get the db lookup prefix for this section.
|
|
25
|
-
* @param key An optional key to append to the prefix.
|
|
26
|
-
*/
|
|
27
|
-
protected prefix(key?: string): string;
|
|
28
|
-
get<T extends Val = Val>(key: string): T;
|
|
29
|
-
getAll(): typeof this.defaultValues;
|
|
30
|
-
count(): number;
|
|
31
|
-
set(key: string, value: Val, save?: boolean): void;
|
|
32
|
-
setAll(values: typeof this.defaultValues, save?: boolean): void;
|
|
33
|
-
reset(key: string, save?: boolean): void;
|
|
34
|
-
resetAll(save?: boolean): void;
|
|
35
|
-
/**
|
|
36
|
-
* Actions:
|
|
37
|
-
* - save the database to disk
|
|
38
|
-
* - verify that the JSON file is valid JSON data
|
|
39
|
-
* - format as human readable with 2 indents
|
|
40
|
-
*/
|
|
41
|
-
protected save(): void;
|
|
42
|
-
delete(key: string, save?: boolean): void;
|
|
43
|
-
deleteAll(save?: boolean): void;
|
|
44
|
-
edit(editor?: string): void;
|
|
45
|
-
}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { AbstractJsonFileSection } from './AbstractJsonFileSection';
|
|
2
|
-
import { JsonValue } from '@bemoje/util';
|
|
3
|
-
import { IConfigDefinePropertyOptions } from '../../types/IDefinePropertyOptions';
|
|
4
|
-
import { JsonFile } from './JsonFile';
|
|
5
|
-
import { TStringParser } from '../../types/TStringParser';
|
|
6
|
-
import { TValidator } from '../../types/TValidator';
|
|
7
|
-
/**
|
|
8
|
-
* A class that represents the user-config section of the JSON file used as simple database.
|
|
9
|
-
*/
|
|
10
|
-
export declare class ConfigSection<Val extends JsonValue = JsonValue> extends AbstractJsonFileSection<Val> {
|
|
11
|
-
readonly descriptions: Record<string, string>;
|
|
12
|
-
readonly validators: Record<string, TValidator<Val>>;
|
|
13
|
-
readonly parsers: Record<string, TStringParser<Val>>;
|
|
14
|
-
constructor(file: JsonFile, name: string, hasFixedKeysForUser?: boolean);
|
|
15
|
-
assertValid(key: string, value: Val): void;
|
|
16
|
-
defineProperty(key: string, options: IConfigDefinePropertyOptions<Val>): void;
|
|
17
|
-
initialize(save?: boolean): void;
|
|
18
|
-
get keys(): string[];
|
|
19
|
-
}
|
package/src/core/db/JsonDB.d.ts
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { JsonObject, JsonValue } from '@bemoje/util';
|
|
2
|
-
import { Base } from '../CommandBuilder/Base';
|
|
3
|
-
import { JsonFile } from './JsonFile';
|
|
4
|
-
export declare class JsonDB extends Base {
|
|
5
|
-
protected readonly file: JsonFile;
|
|
6
|
-
protected data: JsonObject;
|
|
7
|
-
readonly save: () => void;
|
|
8
|
-
/**
|
|
9
|
-
* @param filepath The path to the JSON file.
|
|
10
|
-
*/
|
|
11
|
-
constructor(file: JsonFile);
|
|
12
|
-
get filepath(): string;
|
|
13
|
-
set(prefix?: string, value?: JsonValue, save?: boolean): void;
|
|
14
|
-
get<T = JsonValue>(prefix?: string): T;
|
|
15
|
-
getSafe<T = JsonValue>(prefix?: string): T | undefined;
|
|
16
|
-
has(prefix?: string): boolean;
|
|
17
|
-
delete(prefix?: string, save?: boolean): void;
|
|
18
|
-
protected cloneDeep(obj: JsonValue): any;
|
|
19
|
-
}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { Base } from '../CommandBuilder/Base';
|
|
2
|
-
import { CommandBuilder } from '../CommandBuilder/CommandBuilder';
|
|
3
|
-
import { ConfigSection } from './ConfigSection';
|
|
4
|
-
import { JsonDB } from './JsonDB';
|
|
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 extends Base {
|
|
10
|
-
readonly cmd: CommandBuilder;
|
|
11
|
-
db: JsonDB;
|
|
12
|
-
/**
|
|
13
|
-
* @param cmd The parent CommandBuilder instance.
|
|
14
|
-
*/
|
|
15
|
-
constructor(cmd: CommandBuilder);
|
|
16
|
-
/**
|
|
17
|
-
* A lazy-loaded instance of the `config` section of the JSON file.
|
|
18
|
-
* Upon first property access, it is stored as a property on the instance.
|
|
19
|
-
*/
|
|
20
|
-
get config(): ConfigSection<import("dist/packages/util/src").JsonValue>;
|
|
21
|
-
/**
|
|
22
|
-
* A lazy-loaded instance of the `presets` section of the JSON file.
|
|
23
|
-
*/
|
|
24
|
-
get presets(): PresetsSection;
|
|
25
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { AbstractJsonFileSection } from './AbstractJsonFileSection';
|
|
2
|
-
import { 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
|
-
constructor(file: JsonFile, name: string, hasFixedKeysForUser?: boolean);
|
|
9
|
-
assertValid(key: string, value: IPreset): void;
|
|
10
|
-
defineProperty(key: string, options: IPreset): void;
|
|
11
|
-
initialize(save?: boolean): void;
|
|
12
|
-
delete(name: string, save?: boolean): void;
|
|
13
|
-
setAll(presets: typeof this.defaultValues, save?: boolean): Promise<void>;
|
|
14
|
-
}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { Any } from '@bemoje/util';
|
|
2
|
-
import { CommandBuilder } from '../CommandBuilder/CommandBuilder';
|
|
3
|
-
/**
|
|
4
|
-
* Validate ALREADY PARSED args using the validators defined in the command builder.
|
|
5
|
-
*/
|
|
6
|
-
export declare function assertValidArguments(cmd: CommandBuilder, parsedArgs: Any[]): any[];
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { CommandBuilder } from '../CommandBuilder/CommandBuilder';
|
|
2
|
-
import { OptionValues } from 'commander';
|
|
3
|
-
/**
|
|
4
|
-
* Validate ALREADY PARSED options using the validators defined in the command builder.
|
|
5
|
-
*/
|
|
6
|
-
export declare function assertValidOptions(cb: CommandBuilder, parsedOptions: OptionValues): OptionValues;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function errorToString(error: unknown): string;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function getARGV(argv?: string[]): string[];
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { CommandBuilder } from '../CommandBuilder/CommandBuilder';
|
|
2
|
-
/**
|
|
3
|
-
* Get a command's ancestors, optionally starting from the command itself.
|
|
4
|
-
*/
|
|
5
|
-
export declare function getAncestors(cmd: CommandBuilder, options?: {
|
|
6
|
-
includeSelf?: boolean;
|
|
7
|
-
}): CommandBuilder[];
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { CommandBuilder } from '../CommandBuilder/CommandBuilder';
|
|
2
|
-
/**
|
|
3
|
-
* Returns a command's and its children's prefix strings.
|
|
4
|
-
*/
|
|
5
|
-
export declare function prefixStringsRecursive(cmd: CommandBuilder, filter?: (prefix: string, cmd: CommandBuilder) => boolean): string[][];
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { Option } from 'commander';
|
|
2
|
-
/**
|
|
3
|
-
* Update an Option's 'flags' property from its 'short' and 'long' properties.
|
|
4
|
-
* The flags property is not automatically updated when 'short' or 'long' are changed.
|
|
5
|
-
*/
|
|
6
|
-
export declare function renderOptionFlags(opt: Option): string;
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { CommandBuilder } from '../CommandBuilder/CommandBuilder';
|
|
2
|
-
/**
|
|
3
|
-
* Returns an iterator that walks the command's ancestors, optionally starting with the command itself.
|
|
4
|
-
*/
|
|
5
|
-
export declare function walkAncestors(cmd: CommandBuilder, options?: {
|
|
6
|
-
includeSelf?: boolean;
|
|
7
|
-
}): Generator<CommandBuilder>;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { JsonRawPrimitive } from '@bemoje/util';
|
|
2
|
-
/**
|
|
3
|
-
* Creates a parser function that parses a delimited string into a list of typed values.
|
|
4
|
-
* The parsers array corresponds to the ordering of the expected input values.
|
|
5
|
-
*
|
|
6
|
-
* @param delimiter - The delimiter used to split the string into individual values.
|
|
7
|
-
* @param parsers - An array of functions used to parse each individual value in the string.
|
|
8
|
-
* @returns A function that takes a delimited string and returns an array of typed values.
|
|
9
|
-
* @template T - The type of the values in the list.
|
|
10
|
-
*/
|
|
11
|
-
export declare function createTupleListParser<T extends JsonRawPrimitive = JsonRawPrimitive>(delimiter: string, parsers: ((value: string) => T)[]): (value: string) => T[];
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { AbstractStringParserSelector } from './AbstractStringParserSelector';
|
|
2
|
-
import { ArgumentBuilder } from '../../core/CommandBuilder/ArgumentBuilder';
|
|
3
|
-
import { JsonValue } from '@bemoje/util';
|
|
4
|
-
import { TStringParser } from '../../types/TStringParser';
|
|
5
|
-
export declare class ArgumentParserSelector extends AbstractStringParserSelector<ArgumentBuilder> {
|
|
6
|
-
custom<T extends JsonValue>(parser: TStringParser<T>): ArgumentBuilder;
|
|
7
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { AbstractStringParserSelector } from './AbstractStringParserSelector';
|
|
2
|
-
import { JsonValue } from '@bemoje/util';
|
|
3
|
-
import { OptionBuilder } from '../../core/CommandBuilder/OptionBuilder';
|
|
4
|
-
import { TStringParser } from '../../types/TStringParser';
|
|
5
|
-
export declare class OptionArgumentParserSelector extends AbstractStringParserSelector<OptionBuilder> {
|
|
6
|
-
custom<T extends JsonValue>(parser: TStringParser<T>): OptionBuilder;
|
|
7
|
-
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { JsonRawPrimitive } from '@bemoje/util';
|
|
2
|
-
import { TStringParser } from './TStringParser';
|
|
3
|
-
import { TValidator } from './TValidator';
|
|
4
|
-
export interface IConfigDefinePropertyOptions<Val = JsonRawPrimitive> {
|
|
5
|
-
description: string;
|
|
6
|
-
defaultValue: Val;
|
|
7
|
-
parse: TStringParser<Val>;
|
|
8
|
-
validate?: TValidator<Val>;
|
|
9
|
-
}
|
package/src/types/IPresets.d.ts
DELETED