@bemoje/cli 0.0.4 → 0.0.5
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/.eslintrc.json +5 -0
- package/.swcrc +32 -0
- package/dist/cjs/arg/ArgumentBuilder.js +45 -0
- package/dist/cjs/arg/ArgumentBuilder.js.map +1 -0
- package/dist/cjs/arg/ArgumentParserSelector.js +15 -0
- package/dist/cjs/arg/ArgumentParserSelector.js.map +1 -0
- package/dist/cjs/arg/ArgumentReader.js +38 -0
- package/dist/cjs/arg/ArgumentReader.js.map +1 -0
- package/dist/cjs/arg/ArgumentValidatorSelector.js +16 -0
- package/dist/cjs/arg/ArgumentValidatorSelector.js.map +1 -0
- package/dist/cjs/cmd/CLI.js +16 -0
- package/dist/cjs/cmd/CLI.js.map +1 -0
- package/dist/cjs/cmd/CommandBuilder.js +1098 -0
- package/dist/cjs/cmd/CommandBuilder.js.map +1 -0
- package/dist/cjs/cmd/CommandBuilderMetaData.js +43 -0
- package/dist/cjs/cmd/CommandBuilderMetaData.js.map +1 -0
- package/dist/cjs/cmd/CommandFeatureSelector.js +112 -0
- package/dist/cjs/cmd/CommandFeatureSelector.js.map +1 -0
- package/dist/cjs/cmd/DefaultHelpConfig.js +141 -0
- package/dist/cjs/cmd/DefaultHelpConfig.js.map +1 -0
- package/dist/cjs/cmd/asdas.js +27 -0
- package/dist/cjs/cmd/asdas.js.map +1 -0
- package/dist/cjs/core/OutputManager.js +99 -0
- package/dist/cjs/core/OutputManager.js.map +1 -0
- package/dist/cjs/core/ParserSelector.js +36 -0
- package/dist/cjs/core/ParserSelector.js.map +1 -0
- package/dist/cjs/core/ValidatorSelector.js +36 -0
- package/dist/cjs/core/ValidatorSelector.js.map +1 -0
- package/dist/cjs/core/splitCombinedArgvShorts.js +15 -0
- package/dist/cjs/core/splitCombinedArgvShorts.js.map +1 -0
- package/dist/cjs/db/AbstractJsonFileSection.js +190 -0
- package/dist/cjs/db/AbstractJsonFileSection.js.map +1 -0
- package/dist/cjs/db/AppDataSection.js +48 -0
- package/dist/cjs/db/AppDataSection.js.map +1 -0
- package/dist/cjs/db/ConfigSection.js +71 -0
- package/dist/cjs/db/ConfigSection.js.map +1 -0
- package/dist/cjs/db/JsonFile.js +55 -0
- package/dist/cjs/db/JsonFile.js.map +1 -0
- package/dist/cjs/db/PresetsSection.js +92 -0
- package/dist/cjs/db/PresetsSection.js.map +1 -0
- package/dist/cjs/index.js +120 -0
- package/dist/cjs/index.js.map +1 -0
- package/dist/cjs/opt/OptionArgumentParserSelector.js +16 -0
- package/dist/cjs/opt/OptionArgumentParserSelector.js.map +1 -0
- package/dist/cjs/opt/OptionArgumentValidatorSelector.js +19 -0
- package/dist/cjs/opt/OptionArgumentValidatorSelector.js.map +1 -0
- package/dist/cjs/opt/OptionBuilder.js +88 -0
- package/dist/cjs/opt/OptionBuilder.js.map +1 -0
- package/dist/cjs/opt/OptionHelpers.js +57 -0
- package/dist/cjs/opt/OptionHelpers.js.map +1 -0
- package/dist/cjs/opt/OptionReader.js +66 -0
- package/dist/cjs/opt/OptionReader.js.map +1 -0
- package/dist/cjs/proto/overrideCommanderPrototype.js +37 -0
- package/dist/cjs/proto/overrideCommanderPrototype.js.map +1 -0
- package/dist/cjs/types/IConfig.js +3 -0
- package/dist/cjs/types/IConfig.js.map +1 -0
- package/dist/cjs/types/IPreset.js +3 -0
- package/dist/cjs/types/IPreset.js.map +1 -0
- package/dist/cjs/util/array/arrLast.js +21 -0
- package/dist/cjs/util/array/arrLast.js.map +1 -0
- package/dist/cjs/util/array/arrSome.js +26 -0
- package/dist/cjs/util/array/arrSome.js.map +1 -0
- package/dist/cjs/util/array/types/ArrayPredicate.js +3 -0
- package/dist/cjs/util/array/types/ArrayPredicate.js.map +1 -0
- package/dist/cjs/util/db/JsonDB.js +145 -0
- package/dist/cjs/util/db/JsonDB.js.map +1 -0
- package/dist/cjs/util/errors/ErrorParser.js +164 -0
- package/dist/cjs/util/errors/ErrorParser.js.map +1 -0
- package/dist/cjs/util/fs/promptUserEditInTextEditor/IGetUserInputFromEditorOptions.js +3 -0
- package/dist/cjs/util/fs/promptUserEditInTextEditor/IGetUserInputFromEditorOptions.js.map +1 -0
- package/dist/cjs/util/fs/promptUserEditInTextEditor/promptUserEditInTextEditorSync.js +32 -0
- package/dist/cjs/util/fs/promptUserEditInTextEditor/promptUserEditInTextEditorSync.js.map +1 -0
- package/dist/cjs/util/fs/promptUserEditInTextEditor/promptUserEditJsonInTextEditorSync.js +25 -0
- package/dist/cjs/util/fs/promptUserEditInTextEditor/promptUserEditJsonInTextEditorSync.js.map +1 -0
- package/dist/cjs/util/fs/readFile/readFileSafeSync.js +28 -0
- package/dist/cjs/util/fs/readFile/readFileSafeSync.js.map +1 -0
- package/dist/cjs/util/fs/readFile/readFileSync.js +20 -0
- package/dist/cjs/util/fs/readFile/readFileSync.js.map +1 -0
- package/dist/cjs/util/fs/readJsonFile/readJsonFileSafeSync.js +24 -0
- package/dist/cjs/util/fs/readJsonFile/readJsonFileSafeSync.js.map +1 -0
- package/dist/cjs/util/fs/removeFile/removeFile.js +6 -0
- package/dist/cjs/util/fs/removeFile/removeFile.js.map +1 -0
- package/dist/cjs/util/fs/tempFile/tempFileSync.js +28 -0
- package/dist/cjs/util/fs/tempFile/tempFileSync.js.map +1 -0
- package/dist/cjs/util/fs/types/IReadJsonFileOptions.js +3 -0
- package/dist/cjs/util/fs/types/IReadJsonFileOptions.js.map +1 -0
- package/dist/cjs/util/fs/writeFile/writeFileSafeSync.js +6 -0
- package/dist/cjs/util/fs/writeFile/writeFileSafeSync.js.map +1 -0
- package/dist/cjs/util/fs/writeFile/writeFileSync.js +6 -0
- package/dist/cjs/util/fs/writeFile/writeFileSync.js.map +1 -0
- package/dist/cjs/util/fs/writeJsonFile/writeJsonFileSafe.js +6 -0
- package/dist/cjs/util/fs/writeJsonFile/writeJsonFileSafe.js.map +1 -0
- package/dist/cjs/util/function/MethodDisabler.js +94 -0
- package/dist/cjs/util/function/MethodDisabler.js.map +1 -0
- package/dist/cjs/util/function/funSetName.js +21 -0
- package/dist/cjs/util/function/funSetName.js.map +1 -0
- package/dist/cjs/util/node/execInherit.js +19 -0
- package/dist/cjs/util/node/execInherit.js.map +1 -0
- package/dist/cjs/util/node/formatTableForTerminal.js +21 -0
- package/dist/cjs/util/node/formatTableForTerminal.js.map +1 -0
- package/dist/cjs/util/object/arrAssign.js +6 -0
- package/dist/cjs/util/object/arrAssign.js.map +1 -0
- package/dist/cjs/util/object/createArrayMerger.js +20 -0
- package/dist/cjs/util/object/createArrayMerger.js.map +1 -0
- package/dist/cjs/util/object/createObjectMerger.js +20 -0
- package/dist/cjs/util/object/createObjectMerger.js.map +1 -0
- package/dist/cjs/util/object/objAssign.js +6 -0
- package/dist/cjs/util/object/objAssign.js.map +1 -0
- package/dist/cjs/util/object/objUpdatePropertyDescriptors.js +28 -0
- package/dist/cjs/util/object/objUpdatePropertyDescriptors.js.map +1 -0
- package/dist/cjs/util/object/realizeLazyProperty.js +14 -0
- package/dist/cjs/util/object/realizeLazyProperty.js.map +1 -0
- package/dist/cjs/util/object/setNonEnumerable.js +25 -0
- package/dist/cjs/util/object/setNonEnumerable.js.map +1 -0
- package/dist/cjs/util/os/defaultOpenInEditorCommand.js +18 -0
- package/dist/cjs/util/os/defaultOpenInEditorCommand.js.map +1 -0
- package/dist/cjs/util/os/isOSX.js +13 -0
- package/dist/cjs/util/os/isOSX.js.map +1 -0
- package/dist/cjs/util/os/isVsCodeInstalled.js +19 -0
- package/dist/cjs/util/os/isVsCodeInstalled.js.map +1 -0
- package/dist/cjs/util/os/isWindows.js +16 -0
- package/dist/cjs/util/os/isWindows.js.map +1 -0
- package/dist/cjs/util/path/getTempDataPath.js +20 -0
- package/dist/cjs/util/path/getTempDataPath.js.map +1 -0
- package/dist/cjs/util/regex/regexEscapeString.js +18 -0
- package/dist/cjs/util/regex/regexEscapeString.js.map +1 -0
- package/dist/cjs/util/string/strEnsureStartsWith.js +19 -0
- package/dist/cjs/util/string/strEnsureStartsWith.js.map +1 -0
- package/dist/cjs/util/string/strFirstCharToUpperCase.js +16 -0
- package/dist/cjs/util/string/strFirstCharToUpperCase.js.map +1 -0
- package/dist/cjs/util/string/strIsLowerCase.js +18 -0
- package/dist/cjs/util/string/strIsLowerCase.js.map +1 -0
- package/dist/cjs/util/string/strIsUpperCase.js +18 -0
- package/dist/cjs/util/string/strIsUpperCase.js.map +1 -0
- package/dist/cjs/util/string/strSplitCamelCase.js +55 -0
- package/dist/cjs/util/string/strSplitCamelCase.js.map +1 -0
- package/dist/cjs/util/string-parsers/createBooleanParser.js +21 -0
- package/dist/cjs/util/string-parsers/createBooleanParser.js.map +1 -0
- package/dist/cjs/util/string-parsers/createTypedListParser.js +22 -0
- package/dist/cjs/util/string-parsers/createTypedListParser.js.map +1 -0
- package/dist/cjs/util/string-parsers/parseBoolean.js +15 -0
- package/dist/cjs/util/string-parsers/parseBoolean.js.map +1 -0
- package/dist/cjs/util/string-parsers/parseInteger.js +17 -0
- package/dist/cjs/util/string-parsers/parseInteger.js.map +1 -0
- package/dist/cjs/util/string-parsers/parseNumber.js +13 -0
- package/dist/cjs/util/string-parsers/parseNumber.js.map +1 -0
- package/dist/cjs/util/string-parsers/parseString.js +8 -0
- package/dist/cjs/util/string-parsers/parseString.js.map +1 -0
- package/dist/cjs/util/types/Any.js +3 -0
- package/dist/cjs/util/types/Any.js.map +1 -0
- package/dist/cjs/util/types/DeepArray.js +3 -0
- package/dist/cjs/util/types/DeepArray.js.map +1 -0
- package/dist/cjs/util/types/DeepObject.js +3 -0
- package/dist/cjs/util/types/DeepObject.js.map +1 -0
- package/dist/cjs/util/types/JsonArray.js +3 -0
- package/dist/cjs/util/types/JsonArray.js.map +1 -0
- package/dist/cjs/util/types/JsonDefinedPrimitive.js +6 -0
- package/dist/cjs/util/types/JsonDefinedPrimitive.js.map +1 -0
- package/dist/cjs/util/types/JsonObject.js +3 -0
- package/dist/cjs/util/types/JsonObject.js.map +1 -0
- package/dist/cjs/util/types/JsonRawPrimitive.js +3 -0
- package/dist/cjs/util/types/JsonRawPrimitive.js.map +1 -0
- package/dist/cjs/util/types/JsonValue.js +3 -0
- package/dist/cjs/util/types/JsonValue.js.map +1 -0
- package/dist/cjs/util/types/ObjectKey.js +3 -0
- package/dist/cjs/util/types/ObjectKey.js.map +1 -0
- package/dist/cjs/util/types/TConstructor.js +3 -0
- package/dist/cjs/util/types/TConstructor.js.map +1 -0
- package/dist/cjs/util/types/TFunction.js +3 -0
- package/dist/cjs/util/types/TFunction.js.map +1 -0
- package/dist/cjs/util/types/TFunctionNoNew.js +3 -0
- package/dist/cjs/util/types/TFunctionNoNew.js.map +1 -0
- package/dist/cjs/util/types/TPlainObject.js +3 -0
- package/dist/cjs/util/types/TPlainObject.js.map +1 -0
- package/dist/cjs/util/types/TPrimitive.js +3 -0
- package/dist/cjs/util/types/TPrimitive.js.map +1 -0
- package/dist/cjs/util/types/TStringParser.js +3 -0
- package/dist/cjs/util/types/TStringParser.js.map +1 -0
- package/dist/cjs/util/types/TValidator.js +3 -0
- package/dist/cjs/util/types/TValidator.js.map +1 -0
- package/dist/cjs/util/validation/createTypedArrayValidator.js +26 -0
- package/dist/cjs/util/validation/createTypedArrayValidator.js.map +1 -0
- package/dist/cjs/util/validation/ensureThat.js +12 -0
- package/dist/cjs/util/validation/ensureThat.js.map +1 -0
- package/dist/cjs/util/validation/isArray.js +5 -0
- package/dist/cjs/util/validation/isArray.js.map +1 -0
- package/dist/cjs/util/validation/isBoolean.js +8 -0
- package/dist/cjs/util/validation/isBoolean.js.map +1 -0
- package/dist/cjs/util/validation/isFunction.js +17 -0
- package/dist/cjs/util/validation/isFunction.js.map +1 -0
- package/dist/cjs/util/validation/isNamedFunction.js +11 -0
- package/dist/cjs/util/validation/isNamedFunction.js.map +1 -0
- package/dist/cjs/util/validation/isNamedFunctionArray.js +9 -0
- package/dist/cjs/util/validation/isNamedFunctionArray.js.map +1 -0
- package/dist/cjs/util/validation/isObject.js +22 -0
- package/dist/cjs/util/validation/isObject.js.map +1 -0
- package/dist/cjs/util/validation/isPlainObject.js +19 -0
- package/dist/cjs/util/validation/isPlainObject.js.map +1 -0
- package/dist/cjs/util/validation/isPrimitive.js +18 -0
- package/dist/cjs/util/validation/isPrimitive.js.map +1 -0
- package/dist/cjs/util/validation/isString.js +8 -0
- package/dist/cjs/util/validation/isString.js.map +1 -0
- package/dist/cjs/util/validation/isStringArray.js +12 -0
- package/dist/cjs/util/validation/isStringArray.js.map +1 -0
- package/dist/cjs/util/validation/isStringWithNoSpacesOrDashes.js +9 -0
- package/dist/cjs/util/validation/isStringWithNoSpacesOrDashes.js.map +1 -0
- package/dist/cjs/util/validation/numbers/isInteger.js +17 -0
- package/dist/cjs/util/validation/numbers/isInteger.js.map +1 -0
- package/dist/cjs/util/validation/numbers/isValidNumber.js +22 -0
- package/dist/cjs/util/validation/numbers/isValidNumber.js.map +1 -0
- package/dist/esm/arg/ArgumentBuilder.js +41 -0
- package/dist/esm/arg/ArgumentBuilder.js.map +1 -0
- package/dist/esm/arg/ArgumentParserSelector.js +11 -0
- package/dist/esm/arg/ArgumentParserSelector.js.map +1 -0
- package/dist/esm/arg/ArgumentReader.js +34 -0
- package/dist/esm/arg/ArgumentReader.js.map +1 -0
- package/dist/esm/arg/ArgumentValidatorSelector.js +12 -0
- package/dist/esm/arg/ArgumentValidatorSelector.js.map +1 -0
- package/dist/esm/cmd/CLI.js +12 -0
- package/dist/esm/cmd/CLI.js.map +1 -0
- package/dist/esm/cmd/CommandBuilder.js +1091 -0
- package/dist/esm/cmd/CommandBuilder.js.map +1 -0
- package/dist/esm/cmd/CommandBuilderMetaData.js +39 -0
- package/dist/esm/cmd/CommandBuilderMetaData.js.map +1 -0
- package/dist/esm/cmd/CommandFeatureSelector.js +108 -0
- package/dist/esm/cmd/CommandFeatureSelector.js.map +1 -0
- package/dist/esm/cmd/DefaultHelpConfig.js +135 -0
- package/dist/esm/cmd/DefaultHelpConfig.js.map +1 -0
- package/dist/esm/cmd/asdas.js +25 -0
- package/dist/esm/cmd/asdas.js.map +1 -0
- package/dist/esm/core/OutputManager.js +92 -0
- package/dist/esm/core/OutputManager.js.map +1 -0
- package/dist/esm/core/ParserSelector.js +32 -0
- package/dist/esm/core/ParserSelector.js.map +1 -0
- package/dist/esm/core/ValidatorSelector.js +32 -0
- package/dist/esm/core/ValidatorSelector.js.map +1 -0
- package/dist/esm/core/splitCombinedArgvShorts.js +11 -0
- package/dist/esm/core/splitCombinedArgvShorts.js.map +1 -0
- package/dist/esm/db/AbstractJsonFileSection.js +186 -0
- package/dist/esm/db/AbstractJsonFileSection.js.map +1 -0
- package/dist/esm/db/AppDataSection.js +44 -0
- package/dist/esm/db/AppDataSection.js.map +1 -0
- package/dist/esm/db/ConfigSection.js +67 -0
- package/dist/esm/db/ConfigSection.js.map +1 -0
- package/dist/esm/db/JsonFile.js +51 -0
- package/dist/esm/db/JsonFile.js.map +1 -0
- package/dist/esm/db/PresetsSection.js +88 -0
- package/dist/esm/db/PresetsSection.js.map +1 -0
- package/dist/esm/index.js +104 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/opt/OptionArgumentParserSelector.js +12 -0
- package/dist/esm/opt/OptionArgumentParserSelector.js.map +1 -0
- package/dist/esm/opt/OptionArgumentValidatorSelector.js +15 -0
- package/dist/esm/opt/OptionArgumentValidatorSelector.js.map +1 -0
- package/dist/esm/opt/OptionBuilder.js +84 -0
- package/dist/esm/opt/OptionBuilder.js.map +1 -0
- package/dist/esm/opt/OptionHelpers.js +54 -0
- package/dist/esm/opt/OptionHelpers.js.map +1 -0
- package/dist/esm/opt/OptionReader.js +62 -0
- package/dist/esm/opt/OptionReader.js.map +1 -0
- package/dist/esm/proto/overrideCommanderPrototype.js +34 -0
- package/dist/esm/proto/overrideCommanderPrototype.js.map +1 -0
- package/dist/esm/types/IConfig.js +2 -0
- package/dist/esm/types/IConfig.js.map +1 -0
- package/dist/esm/types/IPreset.js +2 -0
- package/dist/esm/types/IPreset.js.map +1 -0
- package/dist/esm/util/array/arrLast.js +17 -0
- package/dist/esm/util/array/arrLast.js.map +1 -0
- package/dist/esm/util/array/arrSome.js +22 -0
- package/dist/esm/util/array/arrSome.js.map +1 -0
- package/dist/esm/util/array/types/ArrayPredicate.js +2 -0
- package/dist/esm/util/array/types/ArrayPredicate.js.map +1 -0
- package/dist/esm/util/db/JsonDB.js +141 -0
- package/dist/esm/util/db/JsonDB.js.map +1 -0
- package/dist/esm/util/errors/ErrorParser.js +154 -0
- package/dist/esm/util/errors/ErrorParser.js.map +1 -0
- package/dist/esm/util/fs/promptUserEditInTextEditor/IGetUserInputFromEditorOptions.js +2 -0
- package/dist/esm/util/fs/promptUserEditInTextEditor/IGetUserInputFromEditorOptions.js.map +1 -0
- package/dist/esm/util/fs/promptUserEditInTextEditor/promptUserEditInTextEditorSync.js +28 -0
- package/dist/esm/util/fs/promptUserEditInTextEditor/promptUserEditInTextEditorSync.js.map +1 -0
- package/dist/esm/util/fs/promptUserEditInTextEditor/promptUserEditJsonInTextEditorSync.js +21 -0
- package/dist/esm/util/fs/promptUserEditInTextEditor/promptUserEditJsonInTextEditorSync.js.map +1 -0
- package/dist/esm/util/fs/readFile/readFileSafeSync.js +21 -0
- package/dist/esm/util/fs/readFile/readFileSafeSync.js.map +1 -0
- package/dist/esm/util/fs/readFile/readFileSync.js +13 -0
- package/dist/esm/util/fs/readFile/readFileSync.js.map +1 -0
- package/dist/esm/util/fs/readJsonFile/readJsonFileSafeSync.js +17 -0
- package/dist/esm/util/fs/readJsonFile/readJsonFileSafeSync.js.map +1 -0
- package/dist/esm/util/fs/removeFile/removeFile.js +2 -0
- package/dist/esm/util/fs/removeFile/removeFile.js.map +1 -0
- package/dist/esm/util/fs/tempFile/tempFileSync.js +21 -0
- package/dist/esm/util/fs/tempFile/tempFileSync.js.map +1 -0
- package/dist/esm/util/fs/types/IReadJsonFileOptions.js +2 -0
- package/dist/esm/util/fs/types/IReadJsonFileOptions.js.map +1 -0
- package/dist/esm/util/fs/writeFile/writeFileSafeSync.js +2 -0
- package/dist/esm/util/fs/writeFile/writeFileSafeSync.js.map +1 -0
- package/dist/esm/util/fs/writeFile/writeFileSync.js +2 -0
- package/dist/esm/util/fs/writeFile/writeFileSync.js.map +1 -0
- package/dist/esm/util/fs/writeJsonFile/writeJsonFileSafe.js +2 -0
- package/dist/esm/util/fs/writeJsonFile/writeJsonFileSafe.js.map +1 -0
- package/dist/esm/util/function/MethodDisabler.js +90 -0
- package/dist/esm/util/function/MethodDisabler.js.map +1 -0
- package/dist/esm/util/function/funSetName.js +17 -0
- package/dist/esm/util/function/funSetName.js.map +1 -0
- package/dist/esm/util/node/execInherit.js +15 -0
- package/dist/esm/util/node/execInherit.js.map +1 -0
- package/dist/esm/util/node/formatTableForTerminal.js +14 -0
- package/dist/esm/util/node/formatTableForTerminal.js.map +1 -0
- package/dist/esm/util/object/arrAssign.js +3 -0
- package/dist/esm/util/object/arrAssign.js.map +1 -0
- package/dist/esm/util/object/createArrayMerger.js +16 -0
- package/dist/esm/util/object/createArrayMerger.js.map +1 -0
- package/dist/esm/util/object/createObjectMerger.js +16 -0
- package/dist/esm/util/object/createObjectMerger.js.map +1 -0
- package/dist/esm/util/object/objAssign.js +3 -0
- package/dist/esm/util/object/objAssign.js.map +1 -0
- package/dist/esm/util/object/objUpdatePropertyDescriptors.js +24 -0
- package/dist/esm/util/object/objUpdatePropertyDescriptors.js.map +1 -0
- package/dist/esm/util/object/realizeLazyProperty.js +10 -0
- package/dist/esm/util/object/realizeLazyProperty.js.map +1 -0
- package/dist/esm/util/object/setNonEnumerable.js +21 -0
- package/dist/esm/util/object/setNonEnumerable.js.map +1 -0
- package/dist/esm/util/os/defaultOpenInEditorCommand.js +14 -0
- package/dist/esm/util/os/defaultOpenInEditorCommand.js.map +1 -0
- package/dist/esm/util/os/isOSX.js +9 -0
- package/dist/esm/util/os/isOSX.js.map +1 -0
- package/dist/esm/util/os/isVsCodeInstalled.js +15 -0
- package/dist/esm/util/os/isVsCodeInstalled.js.map +1 -0
- package/dist/esm/util/os/isWindows.js +12 -0
- package/dist/esm/util/os/isWindows.js.map +1 -0
- package/dist/esm/util/path/getTempDataPath.js +13 -0
- package/dist/esm/util/path/getTempDataPath.js.map +1 -0
- package/dist/esm/util/regex/regexEscapeString.js +14 -0
- package/dist/esm/util/regex/regexEscapeString.js.map +1 -0
- package/dist/esm/util/string/strEnsureStartsWith.js +15 -0
- package/dist/esm/util/string/strEnsureStartsWith.js.map +1 -0
- package/dist/esm/util/string/strFirstCharToUpperCase.js +12 -0
- package/dist/esm/util/string/strFirstCharToUpperCase.js.map +1 -0
- package/dist/esm/util/string/strIsLowerCase.js +14 -0
- package/dist/esm/util/string/strIsLowerCase.js.map +1 -0
- package/dist/esm/util/string/strIsUpperCase.js +14 -0
- package/dist/esm/util/string/strIsUpperCase.js.map +1 -0
- package/dist/esm/util/string/strSplitCamelCase.js +51 -0
- package/dist/esm/util/string/strSplitCamelCase.js.map +1 -0
- package/dist/esm/util/string-parsers/createBooleanParser.js +17 -0
- package/dist/esm/util/string-parsers/createBooleanParser.js.map +1 -0
- package/dist/esm/util/string-parsers/createTypedListParser.js +18 -0
- package/dist/esm/util/string-parsers/createTypedListParser.js.map +1 -0
- package/dist/esm/util/string-parsers/parseBoolean.js +12 -0
- package/dist/esm/util/string-parsers/parseBoolean.js.map +1 -0
- package/dist/esm/util/string-parsers/parseInteger.js +13 -0
- package/dist/esm/util/string-parsers/parseInteger.js.map +1 -0
- package/dist/esm/util/string-parsers/parseNumber.js +9 -0
- package/dist/esm/util/string-parsers/parseNumber.js.map +1 -0
- package/dist/esm/util/string-parsers/parseString.js +4 -0
- package/dist/esm/util/string-parsers/parseString.js.map +1 -0
- package/dist/esm/util/types/Any.js +2 -0
- package/dist/esm/util/types/Any.js.map +1 -0
- package/dist/esm/util/types/DeepArray.js +2 -0
- package/dist/esm/util/types/DeepArray.js.map +1 -0
- package/dist/esm/util/types/DeepObject.js +2 -0
- package/dist/esm/util/types/DeepObject.js.map +1 -0
- package/dist/esm/util/types/JsonArray.js +2 -0
- package/dist/esm/util/types/JsonArray.js.map +1 -0
- package/dist/esm/util/types/JsonDefinedPrimitive.js +5 -0
- package/dist/esm/util/types/JsonDefinedPrimitive.js.map +1 -0
- package/dist/esm/util/types/JsonObject.js +2 -0
- package/dist/esm/util/types/JsonObject.js.map +1 -0
- package/dist/esm/util/types/JsonRawPrimitive.js +2 -0
- package/dist/esm/util/types/JsonRawPrimitive.js.map +1 -0
- package/dist/esm/util/types/JsonValue.js +2 -0
- package/dist/esm/util/types/JsonValue.js.map +1 -0
- package/dist/esm/util/types/ObjectKey.js +2 -0
- package/dist/esm/util/types/ObjectKey.js.map +1 -0
- package/dist/esm/util/types/TConstructor.js +2 -0
- package/dist/esm/util/types/TConstructor.js.map +1 -0
- package/dist/esm/util/types/TFunction.js +2 -0
- package/dist/esm/util/types/TFunction.js.map +1 -0
- package/dist/esm/util/types/TFunctionNoNew.js +2 -0
- package/dist/esm/util/types/TFunctionNoNew.js.map +1 -0
- package/dist/esm/util/types/TPlainObject.js +2 -0
- package/dist/esm/util/types/TPlainObject.js.map +1 -0
- package/dist/esm/util/types/TPrimitive.js +2 -0
- package/dist/esm/util/types/TPrimitive.js.map +1 -0
- package/dist/esm/util/types/TStringParser.js +2 -0
- package/dist/esm/util/types/TStringParser.js.map +1 -0
- package/dist/esm/util/types/TValidator.js +2 -0
- package/dist/esm/util/types/TValidator.js.map +1 -0
- package/dist/esm/util/validation/createTypedArrayValidator.js +22 -0
- package/dist/esm/util/validation/createTypedArrayValidator.js.map +1 -0
- package/dist/esm/util/validation/ensureThat.js +8 -0
- package/dist/esm/util/validation/ensureThat.js.map +1 -0
- package/dist/esm/util/validation/isArray.js +2 -0
- package/dist/esm/util/validation/isArray.js.map +1 -0
- package/dist/esm/util/validation/isBoolean.js +4 -0
- package/dist/esm/util/validation/isBoolean.js.map +1 -0
- package/dist/esm/util/validation/isFunction.js +13 -0
- package/dist/esm/util/validation/isFunction.js.map +1 -0
- package/dist/esm/util/validation/isNamedFunction.js +7 -0
- package/dist/esm/util/validation/isNamedFunction.js.map +1 -0
- package/dist/esm/util/validation/isNamedFunctionArray.js +5 -0
- package/dist/esm/util/validation/isNamedFunctionArray.js.map +1 -0
- package/dist/esm/util/validation/isObject.js +18 -0
- package/dist/esm/util/validation/isObject.js.map +1 -0
- package/dist/esm/util/validation/isPlainObject.js +15 -0
- package/dist/esm/util/validation/isPlainObject.js.map +1 -0
- package/dist/esm/util/validation/isPrimitive.js +14 -0
- package/dist/esm/util/validation/isPrimitive.js.map +1 -0
- package/dist/esm/util/validation/isString.js +4 -0
- package/dist/esm/util/validation/isString.js.map +1 -0
- package/dist/esm/util/validation/isStringArray.js +8 -0
- package/dist/esm/util/validation/isStringArray.js.map +1 -0
- package/dist/esm/util/validation/isStringWithNoSpacesOrDashes.js +5 -0
- package/dist/esm/util/validation/isStringWithNoSpacesOrDashes.js.map +1 -0
- package/dist/esm/util/validation/numbers/isInteger.js +14 -0
- package/dist/esm/util/validation/numbers/isInteger.js.map +1 -0
- package/dist/esm/util/validation/numbers/isValidNumber.js +18 -0
- package/dist/esm/util/validation/numbers/isValidNumber.js.map +1 -0
- package/{src → dist/types}/arg/ArgumentBuilder.d.ts +1 -1
- package/{src → dist/types}/arg/ArgumentParserSelector.d.ts +2 -2
- package/{src → dist/types}/arg/ArgumentReader.d.ts +3 -3
- package/{src → dist/types}/arg/ArgumentValidatorSelector.d.ts +2 -2
- package/dist/types/cmd/CLI.d.ts +2 -0
- package/{src → dist/types}/cmd/CommandBuilder.d.ts +26 -28
- package/{src → dist/types}/cmd/CommandBuilderMetaData.d.ts +7 -7
- package/{src → dist/types}/cmd/CommandFeatureSelector.d.ts +1 -1
- package/dist/types/cmd/DefaultHelpConfig.d.ts +28 -0
- package/dist/types/cmd/asdas.d.ts +6 -0
- package/{src → dist/types}/core/OutputManager.d.ts +1 -1
- package/{src → dist/types}/core/ParserSelector.d.ts +3 -3
- package/{src → dist/types}/core/ValidatorSelector.d.ts +2 -2
- package/{src → dist/types}/db/AbstractJsonFileSection.d.ts +3 -3
- package/{src → dist/types}/db/AppDataSection.d.ts +1 -1
- package/{src → dist/types}/db/ConfigSection.d.ts +4 -4
- package/{src → dist/types}/db/PresetsSection.d.ts +2 -2
- package/{src → dist/types}/index.d.ts +1 -0
- package/{src → dist/types}/opt/OptionArgumentParserSelector.d.ts +1 -1
- package/{src → dist/types}/opt/OptionArgumentValidatorSelector.d.ts +2 -2
- package/{src → dist/types}/opt/OptionBuilder.d.ts +2 -1
- package/{src → dist/types}/opt/OptionHelpers.d.ts +2 -2
- package/{src → dist/types}/opt/OptionReader.d.ts +7 -7
- package/dist/types/proto/overrideCommanderPrototype.d.ts +8 -0
- package/{src → dist/types}/types/IConfig.d.ts +3 -3
- package/{src → dist/types}/types/IPreset.d.ts +4 -3
- package/{src → dist/types}/util/db/JsonDB.d.ts +2 -2
- package/{src → dist/types}/util/fs/promptUserEditInTextEditor/promptUserEditInTextEditorSync.d.ts +1 -1
- package/{src → dist/types}/util/fs/promptUserEditInTextEditor/promptUserEditJsonInTextEditorSync.d.ts +1 -1
- package/{src → dist/types}/util/fs/readJsonFile/readJsonFileSafeSync.d.ts +1 -1
- package/{src → dist/types}/util/fs/tempFile/tempFileSync.d.ts +1 -1
- package/{src → dist/types}/util/function/MethodDisabler.d.ts +3 -3
- package/{src → dist/types}/util/object/createObjectMerger.d.ts +1 -1
- package/{src → dist/types}/util/object/objUpdatePropertyDescriptors.d.ts +1 -1
- package/{src → dist/types}/util/object/setNonEnumerable.d.ts +1 -1
- package/{src → dist/types}/util/string-parsers/createTypedListParser.d.ts +1 -1
- package/{src → dist/types}/util/types/DeepArray.d.ts +2 -2
- package/{src → dist/types}/util/types/DeepObject.d.ts +2 -2
- package/{src → dist/types}/util/types/JsonArray.d.ts +2 -2
- package/{src → dist/types}/util/types/JsonObject.d.ts +2 -2
- package/{src → dist/types}/util/types/JsonRawPrimitive.d.ts +1 -1
- package/{src → dist/types}/util/types/JsonValue.d.ts +3 -3
- package/{src → dist/types}/util/types/TConstructor.d.ts +1 -1
- package/dist/types/util/types/TFunction.d.ts +4 -0
- package/{src → dist/types}/util/types/TFunctionNoNew.d.ts +1 -1
- package/{src → dist/types}/util/types/TPlainObject.d.ts +1 -1
- package/dist/types/util/types/TValidator.d.ts +2 -0
- package/{src → dist/types}/util/validation/ensureThat.d.ts +2 -2
- package/{src → dist/types}/util/validation/isFunction.d.ts +1 -1
- package/{src → dist/types}/util/validation/isNamedFunction.d.ts +1 -1
- package/{src → dist/types}/util/validation/isPlainObject.d.ts +2 -2
- package/{src → dist/types}/util/validation/isPrimitive.d.ts +1 -1
- package/jest.config.ts +11 -0
- package/notes/tsc.md +1 -0
- package/package.json +13 -6
- package/project.json +43 -0
- package/scripts/_example/CommandBuilder.example.ts +96 -0
- package/scripts/_example/CommandBuilder.example2.ts +31 -0
- package/scripts/_example/CommandBuilder.example3.ts +20 -0
- package/scripts/_example/bFindIn.ts +207 -0
- package/scripts/currentBemojeUtils.txt +41 -0
- package/scripts/rollupUtils.ts +184 -0
- package/src/arg/ArgumentBuilder.test.ts +102 -0
- package/src/arg/ArgumentBuilder.ts +47 -0
- package/src/arg/ArgumentParserSelector.test.ts +53 -0
- package/src/arg/ArgumentParserSelector.ts +14 -0
- package/src/arg/ArgumentReader.test.ts +60 -0
- package/src/arg/ArgumentReader.ts +33 -0
- package/src/arg/ArgumentValidatorSelector.test.ts +80 -0
- package/src/arg/ArgumentValidatorSelector.ts +14 -0
- package/src/cmd/CLI.test.ts +14 -0
- package/src/cmd/CLI.ts +13 -0
- package/src/cmd/CommandBuilder.test.ts +611 -0
- package/src/cmd/CommandBuilder.ts +1175 -0
- package/src/cmd/CommandBuilderMetaData.test.ts +54 -0
- package/src/cmd/CommandBuilderMetaData.ts +44 -0
- package/src/cmd/CommandFeatureSelector.test.ts +185 -0
- package/src/cmd/CommandFeatureSelector.ts +113 -0
- package/src/cmd/DefaultHelpConfig.test.ts +22 -0
- package/src/cmd/DefaultHelpConfig.ts +141 -0
- package/src/cmd/asdas.ts +40 -0
- package/src/core/OutputManager.test.ts +129 -0
- package/src/core/OutputManager.ts +103 -0
- package/src/core/ParserSelector.test.ts +7 -0
- package/src/core/ParserSelector.ts +38 -0
- package/src/core/ValidatorSelector.test.ts +7 -0
- package/src/core/ValidatorSelector.ts +38 -0
- package/src/core/splitCombinedArgvShorts.test.ts +9 -0
- package/src/core/splitCombinedArgvShorts.ts +10 -0
- package/src/db/AbstractJsonFileSection.test.ts +274 -0
- package/src/db/AbstractJsonFileSection.ts +218 -0
- package/src/db/AppDataSection.test.ts +69 -0
- package/src/db/AppDataSection.ts +46 -0
- package/src/db/ConfigSection.test.ts +95 -0
- package/src/db/ConfigSection.ts +74 -0
- package/src/db/JsonFile.test.ts +56 -0
- package/src/db/JsonFile.ts +52 -0
- package/src/db/PresetsSection.test.ts +130 -0
- package/src/db/PresetsSection.ts +92 -0
- package/src/index.ts +103 -0
- package/src/opt/OptionArgumentParserSelector.test.ts +54 -0
- package/src/opt/OptionArgumentParserSelector.ts +14 -0
- package/src/opt/OptionArgumentValidatorSelector.test.ts +90 -0
- package/src/opt/OptionArgumentValidatorSelector.ts +16 -0
- package/src/opt/OptionBuilder.test.ts +229 -0
- package/src/opt/OptionBuilder.ts +85 -0
- package/src/opt/OptionHelpers.test.ts +229 -0
- package/src/opt/OptionHelpers.ts +57 -0
- package/src/opt/OptionReader.test.ts +106 -0
- package/src/opt/OptionReader.ts +61 -0
- package/src/proto/overrideCommanderPrototype.ts +42 -0
- package/src/types/IConfig.ts +25 -0
- package/src/types/IPreset.ts +16 -0
- package/src/util/array/arrLast.test.ts +25 -0
- package/src/util/array/arrLast.ts +15 -0
- package/src/util/array/arrSome.test.ts +78 -0
- package/src/util/array/arrSome.ts +23 -0
- package/src/util/array/types/ArrayPredicate.ts +10 -0
- package/src/util/db/JsonDB.test.ts +214 -0
- package/src/util/db/JsonDB.ts +138 -0
- package/src/util/errors/ErrorParser.ts +165 -0
- package/src/util/fs/promptUserEditInTextEditor/IGetUserInputFromEditorOptions.ts +15 -0
- package/src/util/fs/promptUserEditInTextEditor/promptUserEditInTextEditorSync.ts +30 -0
- package/src/util/fs/promptUserEditInTextEditor/promptUserEditJsonInTextEditorSync.ts +25 -0
- package/src/util/fs/readFile/readFileSafeSync.ts +20 -0
- package/src/util/fs/readFile/readFileSync.ts +13 -0
- package/src/util/fs/readJsonFile/readJsonFileSafeSync.ts +17 -0
- package/src/util/fs/removeFile/removeFile.ts +1 -0
- package/src/util/fs/tempFile/tempFileSync.ts +21 -0
- package/src/util/fs/types/IReadJsonFileOptions.ts +1 -0
- package/src/util/fs/writeFile/writeFileSafeSync.ts +1 -0
- package/src/util/fs/writeFile/writeFileSync.ts +1 -0
- package/src/util/fs/writeJsonFile/writeJsonFileSafe.ts +1 -0
- package/src/util/function/MethodDisabler.test.ts +112 -0
- package/src/util/function/MethodDisabler.ts +94 -0
- package/src/util/function/funSetName.test.ts +12 -0
- package/src/util/function/funSetName.ts +16 -0
- package/src/util/node/execInherit.ts +14 -0
- package/src/util/node/formatTableForTerminal.ts +12 -0
- package/src/util/object/arrAssign.ts +3 -0
- package/src/util/object/createArrayMerger.test.ts +11 -0
- package/src/util/object/createArrayMerger.ts +15 -0
- package/src/util/object/createObjectMerger.test.ts +11 -0
- package/src/util/object/createObjectMerger.ts +17 -0
- package/src/util/object/objAssign.ts +3 -0
- package/src/util/object/objUpdatePropertyDescriptors.test.ts +40 -0
- package/src/util/object/objUpdatePropertyDescriptors.ts +29 -0
- package/src/util/object/realizeLazyProperty.ts +9 -0
- package/src/util/object/setNonEnumerable.test.ts +63 -0
- package/src/util/object/setNonEnumerable.ts +22 -0
- package/src/util/os/defaultOpenInEditorCommand.ts +14 -0
- package/src/util/os/isOSX.ts +9 -0
- package/src/util/os/isVsCodeInstalled.test.ts +7 -0
- package/src/util/os/isVsCodeInstalled.ts +14 -0
- package/src/util/os/isWindows.ts +12 -0
- package/src/util/path/getTempDataPath.test.ts +9 -0
- package/src/util/path/getTempDataPath.ts +14 -0
- package/src/util/regex/regexEscapeString.test.ts +35 -0
- package/src/util/regex/regexEscapeString.ts +13 -0
- package/src/util/string/strEnsureStartsWith.test.ts +13 -0
- package/src/util/string/strEnsureStartsWith.ts +14 -0
- package/src/util/string/strFirstCharToUpperCase.test.ts +33 -0
- package/src/util/string/strFirstCharToUpperCase.ts +11 -0
- package/src/util/string/strIsLowerCase.test.ts +42 -0
- package/src/util/string/strIsLowerCase.ts +13 -0
- package/src/util/string/strIsUpperCase.test.ts +48 -0
- package/src/util/string/strIsUpperCase.ts +13 -0
- package/src/util/string/strSplitCamelCase.test.ts +54 -0
- package/src/util/string/strSplitCamelCase.ts +51 -0
- package/src/util/string-parsers/createBooleanParser.test.ts +58 -0
- package/src/util/string-parsers/createBooleanParser.ts +21 -0
- package/src/util/string-parsers/createTypedListParser.test.ts +19 -0
- package/src/util/string-parsers/createTypedListParser.ts +19 -0
- package/src/util/string-parsers/parseBoolean.test.ts +30 -0
- package/src/util/string-parsers/parseBoolean.ts +12 -0
- package/src/util/string-parsers/parseInteger.test.ts +52 -0
- package/src/util/string-parsers/parseInteger.ts +9 -0
- package/src/util/string-parsers/parseNumber.test.ts +53 -0
- package/src/util/string-parsers/parseNumber.ts +6 -0
- package/src/util/string-parsers/parseString.test.ts +7 -0
- package/src/util/string-parsers/parseString.ts +3 -0
- package/src/util/types/Any.ts +2 -0
- package/src/util/types/DeepArray.ts +12 -0
- package/src/util/types/DeepObject.ts +16 -0
- package/src/util/types/JsonArray.ts +8 -0
- package/src/util/types/JsonDefinedPrimitive.ts +5 -0
- package/src/util/types/JsonObject.ts +8 -0
- package/src/util/types/JsonRawPrimitive.ts +7 -0
- package/src/util/types/JsonValue.ts +14 -0
- package/src/util/types/ObjectKey.ts +1 -0
- package/src/util/types/TConstructor.ts +6 -0
- package/src/util/types/TFunction.ts +5 -0
- package/src/util/types/TFunctionNoNew.ts +3 -0
- package/src/util/types/TPlainObject.ts +4 -0
- package/src/util/types/TPrimitive.ts +1 -0
- package/src/util/types/TStringParser.ts +1 -0
- package/src/util/types/TValidator.ts +3 -0
- package/src/util/validation/createTypedArrayValidator.test.ts +34 -0
- package/src/util/validation/createTypedArrayValidator.ts +25 -0
- package/src/util/validation/ensureThat.test.ts +37 -0
- package/src/util/validation/ensureThat.ts +14 -0
- package/src/util/validation/isArray.test.ts +7 -0
- package/src/util/validation/isArray.ts +1 -0
- package/src/util/validation/isBoolean.test.ts +31 -0
- package/src/util/validation/isBoolean.ts +3 -0
- package/src/util/validation/isFunction.test.ts +54 -0
- package/src/util/validation/isFunction.ts +14 -0
- package/src/util/validation/isNamedFunction.test.ts +28 -0
- package/src/util/validation/isNamedFunction.ts +8 -0
- package/src/util/validation/isNamedFunctionArray.test.ts +14 -0
- package/src/util/validation/isNamedFunctionArray.ts +5 -0
- package/src/util/validation/isObject.test.ts +57 -0
- package/src/util/validation/isObject.ts +17 -0
- package/src/util/validation/isPlainObject.test.ts +21 -0
- package/src/util/validation/isPlainObject.ts +14 -0
- package/src/util/validation/isPrimitive.ts +15 -0
- package/src/util/validation/isString.test.ts +23 -0
- package/src/util/validation/isString.ts +3 -0
- package/src/util/validation/isStringArray.test.ts +24 -0
- package/src/util/validation/isStringArray.ts +8 -0
- package/src/util/validation/isStringWithNoSpacesOrDashes.test.ts +28 -0
- package/src/util/validation/isStringWithNoSpacesOrDashes.ts +5 -0
- package/src/util/validation/numbers/isInteger.test.ts +25 -0
- package/src/util/validation/numbers/isInteger.ts +13 -0
- package/src/util/validation/numbers/isValidNumber.test.ts +20 -0
- package/src/util/validation/numbers/isValidNumber.ts +17 -0
- package/tsconfig.json +32 -0
- package/tsconfig.lib.json +18 -0
- package/tsconfig.spec.json +10 -0
- package/index.cjs.d.ts +0 -1
- package/index.cjs.js +0 -3231
- package/index.esm.js +0 -3119
- package/src/cmd/CLI.d.ts +0 -2
- package/src/cmd/DefaultHelpConfig.d.ts +0 -2
- package/src/proto/overrideCommanderPrototype.d.ts +0 -8
- package/src/util/types/TFunction.d.ts +0 -4
- package/src/util/types/TValidator.d.ts +0 -1
- /package/{src → dist/types}/core/splitCombinedArgvShorts.d.ts +0 -0
- /package/{src → dist/types}/db/JsonFile.d.ts +0 -0
- /package/{src → dist/types}/util/array/arrLast.d.ts +0 -0
- /package/{src → dist/types}/util/array/arrSome.d.ts +0 -0
- /package/{src → dist/types}/util/array/types/ArrayPredicate.d.ts +0 -0
- /package/{src → dist/types}/util/errors/ErrorParser.d.ts +0 -0
- /package/{src → dist/types}/util/fs/promptUserEditInTextEditor/IGetUserInputFromEditorOptions.d.ts +0 -0
- /package/{src → dist/types}/util/fs/readFile/readFileSafeSync.d.ts +0 -0
- /package/{src → dist/types}/util/fs/readFile/readFileSync.d.ts +0 -0
- /package/{src → dist/types}/util/fs/removeFile/removeFile.d.ts +0 -0
- /package/{src → dist/types}/util/fs/types/IReadJsonFileOptions.d.ts +0 -0
- /package/{src → dist/types}/util/fs/writeFile/writeFileSafeSync.d.ts +0 -0
- /package/{src → dist/types}/util/fs/writeFile/writeFileSync.d.ts +0 -0
- /package/{src → dist/types}/util/fs/writeJsonFile/writeJsonFileSafe.d.ts +0 -0
- /package/{src → dist/types}/util/function/funSetName.d.ts +0 -0
- /package/{src → dist/types}/util/node/execInherit.d.ts +0 -0
- /package/{src → dist/types}/util/node/formatTableForTerminal.d.ts +0 -0
- /package/{src → dist/types}/util/object/arrAssign.d.ts +0 -0
- /package/{src → dist/types}/util/object/createArrayMerger.d.ts +0 -0
- /package/{src → dist/types}/util/object/objAssign.d.ts +0 -0
- /package/{src → dist/types}/util/object/realizeLazyProperty.d.ts +0 -0
- /package/{src → dist/types}/util/os/defaultOpenInEditorCommand.d.ts +0 -0
- /package/{src → dist/types}/util/os/isOSX.d.ts +0 -0
- /package/{src → dist/types}/util/os/isVsCodeInstalled.d.ts +0 -0
- /package/{src → dist/types}/util/os/isWindows.d.ts +0 -0
- /package/{src → dist/types}/util/path/getTempDataPath.d.ts +0 -0
- /package/{src → dist/types}/util/regex/regexEscapeString.d.ts +0 -0
- /package/{src → dist/types}/util/string/strEnsureStartsWith.d.ts +0 -0
- /package/{src → dist/types}/util/string/strFirstCharToUpperCase.d.ts +0 -0
- /package/{src → dist/types}/util/string/strIsLowerCase.d.ts +0 -0
- /package/{src → dist/types}/util/string/strIsUpperCase.d.ts +0 -0
- /package/{src → dist/types}/util/string/strSplitCamelCase.d.ts +0 -0
- /package/{src → dist/types}/util/string-parsers/createBooleanParser.d.ts +0 -0
- /package/{src → dist/types}/util/string-parsers/parseBoolean.d.ts +0 -0
- /package/{src → dist/types}/util/string-parsers/parseInteger.d.ts +0 -0
- /package/{src → dist/types}/util/string-parsers/parseNumber.d.ts +0 -0
- /package/{src → dist/types}/util/string-parsers/parseString.d.ts +0 -0
- /package/{src → dist/types}/util/types/Any.d.ts +0 -0
- /package/{src → dist/types}/util/types/JsonDefinedPrimitive.d.ts +0 -0
- /package/{src → dist/types}/util/types/ObjectKey.d.ts +0 -0
- /package/{src → dist/types}/util/types/TPrimitive.d.ts +0 -0
- /package/{src → dist/types}/util/types/TStringParser.d.ts +0 -0
- /package/{src → dist/types}/util/validation/createTypedArrayValidator.d.ts +0 -0
- /package/{src → dist/types}/util/validation/isArray.d.ts +0 -0
- /package/{src → dist/types}/util/validation/isBoolean.d.ts +0 -0
- /package/{src → dist/types}/util/validation/isNamedFunctionArray.d.ts +0 -0
- /package/{src → dist/types}/util/validation/isObject.d.ts +0 -0
- /package/{src → dist/types}/util/validation/isString.d.ts +0 -0
- /package/{src → dist/types}/util/validation/isStringArray.d.ts +0 -0
- /package/{src → dist/types}/util/validation/isStringWithNoSpacesOrDashes.d.ts +0 -0
- /package/{src → dist/types}/util/validation/numbers/isInteger.d.ts +0 -0
- /package/{src → dist/types}/util/validation/numbers/isValidNumber.d.ts +0 -0
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import { OutputManager } from './OutputManager'
|
|
2
|
+
|
|
3
|
+
describe(OutputManager.name, () => {
|
|
4
|
+
describe('getInstance', () => {
|
|
5
|
+
it('should return the same instance of OutputManager', () => {
|
|
6
|
+
const instance1 = OutputManager.getInstance()
|
|
7
|
+
const instance2 = OutputManager.getInstance()
|
|
8
|
+
expect(instance1).toBe(instance2)
|
|
9
|
+
})
|
|
10
|
+
})
|
|
11
|
+
|
|
12
|
+
describe('colors', () => {
|
|
13
|
+
it('should have enabled property set to true by default', () => {
|
|
14
|
+
const outputManager = new OutputManager()
|
|
15
|
+
expect(outputManager.colors.enabled).toBe(true)
|
|
16
|
+
})
|
|
17
|
+
})
|
|
18
|
+
|
|
19
|
+
describe('stdout', () => {
|
|
20
|
+
it('should have write method enabled by default', () => {
|
|
21
|
+
const outputManager = new OutputManager()
|
|
22
|
+
expect(outputManager.stdout.isEnabled).toBe(true)
|
|
23
|
+
})
|
|
24
|
+
|
|
25
|
+
it('should disable the write method', () => {
|
|
26
|
+
const outputManager = new OutputManager()
|
|
27
|
+
outputManager.stdout.disable()
|
|
28
|
+
expect(outputManager.stdout.isEnabled).toBe(false)
|
|
29
|
+
})
|
|
30
|
+
})
|
|
31
|
+
|
|
32
|
+
describe('stderr', () => {
|
|
33
|
+
it('should have write method enabled by default', () => {
|
|
34
|
+
const outputManager = new OutputManager()
|
|
35
|
+
expect(outputManager.stderr.isEnabled).toBe(true)
|
|
36
|
+
})
|
|
37
|
+
|
|
38
|
+
it('should enable the write method', () => {
|
|
39
|
+
const outputManager = new OutputManager()
|
|
40
|
+
outputManager.stderr.disable()
|
|
41
|
+
expect(outputManager.stderr.isEnabled).toBe(false)
|
|
42
|
+
})
|
|
43
|
+
})
|
|
44
|
+
|
|
45
|
+
describe('debug', () => {
|
|
46
|
+
it('should have debug method disabled by default', () => {
|
|
47
|
+
const outputManager = new OutputManager()
|
|
48
|
+
expect(outputManager.debug.isEnabled).toBe(false)
|
|
49
|
+
})
|
|
50
|
+
|
|
51
|
+
it('should enable the debug method', () => {
|
|
52
|
+
const outputManager = new OutputManager()
|
|
53
|
+
outputManager.debug.enable()
|
|
54
|
+
expect(outputManager.debug.isEnabled).toBe(true)
|
|
55
|
+
})
|
|
56
|
+
})
|
|
57
|
+
|
|
58
|
+
describe('reset', () => {
|
|
59
|
+
it('should enable colors', () => {
|
|
60
|
+
const outputManager = new OutputManager()
|
|
61
|
+
outputManager.colors.enabled = false
|
|
62
|
+
outputManager.reset()
|
|
63
|
+
expect(outputManager.colors.enabled).toBe(true)
|
|
64
|
+
})
|
|
65
|
+
|
|
66
|
+
it('should enable the write method of process.stdout', () => {
|
|
67
|
+
const outputManager = new OutputManager()
|
|
68
|
+
outputManager.stdout.disable()
|
|
69
|
+
outputManager.reset()
|
|
70
|
+
expect(outputManager.stdout.isEnabled).toBe(true)
|
|
71
|
+
})
|
|
72
|
+
|
|
73
|
+
it('should enable the write method of process.stderr', () => {
|
|
74
|
+
const outputManager = new OutputManager()
|
|
75
|
+
outputManager.stderr.disable()
|
|
76
|
+
outputManager.reset()
|
|
77
|
+
expect(outputManager.stderr.isEnabled).toBe(true)
|
|
78
|
+
})
|
|
79
|
+
|
|
80
|
+
it('should disable the debug method of console', () => {
|
|
81
|
+
const outputManager = new OutputManager()
|
|
82
|
+
outputManager.debug.enable()
|
|
83
|
+
outputManager.reset()
|
|
84
|
+
expect(outputManager.debug.isEnabled).toBe(false)
|
|
85
|
+
})
|
|
86
|
+
|
|
87
|
+
it('should return the OutputManager instance', () => {
|
|
88
|
+
const outputManager = new OutputManager()
|
|
89
|
+
expect(outputManager.reset()).toBe(outputManager)
|
|
90
|
+
})
|
|
91
|
+
})
|
|
92
|
+
|
|
93
|
+
describe('outputDebug', () => {
|
|
94
|
+
it('should log the debug message to the console if debug method is enabled', () => {
|
|
95
|
+
const outputManager = new OutputManager()
|
|
96
|
+
outputManager.debug.enable()
|
|
97
|
+
const spy = jest.spyOn(console, 'debug').mockImplementation(() => {})
|
|
98
|
+
outputManager.outputDebug(() => 'msg')
|
|
99
|
+
expect(spy).toHaveBeenCalledWith('msg')
|
|
100
|
+
})
|
|
101
|
+
})
|
|
102
|
+
|
|
103
|
+
describe('drainDebugMessageQueue', () => {
|
|
104
|
+
it('should log all the messages in the debug message queue to the console', () => {
|
|
105
|
+
const outputManager = new OutputManager()
|
|
106
|
+
const spy = jest.spyOn(console, 'debug')
|
|
107
|
+
outputManager.outputDebug(() => 'msg')
|
|
108
|
+
outputManager.outputDebug(() => 'msg')
|
|
109
|
+
outputManager.drainDebugMessageQueue()
|
|
110
|
+
expect(spy).toHaveBeenCalledTimes(2)
|
|
111
|
+
})
|
|
112
|
+
|
|
113
|
+
it('should empty the debug message queue', () => {
|
|
114
|
+
const outputManager = new OutputManager()
|
|
115
|
+
outputManager.outputDebug(() => 'msg')
|
|
116
|
+
outputManager.drainDebugMessageQueue()
|
|
117
|
+
expect(outputManager.queueSize).toBe(0)
|
|
118
|
+
})
|
|
119
|
+
})
|
|
120
|
+
|
|
121
|
+
describe('queueSize', () => {
|
|
122
|
+
it('should return number of debug messages in the queue', () => {
|
|
123
|
+
const outputManager = new OutputManager()
|
|
124
|
+
expect(outputManager.queueSize).toBe(0)
|
|
125
|
+
outputManager.outputDebug(() => 'msg')
|
|
126
|
+
expect(outputManager.queueSize).toBe(1)
|
|
127
|
+
})
|
|
128
|
+
})
|
|
129
|
+
})
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import colors from 'ansi-colors'
|
|
2
|
+
import type { Any } from '../util/types/Any'
|
|
3
|
+
import { MethodDisabler } from '../util/function/MethodDisabler'
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* The OutputManager class manages the output of debug messages to the console.
|
|
7
|
+
*/
|
|
8
|
+
export class OutputManager {
|
|
9
|
+
/**
|
|
10
|
+
* The singleton instance of the OutputManager class.
|
|
11
|
+
*/
|
|
12
|
+
private static instance: OutputManager
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Returns the singleton instance of the OutputManager class.
|
|
16
|
+
* If the instance does not exist, it creates a new one.
|
|
17
|
+
*/
|
|
18
|
+
static getInstance() {
|
|
19
|
+
if (!this.instance) this.instance = new OutputManager()
|
|
20
|
+
return this.instance
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Ansi-colors object
|
|
25
|
+
*/
|
|
26
|
+
readonly colors = colors
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* A MethodDisabler instance for disabling the write method of the process.stdout object.
|
|
30
|
+
*/
|
|
31
|
+
readonly stdout = new MethodDisabler(process.stdout, 'write')
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* A MethodDisabler instance for disabling the write method of the process.stderr object.
|
|
35
|
+
*/
|
|
36
|
+
readonly stderr = new MethodDisabler(process.stderr, 'write')
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* A MethodDisabler instance for disabling the debug method of the console object.
|
|
40
|
+
*/
|
|
41
|
+
readonly debug = new MethodDisabler(console, 'debug')
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* An array that holds queued debug messages.
|
|
45
|
+
*/
|
|
46
|
+
protected readonly debugMsgQueue: (() => Any)[] = []
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Constructs a new instance of the OutputManager class.
|
|
50
|
+
* console.debug is disabled by default.
|
|
51
|
+
*/
|
|
52
|
+
constructor() {
|
|
53
|
+
this.debug.disable()
|
|
54
|
+
colors.enabled = (() => {
|
|
55
|
+
const { FORCE_COLOR, NODE_DISABLE_COLORS, NO_COLOR, TERM } = process.env
|
|
56
|
+
return (
|
|
57
|
+
!NODE_DISABLE_COLORS &&
|
|
58
|
+
NO_COLOR == null &&
|
|
59
|
+
TERM !== 'dumb' &&
|
|
60
|
+
((FORCE_COLOR != null && FORCE_COLOR !== '0') || (process.stdout && process.stdout.isTTY))
|
|
61
|
+
)
|
|
62
|
+
})()
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
get queueSize() {
|
|
66
|
+
return this.debugMsgQueue.length
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* Resets the OutputManager to its default state.
|
|
71
|
+
* - Enables colors.
|
|
72
|
+
* - Enables the write method of the process.stdout object.
|
|
73
|
+
* - Enables the write method of the process.stderr object.
|
|
74
|
+
* - Disables the debug method of the console object.
|
|
75
|
+
* @returns The OutputManager instance.
|
|
76
|
+
*/
|
|
77
|
+
reset() {
|
|
78
|
+
this.colors.enabled = true
|
|
79
|
+
this.stdout.enable()
|
|
80
|
+
this.stderr.enable()
|
|
81
|
+
this.debug.disable()
|
|
82
|
+
return this
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* Outputs a debug message to the console.
|
|
87
|
+
* If the debug method is enabled, the message is immediately logged to the console.
|
|
88
|
+
* Otherwise, the message is added to the debug message queue.
|
|
89
|
+
* @param fn - A function that returns the debug message.
|
|
90
|
+
*/
|
|
91
|
+
outputDebug(fn: () => Any) {
|
|
92
|
+
if (this.debug.isEnabled) console.debug(fn())
|
|
93
|
+
else this.debugMsgQueue.push(fn)
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* Drains the debug message queue by logging all the messages to the console.
|
|
98
|
+
*/
|
|
99
|
+
drainDebugMessageQueue() {
|
|
100
|
+
this.debugMsgQueue.forEach((fn) => console.debug(fn()))
|
|
101
|
+
this.debugMsgQueue.splice(0, this.debugMsgQueue.length)
|
|
102
|
+
}
|
|
103
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { ArgumentBuilder } from '../arg/ArgumentBuilder'
|
|
2
|
+
import { createTypedListParser } from '../util/string-parsers/createTypedListParser'
|
|
3
|
+
import type { JsonValue } from '../util/types/JsonValue'
|
|
4
|
+
import { OptionBuilder } from '../opt/OptionBuilder'
|
|
5
|
+
import { parseInteger } from '../util/string-parsers/parseInteger'
|
|
6
|
+
import { parseNumber } from '../util/string-parsers/parseNumber'
|
|
7
|
+
import { parseString } from '../util/string-parsers/parseString'
|
|
8
|
+
import type { TStringParser } from '../util/types/TStringParser'
|
|
9
|
+
|
|
10
|
+
export abstract class ParserSelector<Builder extends ArgumentBuilder | OptionBuilder> {
|
|
11
|
+
constructor(protected readonly builder: Builder) {}
|
|
12
|
+
|
|
13
|
+
abstract custom<T extends JsonValue>(parser: TStringParser<T>): Builder
|
|
14
|
+
|
|
15
|
+
string() {
|
|
16
|
+
return this.custom<string>(parseString)
|
|
17
|
+
}
|
|
18
|
+
number() {
|
|
19
|
+
return this.custom<number>(parseNumber)
|
|
20
|
+
}
|
|
21
|
+
integer() {
|
|
22
|
+
return this.custom<number>(parseInteger)
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
delimitedStrings(delimiter = ',') {
|
|
26
|
+
return this.delimited<string>(delimiter, parseString)
|
|
27
|
+
}
|
|
28
|
+
delimitedNumbers(delimiter = ',') {
|
|
29
|
+
return this.delimited<number>(delimiter, parseNumber)
|
|
30
|
+
}
|
|
31
|
+
delimitedIntegers(delimiter = ',') {
|
|
32
|
+
return this.delimited<number>(delimiter, parseInteger)
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
delimited<T extends JsonValue>(delimiter = ',', parser: TStringParser<T>) {
|
|
36
|
+
return this.custom(createTypedListParser(delimiter, parser))
|
|
37
|
+
}
|
|
38
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { ArgumentBuilder } from '../arg/ArgumentBuilder'
|
|
2
|
+
import { createTypedArrayValidator } from '../util/validation/createTypedArrayValidator'
|
|
3
|
+
import { isInteger } from '../util/validation/numbers/isInteger'
|
|
4
|
+
import { isString } from '../util/validation/isString'
|
|
5
|
+
import { isValidNumber } from '../util/validation/numbers/isValidNumber'
|
|
6
|
+
import type { JsonValue } from '../util/types/JsonValue'
|
|
7
|
+
import { OptionBuilder } from '../opt/OptionBuilder'
|
|
8
|
+
import type { TValidator } from '../util/types/TValidator'
|
|
9
|
+
|
|
10
|
+
export abstract class ValidatorSelector<Builder extends OptionBuilder | ArgumentBuilder> {
|
|
11
|
+
constructor(protected readonly builder: Builder) {}
|
|
12
|
+
|
|
13
|
+
abstract custom<O>(validator: TValidator<O>): typeof this.builder
|
|
14
|
+
|
|
15
|
+
isString() {
|
|
16
|
+
return this.custom(isString)
|
|
17
|
+
}
|
|
18
|
+
isNumber() {
|
|
19
|
+
return this.custom(isValidNumber)
|
|
20
|
+
}
|
|
21
|
+
isInteger() {
|
|
22
|
+
return this.custom(isInteger)
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
isStringArray() {
|
|
26
|
+
return this.arrayWhereEach(isString)
|
|
27
|
+
}
|
|
28
|
+
isNumberArray() {
|
|
29
|
+
return this.arrayWhereEach(isValidNumber)
|
|
30
|
+
}
|
|
31
|
+
isIntegerArray() {
|
|
32
|
+
return this.arrayWhereEach(isInteger)
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
arrayWhereEach<O extends JsonValue = JsonValue>(...validators: TValidator<O>[]) {
|
|
36
|
+
return this.custom(createTypedArrayValidator(validators))
|
|
37
|
+
}
|
|
38
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { splitCombinedArgvShorts } from './splitCombinedArgvShorts'
|
|
2
|
+
|
|
3
|
+
describe(splitCombinedArgvShorts.name, () => {
|
|
4
|
+
it('should split only combined short name flags', () => {
|
|
5
|
+
const argv = ['-abc', 'def', '-g', 'h', '-ab']
|
|
6
|
+
const expected = ['-a', '-b', '-c', 'def', '-g', 'h', '-a', '-b']
|
|
7
|
+
expect(splitCombinedArgvShorts(argv)).toEqual(expected)
|
|
8
|
+
})
|
|
9
|
+
})
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export function splitCombinedArgvShorts(argv: string[]) {
|
|
2
|
+
return argv
|
|
3
|
+
.map((arg) => {
|
|
4
|
+
if (arg.length < 3 || !arg.startsWith('-') || arg.startsWith('--') || arg.includes('=')) {
|
|
5
|
+
return arg
|
|
6
|
+
}
|
|
7
|
+
return Array.from(arg.replace('-', '')).map((s) => '-' + s)
|
|
8
|
+
})
|
|
9
|
+
.flat()
|
|
10
|
+
}
|
|
@@ -0,0 +1,274 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
2
|
+
import { AbstractJsonFileSection } from './AbstractJsonFileSection'
|
|
3
|
+
import { CommandBuilder } from '../cmd/CommandBuilder'
|
|
4
|
+
import { JsonFile } from './JsonFile'
|
|
5
|
+
import { JsonValue } from '../../../util/src'
|
|
6
|
+
import { promptUserEditJsonInTextEditorSync } from '../util/fs/promptUserEditInTextEditor/promptUserEditJsonInTextEditorSync'
|
|
7
|
+
|
|
8
|
+
jest.mock('../util/fs/promptUserEditInTextEditor/promptUserEditJsonInTextEditorSync', () => ({
|
|
9
|
+
...jest.requireActual('../util/fs/promptUserEditInTextEditor/promptUserEditJsonInTextEditorSync'),
|
|
10
|
+
promptUserEditJsonInTextEditorSync: jest.fn().mockImplementation(() => {}),
|
|
11
|
+
}))
|
|
12
|
+
|
|
13
|
+
describe(AbstractJsonFileSection.name, () => {
|
|
14
|
+
let cmd: CommandBuilder
|
|
15
|
+
let file: JsonFile
|
|
16
|
+
let section: AbstractJsonFileSection
|
|
17
|
+
let saveSpy: jest.SpyInstance
|
|
18
|
+
class Section<Val = JsonValue> extends AbstractJsonFileSection<Val> {
|
|
19
|
+
override assertValid(): void {
|
|
20
|
+
return
|
|
21
|
+
}
|
|
22
|
+
override defineProperty(key: string, value: Val) {
|
|
23
|
+
this.defaultValues[key] = value
|
|
24
|
+
}
|
|
25
|
+
override initialize() {
|
|
26
|
+
return
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
beforeEach(() => {
|
|
31
|
+
cmd = new CommandBuilder('t')
|
|
32
|
+
file = new JsonFile(cmd)
|
|
33
|
+
section = new Section(file, 'section', false)
|
|
34
|
+
saveSpy = jest.spyOn(file.db, 'save').mockImplementation((() => {}) as any)
|
|
35
|
+
})
|
|
36
|
+
|
|
37
|
+
describe('constructor', () => {
|
|
38
|
+
it('should set the file property', () => {
|
|
39
|
+
expect(section.file).toBe(file)
|
|
40
|
+
})
|
|
41
|
+
|
|
42
|
+
it('should set the prefixBaseString property', () => {
|
|
43
|
+
expect(section.prefixBaseString).toBe('t')
|
|
44
|
+
})
|
|
45
|
+
})
|
|
46
|
+
|
|
47
|
+
describe('get db', () => {
|
|
48
|
+
it('should return the db property of the file', () => {
|
|
49
|
+
expect(section.db).toBe(file.db)
|
|
50
|
+
})
|
|
51
|
+
})
|
|
52
|
+
|
|
53
|
+
describe('get cmd', () => {
|
|
54
|
+
it('should return the cmd property of the file', () => {
|
|
55
|
+
expect(section.cmd).toBe(cmd)
|
|
56
|
+
})
|
|
57
|
+
})
|
|
58
|
+
|
|
59
|
+
describe('save', () => {
|
|
60
|
+
it('should call the save method of the db property', async () => {
|
|
61
|
+
await section.save()
|
|
62
|
+
expect(saveSpy).toHaveBeenCalledTimes(1)
|
|
63
|
+
})
|
|
64
|
+
})
|
|
65
|
+
|
|
66
|
+
describe('prefix', () => {
|
|
67
|
+
it('should return the prefixBaseString + "." + name if no key is provided', () => {
|
|
68
|
+
expect(section.prefix()).toBe('t.section')
|
|
69
|
+
})
|
|
70
|
+
|
|
71
|
+
it('should return the prefixBaseString + "." + name + "." + key if a key is provided', () => {
|
|
72
|
+
expect(section.prefix('key')).toBe('t.section.key')
|
|
73
|
+
})
|
|
74
|
+
})
|
|
75
|
+
|
|
76
|
+
describe('get', () => {
|
|
77
|
+
it('should call the initialize method with false', () => {
|
|
78
|
+
const initializeSpy = jest.spyOn(section, 'initialize')
|
|
79
|
+
section.get('key')
|
|
80
|
+
expect(initializeSpy).toHaveBeenCalledWith(false)
|
|
81
|
+
})
|
|
82
|
+
|
|
83
|
+
it('should return the value associated with the key if it exists in the db', () => {
|
|
84
|
+
jest.spyOn(section.db, 'getSafe').mockReturnValue('value')
|
|
85
|
+
expect(section.get('key')).toBe('value')
|
|
86
|
+
})
|
|
87
|
+
|
|
88
|
+
it('should return the value associated with the key from defaultValues if it does not exist in the db', () => {
|
|
89
|
+
section.defineProperty('key', 'value')
|
|
90
|
+
expect(section.get('key')).toBe('value')
|
|
91
|
+
})
|
|
92
|
+
})
|
|
93
|
+
|
|
94
|
+
describe('getAll', () => {
|
|
95
|
+
it('should call the initialize method with false', () => {
|
|
96
|
+
const initializeSpy = jest.spyOn(section, 'initialize')
|
|
97
|
+
section.getAll()
|
|
98
|
+
expect(initializeSpy).toHaveBeenCalledWith(false)
|
|
99
|
+
})
|
|
100
|
+
|
|
101
|
+
it('should return all the values in the section if they exist in the db', () => {
|
|
102
|
+
const values = { key1: 'value1', key2: 'value2' }
|
|
103
|
+
jest.spyOn(section.db, 'getSafe').mockReturnValue(values)
|
|
104
|
+
expect(section.getAll()).toBe(values)
|
|
105
|
+
})
|
|
106
|
+
|
|
107
|
+
it('should return all the values in the section from defaultValues if they do not exist in the db', () => {
|
|
108
|
+
const values = { key1: 'value1', key2: 'value2' }
|
|
109
|
+
section.defineProperty('key1', 'value1')
|
|
110
|
+
section.defineProperty('key2', 'value2')
|
|
111
|
+
jest.spyOn(section.db, 'getSafe').mockReturnValue(undefined)
|
|
112
|
+
expect(section.getAll()).toEqual(values)
|
|
113
|
+
})
|
|
114
|
+
})
|
|
115
|
+
|
|
116
|
+
describe('get keys', () => {
|
|
117
|
+
it('should return all the keys in the db', () => {
|
|
118
|
+
jest.spyOn(section.db, 'getSafe').mockReturnValue({ key1: 'value1', key2: 'value2' })
|
|
119
|
+
expect(section.keys).toEqual(['key1', 'key2'])
|
|
120
|
+
})
|
|
121
|
+
})
|
|
122
|
+
|
|
123
|
+
describe('count', () => {
|
|
124
|
+
it('should return the number of keys in the section', () => {
|
|
125
|
+
jest.spyOn(section, 'keys', 'get').mockReturnValue(['key1', 'key2'])
|
|
126
|
+
expect(section.count()).toBe(2)
|
|
127
|
+
})
|
|
128
|
+
})
|
|
129
|
+
|
|
130
|
+
describe('set', () => {
|
|
131
|
+
it('should call the initialize method', () => {
|
|
132
|
+
const initializeSpy = jest.spyOn(section, 'initialize')
|
|
133
|
+
section.set('key', 'value')
|
|
134
|
+
expect(initializeSpy).toHaveBeenCalled()
|
|
135
|
+
})
|
|
136
|
+
|
|
137
|
+
it('should call the assertValid method with the key and value', () => {
|
|
138
|
+
const assertValidSpy = jest.spyOn(section, 'assertValid')
|
|
139
|
+
section.set('key', 'value')
|
|
140
|
+
expect(assertValidSpy).toHaveBeenCalledWith('key', 'value')
|
|
141
|
+
})
|
|
142
|
+
|
|
143
|
+
it('should call the set method of the db property with the prefix, value, and save', () => {
|
|
144
|
+
const setSpy = jest.spyOn(section.db, 'set')
|
|
145
|
+
section.set('key', 'value', false)
|
|
146
|
+
expect(setSpy).toHaveBeenCalledWith(section.prefix('key'), 'value', false)
|
|
147
|
+
})
|
|
148
|
+
})
|
|
149
|
+
|
|
150
|
+
describe('setAll', () => {
|
|
151
|
+
it('should call the getAll method', () => {
|
|
152
|
+
const getAllSpy = jest.spyOn(section, 'getAll')
|
|
153
|
+
section.setAll({})
|
|
154
|
+
expect(getAllSpy).toHaveBeenCalled()
|
|
155
|
+
})
|
|
156
|
+
|
|
157
|
+
it('should call the set method for each key-value pair in the values object that is different from the original value', () => {
|
|
158
|
+
section.defineProperty('key1', 'value1')
|
|
159
|
+
section.defineProperty('key2', 'value2')
|
|
160
|
+
const values = { key1: 'new value1', key2: 'value2' }
|
|
161
|
+
const setSpy = jest.spyOn(section, 'set')
|
|
162
|
+
section.setAll(values)
|
|
163
|
+
expect(setSpy).toHaveBeenCalledWith('key1', 'new value1', false)
|
|
164
|
+
expect(setSpy).toHaveBeenCalledTimes(1)
|
|
165
|
+
})
|
|
166
|
+
|
|
167
|
+
it('should call the delete method for each key in the original object that is not in the values object', () => {
|
|
168
|
+
section.defineProperty('key1', 'value1')
|
|
169
|
+
section.defineProperty('key2', 'value2')
|
|
170
|
+
const values = { key1: 'value1' }
|
|
171
|
+
const deleteSpy = jest.spyOn(section, 'delete')
|
|
172
|
+
section.setAll(values)
|
|
173
|
+
expect(deleteSpy).toHaveBeenCalledWith('key2', false)
|
|
174
|
+
expect(deleteSpy).toHaveBeenCalledTimes(1)
|
|
175
|
+
})
|
|
176
|
+
|
|
177
|
+
it('should call the save method if save is true', () => {
|
|
178
|
+
const saveSpy = jest.spyOn(section, 'save')
|
|
179
|
+
section.setAll({}, true)
|
|
180
|
+
expect(saveSpy).toHaveBeenCalled()
|
|
181
|
+
})
|
|
182
|
+
|
|
183
|
+
it('should not call the save method if save is false', () => {
|
|
184
|
+
const saveSpy = jest.spyOn(section, 'save')
|
|
185
|
+
section.setAll({}, false)
|
|
186
|
+
expect(saveSpy).not.toHaveBeenCalled()
|
|
187
|
+
})
|
|
188
|
+
})
|
|
189
|
+
|
|
190
|
+
describe('update', () => {
|
|
191
|
+
it('should call the update method of the db property with the prefix, value, and save', () => {
|
|
192
|
+
section.defineProperty('key', 'value')
|
|
193
|
+
const setSpy = jest.spyOn(section, 'set')
|
|
194
|
+
section.update('key', () => 'value', false)
|
|
195
|
+
expect(setSpy).toHaveBeenCalledWith('key', 'value', false)
|
|
196
|
+
section.update('key', () => 'value', true)
|
|
197
|
+
expect(setSpy).toHaveBeenCalledWith('key', 'value', true)
|
|
198
|
+
})
|
|
199
|
+
})
|
|
200
|
+
|
|
201
|
+
describe('reset', () => {
|
|
202
|
+
it('should call the set method with the key and the default value for the key', () => {
|
|
203
|
+
section.defineProperty('key', 'def')
|
|
204
|
+
const setSpy = jest.spyOn(section, 'set')
|
|
205
|
+
section.reset('key')
|
|
206
|
+
expect(setSpy).toHaveBeenCalledWith('key', 'def', true)
|
|
207
|
+
})
|
|
208
|
+
})
|
|
209
|
+
|
|
210
|
+
describe('resetAll', () => {
|
|
211
|
+
it('should call the setAll method with the defaultValues object', () => {
|
|
212
|
+
section.defineProperty('key1', 'def1')
|
|
213
|
+
section.defineProperty('key2', 'def2')
|
|
214
|
+
const setAllSpy = jest.spyOn(section, 'setAll')
|
|
215
|
+
section.resetAll()
|
|
216
|
+
expect(setAllSpy).toHaveBeenCalledWith({ key1: 'def1', key2: 'def2' }, true)
|
|
217
|
+
})
|
|
218
|
+
})
|
|
219
|
+
|
|
220
|
+
describe('delete', () => {
|
|
221
|
+
it('should call the initialize method', () => {
|
|
222
|
+
const initializeSpy = jest.spyOn(section, 'initialize')
|
|
223
|
+
section.delete('key')
|
|
224
|
+
expect(initializeSpy).toHaveBeenCalled()
|
|
225
|
+
})
|
|
226
|
+
|
|
227
|
+
it('should call the delete method of the db property with the prefix and save', () => {
|
|
228
|
+
const deleteSpy = jest.spyOn(section.db, 'delete')
|
|
229
|
+
section.delete('key', false)
|
|
230
|
+
expect(deleteSpy).toHaveBeenCalledWith(section.prefix('key'), false)
|
|
231
|
+
})
|
|
232
|
+
})
|
|
233
|
+
|
|
234
|
+
describe('deleteAll', () => {
|
|
235
|
+
it('should call the delete method for each key in the section', () => {
|
|
236
|
+
const keys = ['key1', 'key2']
|
|
237
|
+
jest.spyOn(section, 'keys', 'get').mockReturnValue(keys)
|
|
238
|
+
const deleteSpy = jest.spyOn(section, 'delete').mockImplementation((() => {}) as any)
|
|
239
|
+
section.deleteAll()
|
|
240
|
+
expect(deleteSpy).toHaveBeenCalledWith('key1', false)
|
|
241
|
+
expect(deleteSpy).toHaveBeenCalledWith('key2', false)
|
|
242
|
+
expect(deleteSpy).toHaveBeenCalledTimes(2)
|
|
243
|
+
})
|
|
244
|
+
|
|
245
|
+
it('should call the save method if save is true', () => {
|
|
246
|
+
const saveSpy = jest.spyOn(section, 'save')
|
|
247
|
+
section.deleteAll(true)
|
|
248
|
+
expect(saveSpy).toHaveBeenCalled()
|
|
249
|
+
})
|
|
250
|
+
|
|
251
|
+
it('should not call the save method if save is false', () => {
|
|
252
|
+
const saveSpy = jest.spyOn(section, 'save')
|
|
253
|
+
section.deleteAll(false)
|
|
254
|
+
expect(saveSpy).not.toHaveBeenCalled()
|
|
255
|
+
})
|
|
256
|
+
})
|
|
257
|
+
|
|
258
|
+
describe('edit', () => {
|
|
259
|
+
it('should call the getAll method', () => {
|
|
260
|
+
jest.spyOn(section, 'setAll').mockImplementation(() => {})
|
|
261
|
+
const getAllSpy = jest.spyOn(section, 'getAll').mockReturnValue({})
|
|
262
|
+
section.edit()
|
|
263
|
+
expect(getAllSpy).toHaveBeenCalled()
|
|
264
|
+
})
|
|
265
|
+
|
|
266
|
+
it('should call the promptUserEditJsonInTextEditorSync function with the values from getAll', () => {
|
|
267
|
+
const values = { key1: 'value1', key2: 'value2' }
|
|
268
|
+
jest.spyOn(section, 'getAll').mockReturnValue(values)
|
|
269
|
+
jest.spyOn(section, 'setAll').mockImplementation(() => {})
|
|
270
|
+
section.edit()
|
|
271
|
+
expect(promptUserEditJsonInTextEditorSync as jest.Mock).toHaveBeenCalled()
|
|
272
|
+
})
|
|
273
|
+
})
|
|
274
|
+
})
|