@breadstone-infrastructure/utilities 0.0.12-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Cli/Abstracts/ProgramCommandBase.d.ts +60 -0
- package/Cli/Abstracts/ProgramCommandBase.d.ts.map +1 -0
- package/Cli/Abstracts/ProgramCommandBase.js +64 -0
- package/Cli/Abstracts/ProgramCommandBase.js.map +1 -0
- package/Cli/Builders/ProgramBuilder.d.ts +39 -0
- package/Cli/Builders/ProgramBuilder.d.ts.map +1 -0
- package/Cli/Builders/ProgramBuilder.js +73 -0
- package/Cli/Builders/ProgramBuilder.js.map +1 -0
- package/Cli/Builders/ProgramCommandBuilder.d.ts +78 -0
- package/Cli/Builders/ProgramCommandBuilder.d.ts.map +1 -0
- package/Cli/Builders/ProgramCommandBuilder.js +147 -0
- package/Cli/Builders/ProgramCommandBuilder.js.map +1 -0
- package/Cli/Interfaces/IProgramArg.d.ts +11 -0
- package/Cli/Interfaces/IProgramArg.d.ts.map +1 -0
- package/Cli/Interfaces/IProgramArg.js +4 -0
- package/Cli/Interfaces/IProgramArg.js.map +1 -0
- package/Cli/Interfaces/IProgramArgOptions.d.ts +9 -0
- package/Cli/Interfaces/IProgramArgOptions.d.ts.map +1 -0
- package/Cli/Interfaces/IProgramArgOptions.js +4 -0
- package/Cli/Interfaces/IProgramArgOptions.js.map +1 -0
- package/Cli/Interfaces/IProgramArgs.d.ts +27 -0
- package/Cli/Interfaces/IProgramArgs.d.ts.map +1 -0
- package/Cli/Interfaces/IProgramArgs.js +4 -0
- package/Cli/Interfaces/IProgramArgs.js.map +1 -0
- package/Cli/Interfaces/IProgramCommand.d.ts +53 -0
- package/Cli/Interfaces/IProgramCommand.d.ts.map +1 -0
- package/Cli/Interfaces/IProgramCommand.js +4 -0
- package/Cli/Interfaces/IProgramCommand.js.map +1 -0
- package/Cli/Interfaces/IProgramCommands.d.ts +47 -0
- package/Cli/Interfaces/IProgramCommands.d.ts.map +1 -0
- package/Cli/Interfaces/IProgramCommands.js +4 -0
- package/Cli/Interfaces/IProgramCommands.js.map +1 -0
- package/Cli/Interfaces/IProgramConfig.d.ts +10 -0
- package/Cli/Interfaces/IProgramConfig.d.ts.map +1 -0
- package/Cli/Interfaces/IProgramConfig.js +3 -0
- package/Cli/Interfaces/IProgramConfig.js.map +1 -0
- package/Cli/Interfaces/IProgramInit.d.ts +14 -0
- package/Cli/Interfaces/IProgramInit.d.ts.map +1 -0
- package/Cli/Interfaces/IProgramInit.js +3 -0
- package/Cli/Interfaces/IProgramInit.js.map +1 -0
- package/Cli/Program.d.ts +97 -0
- package/Cli/Program.d.ts.map +1 -0
- package/Cli/Program.js +217 -0
- package/Cli/Program.js.map +1 -0
- package/Cli/ProgramArgs.d.ts +39 -0
- package/Cli/ProgramArgs.d.ts.map +1 -0
- package/Cli/ProgramArgs.js +83 -0
- package/Cli/ProgramArgs.js.map +1 -0
- package/Cli/ProgramCommandResult.d.ts +13 -0
- package/Cli/ProgramCommandResult.d.ts.map +1 -0
- package/Cli/ProgramCommandResult.js +3 -0
- package/Cli/ProgramCommandResult.js.map +1 -0
- package/Cli/ProgramCommands.d.ts +66 -0
- package/Cli/ProgramCommands.d.ts.map +1 -0
- package/Cli/ProgramCommands.js +173 -0
- package/Cli/ProgramCommands.js.map +1 -0
- package/Cli/ProgramConfig.d.ts +24 -0
- package/Cli/ProgramConfig.d.ts.map +1 -0
- package/Cli/ProgramConfig.js +51 -0
- package/Cli/ProgramConfig.js.map +1 -0
- package/Cli/ProgramDoneFn.d.ts +5 -0
- package/Cli/ProgramDoneFn.d.ts.map +1 -0
- package/Cli/ProgramDoneFn.js +3 -0
- package/Cli/ProgramDoneFn.js.map +1 -0
- package/Compiler/TypeScript.d.ts +19 -0
- package/Compiler/TypeScript.d.ts.map +1 -0
- package/Compiler/TypeScript.js +166 -0
- package/Compiler/TypeScript.js.map +1 -0
- package/DI/Container.d.ts +73 -0
- package/DI/Container.d.ts.map +1 -0
- package/DI/Container.js +143 -0
- package/DI/Container.js.map +1 -0
- package/DI/Inject.d.ts +11 -0
- package/DI/Inject.d.ts.map +1 -0
- package/DI/Inject.js +18 -0
- package/DI/Inject.js.map +1 -0
- package/Decorators/EnumerableDecorator.d.ts +6 -0
- package/Decorators/EnumerableDecorator.d.ts.map +1 -0
- package/Decorators/EnumerableDecorator.js +18 -0
- package/Decorators/EnumerableDecorator.js.map +1 -0
- package/Events/AsyncEventEmitter.d.ts +8 -0
- package/Events/AsyncEventEmitter.d.ts.map +1 -0
- package/Events/AsyncEventEmitter.js +37 -0
- package/Events/AsyncEventEmitter.js.map +1 -0
- package/IO/CustomElementManifest.d.ts +254 -0
- package/IO/CustomElementManifest.d.ts.map +1 -0
- package/IO/CustomElementManifest.js +56 -0
- package/IO/CustomElementManifest.js.map +1 -0
- package/IO/Directory.d.ts +78 -0
- package/IO/Directory.d.ts.map +1 -0
- package/IO/Directory.js +184 -0
- package/IO/Directory.js.map +1 -0
- package/IO/Encoding.d.ts +2 -0
- package/IO/Encoding.d.ts.map +1 -0
- package/IO/Encoding.js +3 -0
- package/IO/Encoding.js.map +1 -0
- package/IO/File.d.ts +148 -0
- package/IO/File.d.ts.map +1 -0
- package/IO/File.js +314 -0
- package/IO/File.js.map +1 -0
- package/IO/FileSystemInfo.d.ts +46 -0
- package/IO/FileSystemInfo.d.ts.map +1 -0
- package/IO/FileSystemInfo.js +129 -0
- package/IO/FileSystemInfo.js.map +1 -0
- package/IO/FileSystemWatcher.d.ts +49 -0
- package/IO/FileSystemWatcher.d.ts.map +1 -0
- package/IO/FileSystemWatcher.js +93 -0
- package/IO/FileSystemWatcher.js.map +1 -0
- package/IO/Glob.d.ts +35 -0
- package/IO/Glob.d.ts.map +1 -0
- package/IO/Glob.js +152 -0
- package/IO/Glob.js.map +1 -0
- package/IO/Json.d.ts +84 -0
- package/IO/Json.d.ts.map +1 -0
- package/IO/Json.js +114 -0
- package/IO/Json.js.map +1 -0
- package/IO/Path.d.ts +125 -0
- package/IO/Path.d.ts.map +1 -0
- package/IO/Path.js +283 -0
- package/IO/Path.js.map +1 -0
- package/IO/PcfControlManifest.d.ts +79 -0
- package/IO/PcfControlManifest.d.ts.map +1 -0
- package/IO/PcfControlManifest.js +93 -0
- package/IO/PcfControlManifest.js.map +1 -0
- package/IO/Reader/Interfaces/IFileReader.d.ts +30 -0
- package/IO/Reader/Interfaces/IFileReader.d.ts.map +1 -0
- package/IO/Reader/Interfaces/IFileReader.js +3 -0
- package/IO/Reader/Interfaces/IFileReader.js.map +1 -0
- package/IO/Reader/TextFileReader.d.ts +53 -0
- package/IO/Reader/TextFileReader.d.ts.map +1 -0
- package/IO/Reader/TextFileReader.js +167 -0
- package/IO/Reader/TextFileReader.js.map +1 -0
- package/IO/Resx.d.ts +49 -0
- package/IO/Resx.d.ts.map +1 -0
- package/IO/Resx.js +95 -0
- package/IO/Resx.js.map +1 -0
- package/IO/SymbolikLink.d.ts +6 -0
- package/IO/SymbolikLink.d.ts.map +1 -0
- package/IO/SymbolikLink.js +10 -0
- package/IO/SymbolikLink.js.map +1 -0
- package/IO/Template.d.ts +41 -0
- package/IO/Template.d.ts.map +1 -0
- package/IO/Template.js +71 -0
- package/IO/Template.js.map +1 -0
- package/IO/TemporaryDirectory.d.ts +28 -0
- package/IO/TemporaryDirectory.d.ts.map +1 -0
- package/IO/TemporaryDirectory.js +76 -0
- package/IO/TemporaryDirectory.js.map +1 -0
- package/IO/TemporaryFile.d.ts +28 -0
- package/IO/TemporaryFile.d.ts.map +1 -0
- package/IO/TemporaryFile.js +77 -0
- package/IO/TemporaryFile.js.map +1 -0
- package/IO/Writer/Interfaces/IFileWriter.d.ts +31 -0
- package/IO/Writer/Interfaces/IFileWriter.d.ts.map +1 -0
- package/IO/Writer/Interfaces/IFileWriter.js +4 -0
- package/IO/Writer/Interfaces/IFileWriter.js.map +1 -0
- package/IO/Writer/TextFileWriter.d.ts +56 -0
- package/IO/Writer/TextFileWriter.d.ts.map +1 -0
- package/IO/Writer/TextFileWriter.js +129 -0
- package/IO/Writer/TextFileWriter.js.map +1 -0
- package/IO/vNext/FileCache.d.ts +46 -0
- package/IO/vNext/FileCache.d.ts.map +1 -0
- package/IO/vNext/FileCache.js +94 -0
- package/IO/vNext/FileCache.js.map +1 -0
- package/IO/vNext/FileSystem.d.ts +107 -0
- package/IO/vNext/FileSystem.d.ts.map +1 -0
- package/IO/vNext/FileSystem.js +148 -0
- package/IO/vNext/FileSystem.js.map +1 -0
- package/IO/vNext/Interfaces/IFileCache.d.ts +56 -0
- package/IO/vNext/Interfaces/IFileCache.d.ts.map +1 -0
- package/IO/vNext/Interfaces/IFileCache.js +3 -0
- package/IO/vNext/Interfaces/IFileCache.js.map +1 -0
- package/IO/vNext/Interfaces/IFileSystem.d.ts +102 -0
- package/IO/vNext/Interfaces/IFileSystem.d.ts.map +1 -0
- package/IO/vNext/Interfaces/IFileSystem.js +4 -0
- package/IO/vNext/Interfaces/IFileSystem.js.map +1 -0
- package/Index.d.ts +62 -0
- package/Index.d.ts.map +1 -0
- package/Index.js +132 -0
- package/Index.js.map +1 -0
- package/Intl/Languages.d.ts +12 -0
- package/Intl/Languages.d.ts.map +1 -0
- package/Intl/Languages.js +865 -0
- package/Intl/Languages.js.map +1 -0
- package/LICENSE +21 -0
- package/Logging/Appenders/Abstracts/Appender.d.ts +21 -0
- package/Logging/Appenders/Abstracts/Appender.d.ts.map +1 -0
- package/Logging/Appenders/Abstracts/Appender.js +78 -0
- package/Logging/Appenders/Abstracts/Appender.js.map +1 -0
- package/Logging/Appenders/Interfaces/IAppender.d.ts +13 -0
- package/Logging/Appenders/Interfaces/IAppender.d.ts.map +1 -0
- package/Logging/Appenders/Interfaces/IAppender.js +4 -0
- package/Logging/Appenders/Interfaces/IAppender.js.map +1 -0
- package/Logging/Appenders/Interfaces/IAppenderConfig.d.ts +9 -0
- package/Logging/Appenders/Interfaces/IAppenderConfig.d.ts.map +1 -0
- package/Logging/Appenders/Interfaces/IAppenderConfig.js +3 -0
- package/Logging/Appenders/Interfaces/IAppenderConfig.js.map +1 -0
- package/Logging/Appenders/LogLevelAppender.d.ts +29 -0
- package/Logging/Appenders/LogLevelAppender.d.ts.map +1 -0
- package/Logging/Appenders/LogLevelAppender.js +102 -0
- package/Logging/Appenders/LogLevelAppender.js.map +1 -0
- package/Logging/Appenders/MessageAppender.d.ts +26 -0
- package/Logging/Appenders/MessageAppender.d.ts.map +1 -0
- package/Logging/Appenders/MessageAppender.js +91 -0
- package/Logging/Appenders/MessageAppender.js.map +1 -0
- package/Logging/Appenders/Styles/AppenderTerminalColors.d.ts +20 -0
- package/Logging/Appenders/Styles/AppenderTerminalColors.d.ts.map +1 -0
- package/Logging/Appenders/Styles/AppenderTerminalColors.js +4 -0
- package/Logging/Appenders/Styles/AppenderTerminalColors.js.map +1 -0
- package/Logging/Appenders/Styles/LogLevelAppenderStyle.d.ts +5 -0
- package/Logging/Appenders/Styles/LogLevelAppenderStyle.d.ts.map +1 -0
- package/Logging/Appenders/Styles/LogLevelAppenderStyle.js +3 -0
- package/Logging/Appenders/Styles/LogLevelAppenderStyle.js.map +1 -0
- package/Logging/Appenders/TagAppender.d.ts +25 -0
- package/Logging/Appenders/TagAppender.d.ts.map +1 -0
- package/Logging/Appenders/TagAppender.js +49 -0
- package/Logging/Appenders/TagAppender.js.map +1 -0
- package/Logging/Appenders/TimeStampAppender.d.ts +22 -0
- package/Logging/Appenders/TimeStampAppender.d.ts.map +1 -0
- package/Logging/Appenders/TimeStampAppender.js +44 -0
- package/Logging/Appenders/TimeStampAppender.js.map +1 -0
- package/Logging/Interfaces/ILogEntry.d.ts +13 -0
- package/Logging/Interfaces/ILogEntry.d.ts.map +1 -0
- package/Logging/Interfaces/ILogEntry.js +4 -0
- package/Logging/Interfaces/ILogEntry.js.map +1 -0
- package/Logging/Interfaces/ILogOptions.d.ts +17 -0
- package/Logging/Interfaces/ILogOptions.d.ts.map +1 -0
- package/Logging/Interfaces/ILogOptions.js +4 -0
- package/Logging/Interfaces/ILogOptions.js.map +1 -0
- package/Logging/Interfaces/ILoggerScope.d.ts +7 -0
- package/Logging/Interfaces/ILoggerScope.d.ts.map +1 -0
- package/Logging/Interfaces/ILoggerScope.js +3 -0
- package/Logging/Interfaces/ILoggerScope.js.map +1 -0
- package/Logging/Interfaces/ILoggerScopeConfig.d.ts +9 -0
- package/Logging/Interfaces/ILoggerScopeConfig.d.ts.map +1 -0
- package/Logging/Interfaces/ILoggerScopeConfig.js +4 -0
- package/Logging/Interfaces/ILoggerScopeConfig.js.map +1 -0
- package/Logging/LogLevel.d.ts +5 -0
- package/Logging/LogLevel.d.ts.map +1 -0
- package/Logging/LogLevel.js +3 -0
- package/Logging/LogLevel.js.map +1 -0
- package/Logging/Logger.d.ts +148 -0
- package/Logging/Logger.d.ts.map +1 -0
- package/Logging/Logger.js +326 -0
- package/Logging/Logger.js.map +1 -0
- package/Logging/LoggerConfig.d.ts +45 -0
- package/Logging/LoggerConfig.d.ts.map +1 -0
- package/Logging/LoggerConfig.js +83 -0
- package/Logging/LoggerConfig.js.map +1 -0
- package/Logging/LoggerScope.d.ts +16 -0
- package/Logging/LoggerScope.d.ts.map +1 -0
- package/Logging/LoggerScope.js +81 -0
- package/Logging/LoggerScope.js.map +1 -0
- package/Logging/LoggerSuppressor.d.ts +10 -0
- package/Logging/LoggerSuppressor.d.ts.map +1 -0
- package/Logging/LoggerSuppressor.js +43 -0
- package/Logging/LoggerSuppressor.js.map +1 -0
- package/Logging/LoggerUtils.d.ts +47 -0
- package/Logging/LoggerUtils.d.ts.map +1 -0
- package/Logging/LoggerUtils.js +102 -0
- package/Logging/LoggerUtils.js.map +1 -0
- package/Logging/vNext/ConsoleLogger.d.ts +56 -0
- package/Logging/vNext/ConsoleLogger.d.ts.map +1 -0
- package/Logging/vNext/ConsoleLogger.js +76 -0
- package/Logging/vNext/ConsoleLogger.js.map +1 -0
- package/Logging/vNext/Interfaces/ILogger.d.ts +38 -0
- package/Logging/vNext/Interfaces/ILogger.d.ts.map +1 -0
- package/Logging/vNext/Interfaces/ILogger.js +3 -0
- package/Logging/vNext/Interfaces/ILogger.js.map +1 -0
- package/Logging/vNext/LoggerExtensions.d.ts +79 -0
- package/Logging/vNext/LoggerExtensions.d.ts.map +1 -0
- package/Logging/vNext/LoggerExtensions.js +175 -0
- package/Logging/vNext/LoggerExtensions.js.map +1 -0
- package/Logging/vNext/Styles/Style.d.ts +9 -0
- package/Logging/vNext/Styles/Style.d.ts.map +1 -0
- package/Logging/vNext/Styles/Style.js +17 -0
- package/Logging/vNext/Styles/Style.js.map +1 -0
- package/Logging/vNext/Styles/StyleDirectives.d.ts +61 -0
- package/Logging/vNext/Styles/StyleDirectives.d.ts.map +1 -0
- package/Logging/vNext/Styles/StyleDirectives.js +118 -0
- package/Logging/vNext/Styles/StyleDirectives.js.map +1 -0
- package/System/Args.d.ts +20 -0
- package/System/Args.d.ts.map +1 -0
- package/System/Args.js +45 -0
- package/System/Args.js.map +1 -0
- package/System/Array.d.ts +41 -0
- package/System/Array.d.ts.map +1 -0
- package/System/Array.js +91 -0
- package/System/Array.js.map +1 -0
- package/System/Assign.d.ts +12 -0
- package/System/Assign.d.ts.map +1 -0
- package/System/Assign.js +40 -0
- package/System/Assign.js.map +1 -0
- package/System/Boolean.d.ts +20 -0
- package/System/Boolean.d.ts.map +1 -0
- package/System/Boolean.js +52 -0
- package/System/Boolean.js.map +1 -0
- package/System/Error.d.ts +9 -0
- package/System/Error.d.ts.map +1 -0
- package/System/Error.js +20 -0
- package/System/Error.js.map +1 -0
- package/System/Errors.d.ts +7 -0
- package/System/Errors.d.ts.map +1 -0
- package/System/Errors.js +18 -0
- package/System/Errors.js.map +1 -0
- package/System/Formatter.d.ts +4 -0
- package/System/Formatter.d.ts.map +1 -0
- package/System/Formatter.js +17 -0
- package/System/Formatter.js.map +1 -0
- package/System/Guard.d.ts +5 -0
- package/System/Guard.d.ts.map +1 -0
- package/System/Guard.js +29 -0
- package/System/Guard.js.map +1 -0
- package/System/Interfaces/IType.d.ts +7 -0
- package/System/Interfaces/IType.d.ts.map +1 -0
- package/System/Interfaces/IType.js +3 -0
- package/System/Interfaces/IType.js.map +1 -0
- package/System/Interfaces/IUnknown.d.ts +7 -0
- package/System/Interfaces/IUnknown.d.ts.map +1 -0
- package/System/Interfaces/IUnknown.js +3 -0
- package/System/Interfaces/IUnknown.js.map +1 -0
- package/System/List.d.ts +27 -0
- package/System/List.d.ts.map +1 -0
- package/System/List.js +84 -0
- package/System/List.js.map +1 -0
- package/System/Number.d.ts +10 -0
- package/System/Number.d.ts.map +1 -0
- package/System/Number.js +28 -0
- package/System/Number.js.map +1 -0
- package/System/Process.d.ts +30 -0
- package/System/Process.d.ts.map +1 -0
- package/System/Process.js +167 -0
- package/System/Process.js.map +1 -0
- package/System/Require.d.ts +8 -0
- package/System/Require.d.ts.map +1 -0
- package/System/Require.js +20 -0
- package/System/Require.js.map +1 -0
- package/System/Stopwatch.d.ts +19 -0
- package/System/Stopwatch.d.ts.map +1 -0
- package/System/Stopwatch.js +73 -0
- package/System/Stopwatch.js.map +1 -0
- package/System/String.d.ts +19 -0
- package/System/String.d.ts.map +1 -0
- package/System/String.js +177 -0
- package/System/String.js.map +1 -0
- package/System/Time.d.ts +7 -0
- package/System/Time.d.ts.map +1 -0
- package/System/Time.js +16 -0
- package/System/Time.js.map +1 -0
- package/System/Version.d.ts +20 -0
- package/System/Version.d.ts.map +1 -0
- package/System/Version.js +135 -0
- package/System/Version.js.map +1 -0
- package/Terminal/Terminal.d.ts +7 -0
- package/Terminal/Terminal.d.ts.map +1 -0
- package/Terminal/Terminal.js +21 -0
- package/Terminal/Terminal.js.map +1 -0
- package/Terminal/TerminalColorType.d.ts +2 -0
- package/Terminal/TerminalColorType.d.ts.map +1 -0
- package/Terminal/TerminalColorType.js +3 -0
- package/Terminal/TerminalColorType.js.map +1 -0
- package/Terminal/TerminalColors.d.ts +38 -0
- package/Terminal/TerminalColors.d.ts.map +1 -0
- package/Terminal/TerminalColors.js +151 -0
- package/Terminal/TerminalColors.js.map +1 -0
- package/Terminal/TerminalSymbolType.d.ts +2 -0
- package/Terminal/TerminalSymbolType.d.ts.map +1 -0
- package/Terminal/TerminalSymbolType.js +3 -0
- package/Terminal/TerminalSymbolType.js.map +1 -0
- package/Terminal/TerminalSymbols.d.ts +7 -0
- package/Terminal/TerminalSymbols.d.ts.map +1 -0
- package/Terminal/TerminalSymbols.js +30 -0
- package/Terminal/TerminalSymbols.js.map +1 -0
- package/package.json +26 -0
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import type { IProgramArg } from '../Interfaces/IProgramArg';
|
|
2
|
+
import type { IProgramCommand } from '../Interfaces/IProgramCommand';
|
|
3
|
+
import type { ProgramCommandResult } from '../ProgramCommandResult';
|
|
4
|
+
/**
|
|
5
|
+
* Represents a abstract program command.
|
|
6
|
+
*
|
|
7
|
+
* @public
|
|
8
|
+
*/
|
|
9
|
+
export declare abstract class ProgramCommandBase<TConfig = Record<string, unknown>> implements IProgramCommand<TConfig> {
|
|
10
|
+
private _config;
|
|
11
|
+
/**
|
|
12
|
+
* Constructs a new instance of the `ProgramCommandBase` class.
|
|
13
|
+
*
|
|
14
|
+
* @public
|
|
15
|
+
*/
|
|
16
|
+
constructor(config: TConfig);
|
|
17
|
+
/**
|
|
18
|
+
* Gets the command name.
|
|
19
|
+
*
|
|
20
|
+
* @public
|
|
21
|
+
* @abstract
|
|
22
|
+
* @readonly
|
|
23
|
+
*/
|
|
24
|
+
abstract get name(): string;
|
|
25
|
+
/**
|
|
26
|
+
* Gets the optional arguments.
|
|
27
|
+
*
|
|
28
|
+
* @public
|
|
29
|
+
* @abstract
|
|
30
|
+
* @readonly
|
|
31
|
+
*/
|
|
32
|
+
abstract get args(): Array<IProgramArg> | undefined;
|
|
33
|
+
/**
|
|
34
|
+
* Gets the optional arguments configuration.
|
|
35
|
+
*
|
|
36
|
+
* @public
|
|
37
|
+
* @readonly
|
|
38
|
+
*/
|
|
39
|
+
get config(): TConfig;
|
|
40
|
+
/**
|
|
41
|
+
* @public
|
|
42
|
+
* @virtual
|
|
43
|
+
*/
|
|
44
|
+
abstract execute(): Promise<ProgramCommandResult>;
|
|
45
|
+
/**
|
|
46
|
+
* @public
|
|
47
|
+
*/
|
|
48
|
+
configure(config: TConfig): TConfig;
|
|
49
|
+
/**
|
|
50
|
+
* @public
|
|
51
|
+
* @virtual
|
|
52
|
+
*/
|
|
53
|
+
initalize(): Promise<void>;
|
|
54
|
+
/**
|
|
55
|
+
* @public
|
|
56
|
+
* @virtual
|
|
57
|
+
*/
|
|
58
|
+
dispose(): Promise<void>;
|
|
59
|
+
}
|
|
60
|
+
//# sourceMappingURL=ProgramCommandBase.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ProgramCommandBase.d.ts","sourceRoot":"","sources":["../../../src/Cli/Abstracts/ProgramCommandBase.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAC7D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AACrE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AAIpE;;;;GAIG;AACH,8BAAsB,kBAAkB,CAAC,OAAO,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAE,YAAW,eAAe,CAAC,OAAO,CAAC;IAI3G,OAAO,CAAC,OAAO,CAAU;IAMzB;;;;OAIG;gBACgB,MAAM,EAAE,OAAO;IAQlC;;;;;;MAME;IACF,aAAoB,IAAI,IAAI,MAAM,CAAC;IAEnC;;;;;;MAME;IACF,aAAoB,IAAI,IAAI,KAAK,CAAC,WAAW,CAAC,GAAG,SAAS,CAAC;IAE3D;;;;;MAKE;IACF,IAAW,MAAM,IAAI,OAAO,CAE3B;IAMD;;;OAGG;aACa,OAAO,IAAI,OAAO,CAAC,oBAAoB,CAAC;IAExD;;OAEG;IACI,SAAS,CAAC,MAAM,EAAE,OAAO,GAAG,OAAO;IAa1C;;;OAGG;IACU,SAAS,IAAI,OAAO,CAAC,IAAI,CAAC;IAIvC;;;OAGG;IACU,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;CAMxC"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// #region Imports
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.ProgramCommandBase = void 0;
|
|
5
|
+
const String_1 = require("../../System/String");
|
|
6
|
+
// #endregion
|
|
7
|
+
/**
|
|
8
|
+
* Represents a abstract program command.
|
|
9
|
+
*
|
|
10
|
+
* @public
|
|
11
|
+
*/
|
|
12
|
+
class ProgramCommandBase {
|
|
13
|
+
// #region Fields
|
|
14
|
+
_config;
|
|
15
|
+
// #endregion
|
|
16
|
+
// #region Ctor
|
|
17
|
+
/**
|
|
18
|
+
* Constructs a new instance of the `ProgramCommandBase` class.
|
|
19
|
+
*
|
|
20
|
+
* @public
|
|
21
|
+
*/
|
|
22
|
+
constructor(config) {
|
|
23
|
+
this._config = config;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Gets the optional arguments configuration.
|
|
27
|
+
*
|
|
28
|
+
* @public
|
|
29
|
+
* @readonly
|
|
30
|
+
*/
|
|
31
|
+
get config() {
|
|
32
|
+
return this._config;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* @public
|
|
36
|
+
*/
|
|
37
|
+
configure(config) {
|
|
38
|
+
if (config) {
|
|
39
|
+
Object.keys(config).forEach((key) => {
|
|
40
|
+
if (this._config) {
|
|
41
|
+
// @ts-ignore fix suppressImplicitAnyIndexErrors
|
|
42
|
+
this._config[String_1.StringExtensions.firstCharToLowerCase(key)] = config[key];
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
return this._config;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* @public
|
|
50
|
+
* @virtual
|
|
51
|
+
*/
|
|
52
|
+
async initalize() {
|
|
53
|
+
return Promise.resolve();
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* @public
|
|
57
|
+
* @virtual
|
|
58
|
+
*/
|
|
59
|
+
async dispose() {
|
|
60
|
+
return Promise.resolve();
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
exports.ProgramCommandBase = ProgramCommandBase;
|
|
64
|
+
//# sourceMappingURL=ProgramCommandBase.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ProgramCommandBase.js","sourceRoot":"","sources":["../../../src/Cli/Abstracts/ProgramCommandBase.ts"],"names":[],"mappings":";AAAA,kBAAkB;;;AAElB,gDAAuD;AAKvD,aAAa;AAEb;;;;GAIG;AACH,MAAsB,kBAAkB;IAEpC,iBAAiB;IAET,OAAO,CAAU;IAEzB,aAAa;IAEb,eAAe;IAEf;;;;OAIG;IACH,YAAmB,MAAe;QAC9B,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;IAC1B,CAAC;IAwBD;;;;;MAKE;IACF,IAAW,MAAM;QACb,OAAO,IAAI,CAAC,OAAO,CAAC;IACxB,CAAC;IAYD;;OAEG;IACI,SAAS,CAAC,MAAe;QAC5B,IAAI,MAAM,EAAE,CAAC;YACT,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,CAAC,GAAG,EAAE,EAAE;gBAChC,IAAI,IAAI,CAAC,OAAO,EAAE,CAAC;oBACf,gDAAgD;oBAChD,IAAI,CAAC,OAAO,CAAC,yBAAgB,CAAC,oBAAoB,CAAC,GAAG,CAAC,CAAC,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC;gBAC3E,CAAC;YACL,CAAC,CAAC,CAAC;QACP,CAAC;QAED,OAAO,IAAI,CAAC,OAAO,CAAC;IACxB,CAAC;IAED;;;OAGG;IACI,KAAK,CAAC,SAAS;QAClB,OAAO,OAAO,CAAC,OAAO,EAAE,CAAC;IAC7B,CAAC;IAED;;;OAGG;IACI,KAAK,CAAC,OAAO;QAChB,OAAO,OAAO,CAAC,OAAO,EAAE,CAAC;IAC7B,CAAC;CAIJ;AA/FD,gDA+FC"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { IProgramInit } from '../Interfaces/IProgramInit';
|
|
2
|
+
import type { IType } from '../../System/Interfaces/IType';
|
|
3
|
+
import type { IProgramCommand } from '../Interfaces/IProgramCommand';
|
|
4
|
+
import type { IProgramArg } from '../Interfaces/IProgramArg';
|
|
5
|
+
import { Program } from '../Program';
|
|
6
|
+
/**
|
|
7
|
+
* A generic program builder.
|
|
8
|
+
*/
|
|
9
|
+
export declare class ProgramBuilder<TConfig extends Record<string, unknown> = Record<string, unknown>> {
|
|
10
|
+
private _init;
|
|
11
|
+
private _config;
|
|
12
|
+
private readonly _programmCommands;
|
|
13
|
+
private readonly _programmArgs;
|
|
14
|
+
private readonly _commandBuilder;
|
|
15
|
+
/**
|
|
16
|
+
* Constructs a new instance of the `ProgramBuilder` class.
|
|
17
|
+
*
|
|
18
|
+
* @public
|
|
19
|
+
*/
|
|
20
|
+
constructor();
|
|
21
|
+
init(init: IProgramInit): this;
|
|
22
|
+
/**
|
|
23
|
+
* Sets the default configuration.
|
|
24
|
+
*/
|
|
25
|
+
config(config: TConfig): this;
|
|
26
|
+
/**
|
|
27
|
+
* Registers a argument.
|
|
28
|
+
*/
|
|
29
|
+
args(...args: Array<IProgramArg>): this;
|
|
30
|
+
/**
|
|
31
|
+
* Registers a command.
|
|
32
|
+
*/
|
|
33
|
+
command<TCommand extends IType<IProgramCommand>>(name: string, type: TCommand, factory?: () => ConstructorParameters<TCommand>): this;
|
|
34
|
+
/**
|
|
35
|
+
* Builds and initializes the program.
|
|
36
|
+
*/
|
|
37
|
+
build(): Program;
|
|
38
|
+
}
|
|
39
|
+
//# sourceMappingURL=ProgramBuilder.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ProgramBuilder.d.ts","sourceRoot":"","sources":["../../../src/Cli/Builders/ProgramBuilder.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAG/D,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,+BAA+B,CAAC;AAC3D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AACrE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAC7D,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAIrC;;GAEG;AACH,qBAAa,cAAc,CAAC,OAAO,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAIzF,OAAO,CAAC,KAAK,CAAe;IAC5B,OAAO,CAAC,OAAO,CAAU;IACzB,OAAO,CAAC,QAAQ,CAAC,iBAAiB,CAAmB;IACrD,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAe;IAC7C,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAiC;IAMjE;;;;OAIG;;IAWI,IAAI,CAAC,IAAI,EAAE,YAAY,GAAG,IAAI;IAKrC;;OAEG;IACI,MAAM,CAAC,MAAM,EAAE,OAAO,GAAG,IAAI;IAKpC;;OAEG;IACI,IAAI,CAAC,GAAG,IAAI,EAAE,KAAK,CAAC,WAAW,CAAC,GAAG,IAAI;IAK9C;;OAEG;IACI,OAAO,CAAC,QAAQ,SAAS,KAAK,CAAC,eAAe,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,CAAC,EAAE,MAAM,qBAAqB,CAAC,QAAQ,CAAC,GAAG,IAAI;IAK5I;;OAEG;IACI,KAAK,IAAI,OAAO;CAI1B"}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// #region Imports
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.ProgramBuilder = void 0;
|
|
5
|
+
const ProgramCommandBuilder_1 = require("./ProgramCommandBuilder");
|
|
6
|
+
const ProgramCommands_1 = require("../ProgramCommands");
|
|
7
|
+
const ProgramArgs_1 = require("../ProgramArgs");
|
|
8
|
+
const Program_1 = require("../Program");
|
|
9
|
+
// #endregion
|
|
10
|
+
/**
|
|
11
|
+
* A generic program builder.
|
|
12
|
+
*/
|
|
13
|
+
class ProgramBuilder {
|
|
14
|
+
// #region Fields
|
|
15
|
+
_init;
|
|
16
|
+
_config;
|
|
17
|
+
_programmCommands;
|
|
18
|
+
_programmArgs;
|
|
19
|
+
_commandBuilder;
|
|
20
|
+
// #endregion
|
|
21
|
+
// #region Ctor
|
|
22
|
+
/**
|
|
23
|
+
* Constructs a new instance of the `ProgramBuilder` class.
|
|
24
|
+
*
|
|
25
|
+
* @public
|
|
26
|
+
*/
|
|
27
|
+
constructor() {
|
|
28
|
+
this._init = {};
|
|
29
|
+
this._programmCommands = new ProgramCommands_1.ProgramCommands();
|
|
30
|
+
this._programmArgs = new ProgramArgs_1.ProgramArgs();
|
|
31
|
+
this._config = {};
|
|
32
|
+
this._commandBuilder = new ProgramCommandBuilder_1.ProgramCommandBuilder();
|
|
33
|
+
}
|
|
34
|
+
// #endregion
|
|
35
|
+
init(init) {
|
|
36
|
+
this._init = init;
|
|
37
|
+
return this;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Sets the default configuration.
|
|
41
|
+
*/
|
|
42
|
+
config(config) {
|
|
43
|
+
this._config = config;
|
|
44
|
+
return this;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Registers a argument.
|
|
48
|
+
*/
|
|
49
|
+
args(...args) {
|
|
50
|
+
this._programmArgs.register(...args);
|
|
51
|
+
return this;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Registers a command.
|
|
55
|
+
*/
|
|
56
|
+
command(name, type, factory) {
|
|
57
|
+
this._programmCommands.register(name, type, factory);
|
|
58
|
+
return this;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Builds and initializes the program.
|
|
62
|
+
*/
|
|
63
|
+
build() {
|
|
64
|
+
return new PseudoProgram(this._init, this._programmCommands, this._programmArgs);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
exports.ProgramBuilder = ProgramBuilder;
|
|
68
|
+
class PseudoProgram extends Program_1.Program {
|
|
69
|
+
constructor(init, commands, args) {
|
|
70
|
+
super(init, commands, args);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
//# sourceMappingURL=ProgramBuilder.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ProgramBuilder.js","sourceRoot":"","sources":["../../../src/Cli/Builders/ProgramBuilder.ts"],"names":[],"mappings":";AAAA,kBAAkB;;;AAElB,mEAAgE;AAChE,wDAAqD;AACrD,gDAA6C;AAO7C,wCAAqC;AAErC,aAAa;AAEb;;GAEG;AACH,MAAa,cAAc;IAEvB,iBAAiB;IAET,KAAK,CAAe;IACpB,OAAO,CAAU;IACR,iBAAiB,CAAmB;IACpC,aAAa,CAAe;IAC5B,eAAe,CAAiC;IAEjE,aAAa;IAEb,eAAe;IAEf;;;;OAIG;IACH;QACI,IAAI,CAAC,KAAK,GAAG,EAA6B,CAAC;QAC3C,IAAI,CAAC,iBAAiB,GAAG,IAAI,iCAAe,EAAE,CAAC;QAC/C,IAAI,CAAC,aAAa,GAAG,IAAI,yBAAW,EAAE,CAAC;QACvC,IAAI,CAAC,OAAO,GAAG,EAAwB,CAAC;QACxC,IAAI,CAAC,eAAe,GAAG,IAAI,6CAAqB,EAAE,CAAC;IACvD,CAAC;IAED,aAAa;IAEN,IAAI,CAAC,IAAkB;QAC1B,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;QAClB,OAAO,IAAI,CAAC;IAChB,CAAC;IAED;;OAEG;IACI,MAAM,CAAC,MAAe;QACzB,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;QACtB,OAAO,IAAI,CAAC;IAChB,CAAC;IAED;;OAEG;IACI,IAAI,CAAC,GAAG,IAAwB;QACnC,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,GAAG,IAAI,CAAC,CAAC;QACrC,OAAO,IAAI,CAAC;IAChB,CAAC;IAED;;OAEG;IACI,OAAO,CAA0C,IAAY,EAAE,IAAc,EAAE,OAA+C;QACjI,IAAI,CAAC,iBAAiB,CAAC,QAAQ,CAAC,IAAI,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC;QACrD,OAAO,IAAI,CAAC;IAChB,CAAC;IAED;;OAEG;IACI,KAAK;QACR,OAAO,IAAI,aAAa,CAAU,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,iBAAiB,EAAE,IAAI,CAAC,aAAa,CAAC,CAAC;IAC9F,CAAC;CAEJ;AAjED,wCAiEC;AAED,MAAM,aAAuD,SAAQ,iBAAgB;IAEjF,YAAmB,IAAkB,EAAE,QAA0B,EAAE,IAAkB;QACjF,KAAK,CAAC,IAAI,EAAE,QAAQ,EAAE,IAAI,CAAC,CAAC;IAChC,CAAC;CAEJ"}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import type { IProgramCommand } from '../Interfaces/IProgramCommand.js';
|
|
2
|
+
import type { ProgramCommandResult } from '../ProgramCommandResult.js';
|
|
3
|
+
import type { IProgramArg } from '../Interfaces/IProgramArg.js';
|
|
4
|
+
/**
|
|
5
|
+
* Provides a builder for constructing program commands.
|
|
6
|
+
*
|
|
7
|
+
* @public
|
|
8
|
+
*/
|
|
9
|
+
export declare class ProgramCommandBuilder<TConfig = Record<string, string>> {
|
|
10
|
+
private _name;
|
|
11
|
+
private _args;
|
|
12
|
+
private _config;
|
|
13
|
+
private _execute;
|
|
14
|
+
private _initialize;
|
|
15
|
+
private _dispose;
|
|
16
|
+
/**
|
|
17
|
+
* Constructs a new instance of the `ProgramCommandBuilder` class.
|
|
18
|
+
*
|
|
19
|
+
* @public
|
|
20
|
+
*/
|
|
21
|
+
constructor();
|
|
22
|
+
/**
|
|
23
|
+
* Sets the name of the command.
|
|
24
|
+
*
|
|
25
|
+
* @public
|
|
26
|
+
* @param name - The command name.
|
|
27
|
+
* @returns The builder instance.
|
|
28
|
+
*/
|
|
29
|
+
name(name: string): this;
|
|
30
|
+
/**
|
|
31
|
+
* Sets the arguments of the command.
|
|
32
|
+
*
|
|
33
|
+
* @public
|
|
34
|
+
* @param args - The arguments for the command.
|
|
35
|
+
* @returns The builder instance.
|
|
36
|
+
*/
|
|
37
|
+
args(args: Array<IProgramArg>): this;
|
|
38
|
+
/**
|
|
39
|
+
* Sets the configuration for the command.
|
|
40
|
+
*
|
|
41
|
+
* @public
|
|
42
|
+
* @param config - The configuration object.
|
|
43
|
+
* @returns The builder instance.
|
|
44
|
+
*/
|
|
45
|
+
config(config: TConfig): this;
|
|
46
|
+
/**
|
|
47
|
+
* Sets the execution logic for the command.
|
|
48
|
+
*
|
|
49
|
+
* @public
|
|
50
|
+
* @param execute - A function to execute the command.
|
|
51
|
+
* @returns The builder instance.
|
|
52
|
+
*/
|
|
53
|
+
execute(execute: () => Promise<ProgramCommandResult>): this;
|
|
54
|
+
/**
|
|
55
|
+
* Sets the initialization logic for the command.
|
|
56
|
+
*
|
|
57
|
+
* @public
|
|
58
|
+
* @param initialize - A function to initialize the command.
|
|
59
|
+
* @returns The builder instance.
|
|
60
|
+
*/
|
|
61
|
+
initialize(initialize: () => Promise<void>): this;
|
|
62
|
+
/**
|
|
63
|
+
* Sets the disposal logic for the command.
|
|
64
|
+
*
|
|
65
|
+
* @public
|
|
66
|
+
* @param dispose - A function to dispose the command.
|
|
67
|
+
* @returns The builder instance.
|
|
68
|
+
*/
|
|
69
|
+
dispose(dispose: () => Promise<void>): this;
|
|
70
|
+
/**
|
|
71
|
+
* Builds the command instance.
|
|
72
|
+
*
|
|
73
|
+
* @public
|
|
74
|
+
* @returns The constructed command.
|
|
75
|
+
*/
|
|
76
|
+
build(): IProgramCommand<TConfig>;
|
|
77
|
+
}
|
|
78
|
+
//# sourceMappingURL=ProgramCommandBuilder.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ProgramCommandBuilder.d.ts","sourceRoot":"","sources":["../../../src/Cli/Builders/ProgramCommandBuilder.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAC;AACxE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AACvE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAIhE;;;;GAIG;AACH,qBAAa,qBAAqB,CAAC,OAAO,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC;IAI/D,OAAO,CAAC,KAAK,CAAS;IACtB,OAAO,CAAC,KAAK,CAA0B;IACvC,OAAO,CAAC,OAAO,CAAqC;IACpD,OAAO,CAAC,QAAQ,CAAsD;IACtE,OAAO,CAAC,WAAW,CAAsC;IACzD,OAAO,CAAC,QAAQ,CAAsC;IAMtD;;;;OAIG;;IAcH;;;;;;OAMG;IACI,IAAI,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI;IAK/B;;;;;;OAMG;IACI,IAAI,CAAC,IAAI,EAAE,KAAK,CAAC,WAAW,CAAC,GAAG,IAAI;IAK3C;;;;;;OAMG;IACI,MAAM,CAAC,MAAM,EAAE,OAAO,GAAG,IAAI;IAKpC;;;;;;OAMG;IACI,OAAO,CAAC,OAAO,EAAE,MAAM,OAAO,CAAC,oBAAoB,CAAC,GAAG,IAAI;IAKlE;;;;;;OAMG;IACI,UAAU,CAAC,UAAU,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI;IAKxD;;;;;;OAMG;IACI,OAAO,CAAC,OAAO,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI;IAKlD;;;;;OAKG;IACI,KAAK,IAAI,eAAe,CAAC,OAAO,CAAC;CAuC3C"}
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/* eslint-disable @typescript-eslint/ban-ts-comment */
|
|
3
|
+
/* eslint-disable @typescript-eslint/no-this-alias */
|
|
4
|
+
// #region Imports
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.ProgramCommandBuilder = void 0;
|
|
7
|
+
// #endregion
|
|
8
|
+
/**
|
|
9
|
+
* Provides a builder for constructing program commands.
|
|
10
|
+
*
|
|
11
|
+
* @public
|
|
12
|
+
*/
|
|
13
|
+
class ProgramCommandBuilder {
|
|
14
|
+
// #region Fields
|
|
15
|
+
_name;
|
|
16
|
+
_args = [];
|
|
17
|
+
_config = {};
|
|
18
|
+
_execute = null;
|
|
19
|
+
_initialize = null;
|
|
20
|
+
_dispose = null;
|
|
21
|
+
// #endregion
|
|
22
|
+
// #region Ctor
|
|
23
|
+
/**
|
|
24
|
+
* Constructs a new instance of the `ProgramCommandBuilder` class.
|
|
25
|
+
*
|
|
26
|
+
* @public
|
|
27
|
+
*/
|
|
28
|
+
constructor() {
|
|
29
|
+
this._name = '';
|
|
30
|
+
this._args = [];
|
|
31
|
+
this._config = {};
|
|
32
|
+
this._execute = null;
|
|
33
|
+
this._initialize = null;
|
|
34
|
+
this._dispose = null;
|
|
35
|
+
}
|
|
36
|
+
// #endregion
|
|
37
|
+
// #region Methods
|
|
38
|
+
/**
|
|
39
|
+
* Sets the name of the command.
|
|
40
|
+
*
|
|
41
|
+
* @public
|
|
42
|
+
* @param name - The command name.
|
|
43
|
+
* @returns The builder instance.
|
|
44
|
+
*/
|
|
45
|
+
name(name) {
|
|
46
|
+
this._name = name;
|
|
47
|
+
return this;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Sets the arguments of the command.
|
|
51
|
+
*
|
|
52
|
+
* @public
|
|
53
|
+
* @param args - The arguments for the command.
|
|
54
|
+
* @returns The builder instance.
|
|
55
|
+
*/
|
|
56
|
+
args(args) {
|
|
57
|
+
this._args = args;
|
|
58
|
+
return this;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Sets the configuration for the command.
|
|
62
|
+
*
|
|
63
|
+
* @public
|
|
64
|
+
* @param config - The configuration object.
|
|
65
|
+
* @returns The builder instance.
|
|
66
|
+
*/
|
|
67
|
+
config(config) {
|
|
68
|
+
this._config = config;
|
|
69
|
+
return this;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Sets the execution logic for the command.
|
|
73
|
+
*
|
|
74
|
+
* @public
|
|
75
|
+
* @param execute - A function to execute the command.
|
|
76
|
+
* @returns The builder instance.
|
|
77
|
+
*/
|
|
78
|
+
execute(execute) {
|
|
79
|
+
this._execute = execute;
|
|
80
|
+
return this;
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Sets the initialization logic for the command.
|
|
84
|
+
*
|
|
85
|
+
* @public
|
|
86
|
+
* @param initialize - A function to initialize the command.
|
|
87
|
+
* @returns The builder instance.
|
|
88
|
+
*/
|
|
89
|
+
initialize(initialize) {
|
|
90
|
+
this._initialize = initialize;
|
|
91
|
+
return this;
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Sets the disposal logic for the command.
|
|
95
|
+
*
|
|
96
|
+
* @public
|
|
97
|
+
* @param dispose - A function to dispose the command.
|
|
98
|
+
* @returns The builder instance.
|
|
99
|
+
*/
|
|
100
|
+
dispose(dispose) {
|
|
101
|
+
this._dispose = dispose;
|
|
102
|
+
return this;
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Builds the command instance.
|
|
106
|
+
*
|
|
107
|
+
* @public
|
|
108
|
+
* @returns The constructed command.
|
|
109
|
+
*/
|
|
110
|
+
build() {
|
|
111
|
+
const that = this;
|
|
112
|
+
return {
|
|
113
|
+
get name() {
|
|
114
|
+
return that._name;
|
|
115
|
+
},
|
|
116
|
+
get args() {
|
|
117
|
+
return that._args;
|
|
118
|
+
},
|
|
119
|
+
get config() {
|
|
120
|
+
return that._config;
|
|
121
|
+
},
|
|
122
|
+
configure(config) {
|
|
123
|
+
// @ts-ignore
|
|
124
|
+
Object.assign(that._config, config);
|
|
125
|
+
return that._config;
|
|
126
|
+
},
|
|
127
|
+
async initalize() {
|
|
128
|
+
if (that._initialize) {
|
|
129
|
+
await that._initialize();
|
|
130
|
+
}
|
|
131
|
+
},
|
|
132
|
+
async execute() {
|
|
133
|
+
if (!that._execute) {
|
|
134
|
+
throw new Error('Execute function not defined for the command.');
|
|
135
|
+
}
|
|
136
|
+
return that._execute();
|
|
137
|
+
},
|
|
138
|
+
async dispose() {
|
|
139
|
+
if (that._dispose) {
|
|
140
|
+
await that._dispose();
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
};
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
exports.ProgramCommandBuilder = ProgramCommandBuilder;
|
|
147
|
+
//# sourceMappingURL=ProgramCommandBuilder.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ProgramCommandBuilder.js","sourceRoot":"","sources":["../../../src/Cli/Builders/ProgramCommandBuilder.ts"],"names":[],"mappings":";AAAA,sDAAsD;AACtD,qDAAqD;AACrD,kBAAkB;;;AAMlB,aAAa;AAEb;;;;GAIG;AACH,MAAa,qBAAqB;IAE9B,iBAAiB;IAET,KAAK,CAAS;IACd,KAAK,GAAuB,EAAE,CAAC;IAC/B,OAAO,GAAY,EAAwB,CAAC;IAC5C,QAAQ,GAAiD,IAAI,CAAC;IAC9D,WAAW,GAAiC,IAAI,CAAC;IACjD,QAAQ,GAAiC,IAAI,CAAC;IAEtD,aAAa;IAEb,eAAe;IAEf;;;;OAIG;IACH;QACI,IAAI,CAAC,KAAK,GAAG,EAAE,CAAC;QAChB,IAAI,CAAC,KAAK,GAAG,EAAE,CAAC;QAChB,IAAI,CAAC,OAAO,GAAG,EAAwB,CAAC;QACxC,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC;QACrB,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC;QACxB,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC;IACzB,CAAC;IAED,aAAa;IAEb,kBAAkB;IAElB;;;;;;OAMG;IACI,IAAI,CAAC,IAAY;QACpB,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;QAClB,OAAO,IAAI,CAAC;IAChB,CAAC;IAED;;;;;;OAMG;IACI,IAAI,CAAC,IAAwB;QAChC,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;QAClB,OAAO,IAAI,CAAC;IAChB,CAAC;IAED;;;;;;OAMG;IACI,MAAM,CAAC,MAAe;QACzB,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;QACtB,OAAO,IAAI,CAAC;IAChB,CAAC;IAED;;;;;;OAMG;IACI,OAAO,CAAC,OAA4C;QACvD,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC;QACxB,OAAO,IAAI,CAAC;IAChB,CAAC;IAED;;;;;;OAMG;IACI,UAAU,CAAC,UAA+B;QAC7C,IAAI,CAAC,WAAW,GAAG,UAAU,CAAC;QAC9B,OAAO,IAAI,CAAC;IAChB,CAAC;IAED;;;;;;OAMG;IACI,OAAO,CAAC,OAA4B;QACvC,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC;QACxB,OAAO,IAAI,CAAC;IAChB,CAAC;IAED;;;;;OAKG;IACI,KAAK;QACR,MAAM,IAAI,GAAG,IAAI,CAAC;QAElB,OAAO;YACH,IAAI,IAAI;gBACJ,OAAO,IAAI,CAAC,KAAK,CAAC;YACtB,CAAC;YACD,IAAI,IAAI;gBACJ,OAAO,IAAI,CAAC,KAAK,CAAC;YACtB,CAAC;YACD,IAAI,MAAM;gBACN,OAAO,IAAI,CAAC,OAAO,CAAC;YACxB,CAAC;YACD,SAAS,CAAC,MAAe;gBACrB,aAAa;gBACb,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;gBACpC,OAAO,IAAI,CAAC,OAAO,CAAC;YACxB,CAAC;YACD,KAAK,CAAC,SAAS;gBACX,IAAI,IAAI,CAAC,WAAW,EAAE,CAAC;oBACnB,MAAM,IAAI,CAAC,WAAW,EAAE,CAAC;gBAC7B,CAAC;YACL,CAAC;YACD,KAAK,CAAC,OAAO;gBACT,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC;oBACjB,MAAM,IAAI,KAAK,CAAC,+CAA+C,CAAC,CAAC;gBACrE,CAAC;gBACD,OAAO,IAAI,CAAC,QAAQ,EAAE,CAAC;YAC3B,CAAC;YACD,KAAK,CAAC,OAAO;gBACT,IAAI,IAAI,CAAC,QAAQ,EAAE,CAAC;oBAChB,MAAM,IAAI,CAAC,QAAQ,EAAE,CAAC;gBAC1B,CAAC;YACL,CAAC;SACJ,CAAC;IACN,CAAC;CAIJ;AAtJD,sDAsJC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { IProgramArgOptions } from './IProgramArgOptions';
|
|
2
|
+
/**
|
|
3
|
+
* Represents the program argument.
|
|
4
|
+
*
|
|
5
|
+
* @public
|
|
6
|
+
*/
|
|
7
|
+
export interface IProgramArg {
|
|
8
|
+
readonly alias: string | [string, string];
|
|
9
|
+
readonly options: IProgramArgOptions;
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=IProgramArg.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IProgramArg.d.ts","sourceRoot":"","sources":["../../../src/Cli/Interfaces/IProgramArg.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAI/D;;;;GAIG;AACH,MAAM,WAAW,WAAW;IAIxB,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAE1C,QAAQ,CAAC,OAAO,EAAE,kBAAkB,CAAC;CAIxC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IProgramArg.js","sourceRoot":"","sources":["../../../src/Cli/Interfaces/IProgramArg.ts"],"names":[],"mappings":";AAAA,kBAAkB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IProgramArgOptions.d.ts","sourceRoot":"","sources":["../../../src/Cli/Interfaces/IProgramArgOptions.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAIhD;;;;GAIG;AACH,MAAM,WAAW,kBAAmB,SAAQ,eAAe;CAAI"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IProgramArgOptions.js","sourceRoot":"","sources":["../../../src/Cli/Interfaces/IProgramArgOptions.ts"],"names":[],"mappings":";AAAA,kBAAkB"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { IProgramArg } from './IProgramArg';
|
|
2
|
+
import type { IProgramArgOptions } from './IProgramArgOptions';
|
|
3
|
+
/**
|
|
4
|
+
* Represents the program arguments.
|
|
5
|
+
*
|
|
6
|
+
* @public
|
|
7
|
+
*/
|
|
8
|
+
export interface IProgramArgs {
|
|
9
|
+
/**
|
|
10
|
+
* Returns the all registered options.
|
|
11
|
+
*
|
|
12
|
+
* @public
|
|
13
|
+
* @readonly
|
|
14
|
+
*/
|
|
15
|
+
readonly options: Array<{
|
|
16
|
+
alias: string | [string, string];
|
|
17
|
+
options: IProgramArgOptions;
|
|
18
|
+
}>;
|
|
19
|
+
/**
|
|
20
|
+
* Registers a new argument.
|
|
21
|
+
*
|
|
22
|
+
* @public
|
|
23
|
+
* @param arg - The argument to register.
|
|
24
|
+
*/
|
|
25
|
+
register(...argType: Array<IProgramArg>): this;
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=IProgramArgs.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IProgramArgs.d.ts","sourceRoot":"","sources":["../../../src/Cli/Interfaces/IProgramArgs.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAI/D;;;;GAIG;AACH,MAAM,WAAW,YAAY;IAIzB;;;;;OAKG;IACH,QAAQ,CAAC,OAAO,EAAE,KAAK,CAAC;QACpB,KAAK,EAAE,MAAM,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;QACjC,OAAO,EAAE,kBAAkB,CAAC;KAC/B,CAAC,CAAC;IAMH;;;;;OAKG;IACH,QAAQ,CAAC,GAAG,OAAO,EAAE,KAAK,CAAC,WAAW,CAAC,GAAG,IAAI,CAAC;CAIlD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IProgramArgs.js","sourceRoot":"","sources":["../../../src/Cli/Interfaces/IProgramArgs.ts"],"names":[],"mappings":";AAAA,kBAAkB"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import type { ProgramCommandResult } from '../ProgramCommandResult';
|
|
2
|
+
import type { IProgramArg } from './IProgramArg';
|
|
3
|
+
/**
|
|
4
|
+
* Represents a program command.
|
|
5
|
+
*
|
|
6
|
+
* @public
|
|
7
|
+
*/
|
|
8
|
+
export interface IProgramCommand<TConfig = Record<string, unknown>> {
|
|
9
|
+
/**
|
|
10
|
+
* Gets the command name.
|
|
11
|
+
*
|
|
12
|
+
* @public
|
|
13
|
+
* @readonly
|
|
14
|
+
*/
|
|
15
|
+
readonly name: string;
|
|
16
|
+
/**
|
|
17
|
+
* Gets the optional arguments.
|
|
18
|
+
*
|
|
19
|
+
* @public
|
|
20
|
+
* @readonly
|
|
21
|
+
*/
|
|
22
|
+
readonly args?: Array<IProgramArg>;
|
|
23
|
+
/**
|
|
24
|
+
* Gets the optional arguments configuration.
|
|
25
|
+
*
|
|
26
|
+
* @public
|
|
27
|
+
* @readonly
|
|
28
|
+
*/
|
|
29
|
+
readonly config?: TConfig;
|
|
30
|
+
/**
|
|
31
|
+
* @public
|
|
32
|
+
*/
|
|
33
|
+
configure(config: TConfig): TConfig;
|
|
34
|
+
/**
|
|
35
|
+
* initalize a command.
|
|
36
|
+
*
|
|
37
|
+
* @public
|
|
38
|
+
*/
|
|
39
|
+
initalize(): Promise<void>;
|
|
40
|
+
/**
|
|
41
|
+
* execute a command.
|
|
42
|
+
*
|
|
43
|
+
* @public
|
|
44
|
+
*/
|
|
45
|
+
execute(): Promise<ProgramCommandResult>;
|
|
46
|
+
/**
|
|
47
|
+
* dispose a command.
|
|
48
|
+
*
|
|
49
|
+
* @public
|
|
50
|
+
*/
|
|
51
|
+
dispose(): Promise<void>;
|
|
52
|
+
}
|
|
53
|
+
//# sourceMappingURL=IProgramCommand.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IProgramCommand.d.ts","sourceRoot":"","sources":["../../../src/Cli/Interfaces/IProgramCommand.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AACpE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAIjD;;;;GAIG;AACH,MAAM,WAAW,eAAe,CAAC,OAAO,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAI9D;;;;;MAKE;IACF,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAEtB;;;;;MAKE;IACF,QAAQ,CAAC,IAAI,CAAC,EAAE,KAAK,CAAC,WAAW,CAAC,CAAC;IAEnC;;;;;MAKE;IACF,QAAQ,CAAC,MAAM,CAAC,EAAE,OAAO,CAAC;IAM1B;;OAEG;IACH,SAAS,CAAC,MAAM,EAAE,OAAO,GAAG,OAAO,CAAC;IAEpC;;;;OAIG;IACH,SAAS,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IAE3B;;;;OAIG;IACH,OAAO,IAAI,OAAO,CAAC,oBAAoB,CAAC,CAAC;IAEzC;;;;OAIG;IACH,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CAI5B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IProgramCommand.js","sourceRoot":"","sources":["../../../src/Cli/Interfaces/IProgramCommand.ts"],"names":[],"mappings":";AAAA,kBAAkB"}
|