From 5066310567ee057abdc2102e5aa7e86c7bbcb65e Mon Sep 17 00:00:00 2001 From: toki Date: Sat, 4 Apr 2026 13:32:48 +0900 Subject: [PATCH] Refactor: Reorganize command structure and update related files - Add command_registry.dart for centralized command registration - Move util commands to appropriate directories (build, file, infra, notification) - Update application.dart and all affected command files --- lib/oto/application.dart | 2 + lib/oto/commands/aws/awscli.dart | 4 + lib/oto/commands/build/app_data_creator.dart | 4 + lib/oto/commands/build/build_dart.dart | 4 + .../commands/build/build_dart_compile.dart | 5 + lib/oto/commands/build/build_dot_net.dart | 4 + lib/oto/commands/build/build_flutter.dart | 5 + lib/oto/commands/build/build_ios.dart | 10 ++ lib/oto/commands/build/build_msbuild.dart | 4 + lib/oto/commands/build/publish_ios.dart | 4 + lib/oto/commands/build/testflight_ios.dart | 6 + lib/oto/commands/build/xcodeproj.dart | 4 + lib/oto/commands/command.dart | 128 ++---------------- lib/oto/commands/command_registry.dart | 97 +++++++++++++ lib/oto/commands/docker/docker.dart | 4 + lib/oto/commands/file/copy.dart | 4 + lib/oto/commands/file/delete.dart | 4 + lib/oto/commands/file/directory.dart | 5 +- lib/oto/commands/file/file.dart | 7 + lib/oto/commands/file/file_diff_check.dart | 4 + lib/oto/commands/file/rename.dart | 4 + lib/oto/commands/file/zip.dart | 4 + lib/oto/commands/ftp/download.dart | 4 + lib/oto/commands/ftp/upload.dart | 4 + lib/oto/commands/git/git.dart | 14 ++ lib/oto/commands/git/git_hub.dart | 7 + lib/oto/commands/gradle/gradle.dart | 4 + lib/oto/commands/infra/smb_authorize.dart | 4 + lib/oto/commands/jenkins/jenkins.dart | 4 + lib/oto/commands/jira/jira.dart | 5 +- lib/oto/commands/notification/mattermost.dart | 5 + lib/oto/commands/notification/slack.dart | 6 + lib/oto/commands/process/process.dart | 6 + lib/oto/commands/proto/protobuf.dart | 4 + lib/oto/commands/shell/shell.dart | 5 + lib/oto/commands/util/json.dart | 6 + lib/oto/commands/util/print.dart | 4 + lib/oto/commands/util/set_value.dart | 4 + lib/oto/commands/util/string_util.dart | 8 ++ lib/oto/commands/util/timer.dart | 5 +- lib/oto/commands/web/web.dart | 5 + 41 files changed, 301 insertions(+), 120 deletions(-) create mode 100644 lib/oto/commands/command_registry.dart diff --git a/lib/oto/application.dart b/lib/oto/application.dart index 745a5de..9d01974 100644 --- a/lib/oto/application.dart +++ b/lib/oto/application.dart @@ -9,6 +9,7 @@ import 'package:dart_framework/utils/string_util.dart'; import 'package:dart_framework/utils/system_util.dart'; import 'package:oto_cli/cli/cli.dart'; import 'package:oto_cli/oto/commands/command.dart'; +import 'package:oto_cli/oto/commands/command_registry.dart'; import 'package:oto_cli/oto/core/defined_data.dart'; import 'package:oto_cli/oto/pipeline/pipeline.dart'; import 'package:oto_cli/oto/data/command_data.dart'; @@ -64,6 +65,7 @@ class Application { _buildType = buildType; _logEnable = logEnable; setUTF8(); + registerAllCommands(); DataBuild build; DataComposer? composer; diff --git a/lib/oto/commands/aws/awscli.dart b/lib/oto/commands/aws/awscli.dart index 2d6042c..ecd5ab2 100644 --- a/lib/oto/commands/aws/awscli.dart +++ b/lib/oto/commands/aws/awscli.dart @@ -22,3 +22,7 @@ class AwsCli extends Command { return await completeProcess(process, command); } } + +void registerAwsCliCommand() { + Command.register(CommandType.AwsCli, () => AwsCli()); +} diff --git a/lib/oto/commands/build/app_data_creator.dart b/lib/oto/commands/build/app_data_creator.dart index 644dc8a..4c2782b 100644 --- a/lib/oto/commands/build/app_data_creator.dart +++ b/lib/oto/commands/build/app_data_creator.dart @@ -20,3 +20,7 @@ class CreateAppData extends Command { return complete(0, command); } } + +void registerAppDataCreatorCommands() { + Command.register(CommandType.CreateAppData, () => CreateAppData()); +} diff --git a/lib/oto/commands/build/build_dart.dart b/lib/oto/commands/build/build_dart.dart index 0d69d6c..570c451 100644 --- a/lib/oto/commands/build/build_dart.dart +++ b/lib/oto/commands/build/build_dart.dart @@ -34,3 +34,7 @@ class BuildDart extends Command { return await completeProcess(process, command); } } + +void registerBuildDartCommands() { + Command.register(CommandType.BuildDart, () => BuildDart()); +} diff --git a/lib/oto/commands/build/build_dart_compile.dart b/lib/oto/commands/build/build_dart_compile.dart index 485ede3..bf59a5f 100644 --- a/lib/oto/commands/build/build_dart_compile.dart +++ b/lib/oto/commands/build/build_dart_compile.dart @@ -2,6 +2,7 @@ import 'dart:async'; import 'dart:io'; import 'package:dart_framework/utils/system_util.dart'; import 'package:oto_cli/oto/commands/build/build_dart.dart'; +import 'package:oto_cli/oto/commands/command.dart'; import 'package:oto_cli/oto/data/command_data.dart'; // ignore: depend_on_referenced_packages import 'package:path/path.dart' as path; @@ -54,3 +55,7 @@ class BuildDartCompile extends BuildDart { } } } + +void registerBuildDartCompileCommands() { + Command.register(CommandType.BuildDartCompile, () => BuildDartCompile()); +} diff --git a/lib/oto/commands/build/build_dot_net.dart b/lib/oto/commands/build/build_dot_net.dart index b3653da..eea7ed2 100644 --- a/lib/oto/commands/build/build_dot_net.dart +++ b/lib/oto/commands/build/build_dot_net.dart @@ -24,3 +24,7 @@ class BuildDotNet extends Command { return await completeProcess(process, command); } } + +void registerBuildDotNetCommands() { + Command.register(CommandType.BuildDotNet, () => BuildDotNet()); +} diff --git a/lib/oto/commands/build/build_flutter.dart b/lib/oto/commands/build/build_flutter.dart index 548244c..3d9f76c 100644 --- a/lib/oto/commands/build/build_flutter.dart +++ b/lib/oto/commands/build/build_flutter.dart @@ -2,6 +2,7 @@ import 'dart:async'; import 'package:dart_framework/utils/system_util.dart'; import 'package:oto_cli/oto/commands/build/build_dart.dart'; +import 'package:oto_cli/oto/commands/command.dart'; import 'package:oto_cli/oto/data/command_data.dart'; // ignore: constant_identifier_names @@ -22,3 +23,7 @@ class BuildFlutter extends BuildDart { return dataFutrue(shell); } } + +void registerBuildFlutterCommands() { + Command.register(CommandType.BuildFlutter, () => BuildFlutter()); +} diff --git a/lib/oto/commands/build/build_ios.dart b/lib/oto/commands/build/build_ios.dart index 90c9712..d14409b 100644 --- a/lib/oto/commands/build/build_ios.dart +++ b/lib/oto/commands/build/build_ios.dart @@ -569,3 +569,13 @@ class ExportiOS extends Command { return await completeProcess(process, command); } } + +void registerBuildIosCommands() { + Command.register(CommandType.BuildiOS, () => BuildiOS()); + Command.register(CommandType.ArchiveiOS, () => ArchiveiOS()); + Command.register(CommandType.ExportiOS, () => ExportiOS()); + Command.register(CommandType.CodeSign, () => CodeSign()); + Command.register(CommandType.CodeSignVerify, () => CodeSignVerify()); + Command.register(CommandType.ProductBuild, () => ProductBuild()); + Command.register(CommandType.Notarize, () => Notarize()); +} diff --git a/lib/oto/commands/build/build_msbuild.dart b/lib/oto/commands/build/build_msbuild.dart index b2b09ac..b3f6600 100644 --- a/lib/oto/commands/build/build_msbuild.dart +++ b/lib/oto/commands/build/build_msbuild.dart @@ -32,3 +32,7 @@ class BuildMSBuild extends Command { return await completeProcess(process, command); } } + +void registerBuildMsbuildCommands() { + Command.register(CommandType.BuildMSBuild, () => BuildMSBuild()); +} diff --git a/lib/oto/commands/build/publish_ios.dart b/lib/oto/commands/build/publish_ios.dart index f7fe2ee..dffe404 100644 --- a/lib/oto/commands/build/publish_ios.dart +++ b/lib/oto/commands/build/publish_ios.dart @@ -51,3 +51,7 @@ class PublishiOS extends Command { return complete(0, command); } } + +void registerPublishIosCommands() { + Command.register(CommandType.PublishiOS, () => PublishiOS()); +} diff --git a/lib/oto/commands/build/testflight_ios.dart b/lib/oto/commands/build/testflight_ios.dart index 0bd9158..4b21bf3 100644 --- a/lib/oto/commands/build/testflight_ios.dart +++ b/lib/oto/commands/build/testflight_ios.dart @@ -107,3 +107,9 @@ class TestflightDistribute extends Command { return await completeProcess(process, command, passExitCodes: [1]); } } + +void registerTestflightCommands() { + Command.register(CommandType.TestflightUpload, () => TestflightUpload()); + Command.register(CommandType.TestflightStatusCheck, () => TestflightStatusCheck()); + Command.register(CommandType.TestflightDistribute, () => TestflightDistribute()); +} diff --git a/lib/oto/commands/build/xcodeproj.dart b/lib/oto/commands/build/xcodeproj.dart index b7154a6..928c48b 100644 --- a/lib/oto/commands/build/xcodeproj.dart +++ b/lib/oto/commands/build/xcodeproj.dart @@ -55,3 +55,7 @@ puts "✅ {ADD_FILE_PATH} 파일이 프로젝트에 추가되고, Copy Bundle Re return await completeProcess(process, command); } } + +void registerXcodeprojCommands() { + Command.register(CommandType.XcodeprojAddFile, () => XcodeprojAddFile()); +} diff --git a/lib/oto/commands/command.dart b/lib/oto/commands/command.dart index 8aaa58b..c189f14 100644 --- a/lib/oto/commands/command.dart +++ b/lib/oto/commands/command.dart @@ -6,46 +6,8 @@ import 'package:dart_framework/platform/process.dart'; import 'package:dart_framework/utils/path.dart'; import 'package:dart_framework/utils/system_util.dart'; import 'package:oto_cli/oto/application.dart'; -import 'package:oto_cli/oto/commands/build/app_data_creator.dart'; -import 'package:oto_cli/oto/commands/build/build_dart.dart'; -import 'package:oto_cli/oto/commands/build/build_dart_compile.dart'; -import 'package:oto_cli/oto/commands/build/build_dot_net.dart'; -import 'package:oto_cli/oto/commands/build/build_flutter.dart'; -import 'package:oto_cli/oto/commands/build/build_ios.dart'; -import 'package:oto_cli/oto/commands/build/build_msbuild.dart'; -import 'package:oto_cli/oto/commands/build/testflight_ios.dart'; -import 'package:oto_cli/oto/commands/build/xcodeproj.dart'; -import 'package:oto_cli/oto/commands/file/directory.dart'; -import 'package:oto_cli/oto/commands/file/file.dart'; -import 'package:oto_cli/oto/commands/file/file_diff_check.dart'; -import 'package:oto_cli/oto/commands/ftp/download.dart'; -import 'package:oto_cli/oto/commands/git/git.dart'; -import 'package:oto_cli/oto/commands/aws/awscli.dart'; -import 'package:oto_cli/oto/commands/docker/docker.dart'; -import 'package:oto_cli/oto/commands/git/git_hub.dart'; -import 'package:oto_cli/oto/commands/gradle/gradle.dart'; -import 'package:oto_cli/oto/commands/jenkins/jenkins.dart'; -import 'package:oto_cli/oto/commands/jira/jira.dart'; -import 'package:oto_cli/oto/commands/process/process.dart'; -import 'package:oto_cli/oto/commands/proto/protobuf.dart'; -import 'package:oto_cli/oto/commands/util/json.dart'; -import 'package:oto_cli/oto/commands/notification/mattermost.dart'; -import 'package:oto_cli/oto/commands/util/print.dart'; -import 'package:oto_cli/oto/commands/util/set_value.dart'; -import 'package:oto_cli/oto/commands/infra/smb_authorize.dart'; -import 'package:oto_cli/oto/commands/util/string_util.dart'; -import 'package:oto_cli/oto/commands/util/timer.dart'; -import 'package:oto_cli/oto/commands/web/web.dart'; import 'package:oto_cli/oto/data/command_data.dart'; import 'package:oto_cli/oto/data/jenkins_data.dart'; -import 'package:oto_cli/oto/commands/file/delete.dart'; -import 'package:oto_cli/oto/commands/file/rename.dart'; -import 'package:oto_cli/oto/commands/shell/shell.dart'; -import 'package:oto_cli/oto/commands/file/copy.dart'; -import 'package:oto_cli/oto/commands/build/publish_ios.dart'; -import 'package:oto_cli/oto/commands/notification/slack.dart'; -import 'package:oto_cli/oto/commands/file/zip.dart'; -import 'package:oto_cli/oto/commands/ftp/upload.dart'; import 'package:oto_cli/oto/pipeline/pipeline_exe_handle.dart'; enum CommandType { @@ -128,87 +90,19 @@ enum CommandType { } abstract class Command { - static final Map _commandMap = { - CommandType.SimpleCommand: () => SimpleCommand(), - CommandType.Print: () => PrintCommand(), - CommandType.SetValue: () => SetValueCommand(), - CommandType.CreateAppData: () => CreateAppData(), - CommandType.BuildDart: () => BuildDart(), - CommandType.BuildFlutter: () => BuildFlutter(), - CommandType.BuildDartCompile: () => BuildDartCompile(), - CommandType.BuildDotNet: () => BuildDotNet(), - CommandType.BuildiOS: () => BuildiOS(), - CommandType.TestflightUpload: () => TestflightUpload(), - CommandType.TestflightStatusCheck: () => TestflightStatusCheck(), - CommandType.TestflightDistribute: () => TestflightDistribute(), - CommandType.XcodeprojAddFile: () => XcodeprojAddFile(), - CommandType.BuildMSBuild: () => BuildMSBuild(), - CommandType.CodeSign: () => CodeSign(), - CommandType.CodeSignVerify: () => CodeSignVerify(), - CommandType.ProductBuild: () => ProductBuild(), - CommandType.Notarize: () => Notarize(), - CommandType.ArchiveiOS: () => ArchiveiOS(), - CommandType.ExportiOS: () => ExportiOS(), - CommandType.PublishiOS: () => PublishiOS(), - CommandType.Upload: () => Upload(), - CommandType.Download: () => Download(), - CommandType.Copy: () => Copy(), - CommandType.Rename: () => Rename(), - CommandType.Delete: () => Delete(), - CommandType.FileDiffCheck: () => FileDiffCheck(), - CommandType.FileRead: () => FileRead(), - CommandType.FileWrite: () => FileWrite(), - CommandType.Files: () => Files(), - CommandType.FileInfo: () => FileInfo(), - CommandType.DirectoryCreate: () => DirectoryCreate(), - CommandType.Slack: () => Slack(), - CommandType.SlackFile: () => SlackFile(), - CommandType.SlackBuild: () => SlackBuild(), - CommandType.Mattermost: () => Mattermost(), - CommandType.MattermostBuild: () => MattermostBuild(), - CommandType.StringSub: () => StringSub(), - CommandType.StringReplace: () => StringReplace(), - CommandType.StringReplacePattern: () => StringReplacePattern(), - CommandType.StringIndex: () => StringIndex(), - CommandType.URLInfo: () => URLInfo(), - CommandType.Jira: () => Jira(), - CommandType.Zip: () => Zip(), - CommandType.Shell: () => Shell(), - CommandType.ShellFile: () => ShellFile(), - CommandType.Git: () => Git(), - CommandType.GitCommit: () => GitCommit(), - CommandType.GitPull: () => GitPull(), - CommandType.GitPush: () => GitPush(), - CommandType.GitCheckout: () => GitCheckout(), - CommandType.GitRev: () => GitRev(), - CommandType.GitCount: () => GitCount(), - CommandType.GitReset: () => GitReset(), - CommandType.GitStashPush: () => GitStashPush(), - CommandType.GitStashApply: () => GitStashApply(), - CommandType.GitBranch: () => GitBranch(), - CommandType.GitHub: () => GitHub(), - CommandType.GitHubPullRequestCreate: () => GitHubPullRequestCreate(), - CommandType.GitHubPullRequestList: () => GitHubPullRequestList(), - CommandType.GitHubPullRequestClose: () => GitHubPullRequestClose(), - CommandType.Protobuf: () => Protobuf(), - CommandType.JsonReader: () => JsonReader(), - CommandType.JsonReaderFile: () => JsonReaderFile(), - CommandType.JsonWriterFile: () => JsonWriterFile(), - CommandType.AwsCli: () => AwsCli(), - CommandType.Docker: () => Docker(), - CommandType.Gradle: () => Gradle(), - CommandType.WebRequest: () => WebRequest(), - CommandType.WebFile: () => WebFile(), - CommandType.ProcessPortUse: () => ProcessPortUse(), - CommandType.ProcessRun: () => ProcessRun(), - CommandType.ProcessKill: () => ProcessKill(), - CommandType.SMBAuth: () => SMBAuth(), - CommandType.Delay: () => Delay(), - CommandType.JenkinsParameterModify: () => JenkinsParameterModify(), - }; + static final Map _commandMap = {}; + + static void register(CommandType type, Command Function() factory) { + _commandMap[type] = factory; + } factory Command.byType(CommandType type) { - return _commandMap[type]!(); + final factory = _commandMap[type]; + if (factory == null) { + throw StateError( + 'Command "$type" is not registered. Did you call registerAllCommands()?'); + } + return factory(); } Command(); diff --git a/lib/oto/commands/command_registry.dart b/lib/oto/commands/command_registry.dart new file mode 100644 index 0000000..9ada4e2 --- /dev/null +++ b/lib/oto/commands/command_registry.dart @@ -0,0 +1,97 @@ +import 'package:oto_cli/oto/commands/aws/awscli.dart'; +import 'package:oto_cli/oto/commands/build/app_data_creator.dart'; +import 'package:oto_cli/oto/commands/build/build_dart.dart'; +import 'package:oto_cli/oto/commands/build/build_dart_compile.dart'; +import 'package:oto_cli/oto/commands/build/build_dot_net.dart'; +import 'package:oto_cli/oto/commands/build/build_flutter.dart'; +import 'package:oto_cli/oto/commands/build/build_ios.dart'; +import 'package:oto_cli/oto/commands/build/build_msbuild.dart'; +import 'package:oto_cli/oto/commands/build/publish_ios.dart'; +import 'package:oto_cli/oto/commands/build/testflight_ios.dart'; +import 'package:oto_cli/oto/commands/build/xcodeproj.dart'; +import 'package:oto_cli/oto/commands/command.dart'; +import 'package:oto_cli/oto/commands/docker/docker.dart'; +import 'package:oto_cli/oto/commands/file/copy.dart'; +import 'package:oto_cli/oto/commands/file/delete.dart'; +import 'package:oto_cli/oto/commands/file/directory.dart'; +import 'package:oto_cli/oto/commands/file/file.dart'; +import 'package:oto_cli/oto/commands/file/file_diff_check.dart'; +import 'package:oto_cli/oto/commands/file/rename.dart'; +import 'package:oto_cli/oto/commands/file/zip.dart'; +import 'package:oto_cli/oto/commands/ftp/download.dart'; +import 'package:oto_cli/oto/commands/ftp/upload.dart'; +import 'package:oto_cli/oto/commands/git/git.dart'; +import 'package:oto_cli/oto/commands/git/git_hub.dart'; +import 'package:oto_cli/oto/commands/gradle/gradle.dart'; +import 'package:oto_cli/oto/commands/infra/smb_authorize.dart'; +import 'package:oto_cli/oto/commands/jenkins/jenkins.dart'; +import 'package:oto_cli/oto/commands/jira/jira.dart'; +import 'package:oto_cli/oto/commands/notification/mattermost.dart'; +import 'package:oto_cli/oto/commands/notification/slack.dart'; +import 'package:oto_cli/oto/commands/process/process.dart'; +import 'package:oto_cli/oto/commands/proto/protobuf.dart'; +import 'package:oto_cli/oto/commands/shell/shell.dart'; +import 'package:oto_cli/oto/commands/util/json.dart'; +import 'package:oto_cli/oto/commands/util/print.dart'; +import 'package:oto_cli/oto/commands/util/set_value.dart'; +import 'package:oto_cli/oto/commands/util/string_util.dart'; +import 'package:oto_cli/oto/commands/util/timer.dart'; +import 'package:oto_cli/oto/commands/web/web.dart'; + +void registerAllCommands() { + Command.register(CommandType.SimpleCommand, () => SimpleCommand()); + + // build + registerBuildIosCommands(); + registerTestflightCommands(); + registerXcodeprojCommands(); + registerAppDataCreatorCommands(); + registerBuildDartCommands(); + registerBuildDartCompileCommands(); + registerBuildDotNetCommands(); + registerBuildFlutterCommands(); + registerBuildMsbuildCommands(); + registerPublishIosCommands(); + + // git + registerGitCommands(); + registerGitHubCommands(); + + // notification + registerSlackCommands(); + registerMattermostCommands(); + + // file + registerCopyCommand(); + registerDeleteCommand(); + registerRenameCommand(); + registerDirectoryCommand(); + registerFileCommands(); + registerFileDiffCheckCommand(); + registerZipCommand(); + + // ftp + registerFtpUploadCommand(); + registerFtpDownloadCommand(); + + // util + registerPrintCommand(); + registerSetValueCommand(); + registerStringUtilCommands(); + registerJsonCommands(); + registerTimerCommand(); + + // shell / process / infra + registerShellCommands(); + registerProcessCommands(); + registerInfraCommands(); + + // external services + registerJiraCommand(); + registerProtobufCommand(); + registerAwsCliCommand(); + registerDockerCommand(); + registerGradleCommand(); + registerWebCommands(); + registerJenkinsCommands(); +} diff --git a/lib/oto/commands/docker/docker.dart b/lib/oto/commands/docker/docker.dart index a1c0700..b562b66 100644 --- a/lib/oto/commands/docker/docker.dart +++ b/lib/oto/commands/docker/docker.dart @@ -23,3 +23,7 @@ class Docker extends Command { return await completeProcess(process, command); } } + +void registerDockerCommand() { + Command.register(CommandType.Docker, () => Docker()); +} diff --git a/lib/oto/commands/file/copy.dart b/lib/oto/commands/file/copy.dart index ddd702f..4e8fc62 100644 --- a/lib/oto/commands/file/copy.dart +++ b/lib/oto/commands/file/copy.dart @@ -76,3 +76,7 @@ class Copy extends Command { return complete(0, command); } } + +void registerCopyCommand() { + Command.register(CommandType.Copy, () => Copy()); +} diff --git a/lib/oto/commands/file/delete.dart b/lib/oto/commands/file/delete.dart index 8f7bf7c..4886880 100644 --- a/lib/oto/commands/file/delete.dart +++ b/lib/oto/commands/file/delete.dart @@ -59,3 +59,7 @@ class Delete extends Command { return complete(0, command); } } + +void registerDeleteCommand() { + Command.register(CommandType.Delete, () => Delete()); +} diff --git a/lib/oto/commands/file/directory.dart b/lib/oto/commands/file/directory.dart index c81e7c8..6d3bd78 100644 --- a/lib/oto/commands/file/directory.dart +++ b/lib/oto/commands/file/directory.dart @@ -17,4 +17,7 @@ class DirectoryCreate extends Command { } return complete(0, command); } -} \ No newline at end of file +} +void registerDirectoryCommand() { + Command.register(CommandType.DirectoryCreate, () => DirectoryCreate()); +} diff --git a/lib/oto/commands/file/file.dart b/lib/oto/commands/file/file.dart index 466423c..e99c135 100644 --- a/lib/oto/commands/file/file.dart +++ b/lib/oto/commands/file/file.dart @@ -106,3 +106,10 @@ class FileInfo extends Command { } } } + +void registerFileCommands() { + Command.register(CommandType.FileRead, () => FileRead()); + Command.register(CommandType.FileWrite, () => FileWrite()); + Command.register(CommandType.Files, () => Files()); + Command.register(CommandType.FileInfo, () => FileInfo()); +} diff --git a/lib/oto/commands/file/file_diff_check.dart b/lib/oto/commands/file/file_diff_check.dart index e094362..7b3f208 100644 --- a/lib/oto/commands/file/file_diff_check.dart +++ b/lib/oto/commands/file/file_diff_check.dart @@ -123,3 +123,7 @@ class FileDiffCheck extends Command { return hex.encode(digest.bytes); } } + +void registerFileDiffCheckCommand() { + Command.register(CommandType.FileDiffCheck, () => FileDiffCheck()); +} diff --git a/lib/oto/commands/file/rename.dart b/lib/oto/commands/file/rename.dart index acc71fc..3e88172 100644 --- a/lib/oto/commands/file/rename.dart +++ b/lib/oto/commands/file/rename.dart @@ -35,3 +35,7 @@ class Rename extends Command { return complete(0, command); } } + +void registerRenameCommand() { + Command.register(CommandType.Rename, () => Rename()); +} diff --git a/lib/oto/commands/file/zip.dart b/lib/oto/commands/file/zip.dart index 7adcd8f..fd690de 100644 --- a/lib/oto/commands/file/zip.dart +++ b/lib/oto/commands/file/zip.dart @@ -76,3 +76,7 @@ class Zip extends Command { return complete(0, command); } } + +void registerZipCommand() { + Command.register(CommandType.Zip, () => Zip()); +} diff --git a/lib/oto/commands/ftp/download.dart b/lib/oto/commands/ftp/download.dart index 20fbfc7..36a02d0 100644 --- a/lib/oto/commands/ftp/download.dart +++ b/lib/oto/commands/ftp/download.dart @@ -43,3 +43,7 @@ class Download extends Command { return complete(0, command); } } + +void registerFtpDownloadCommand() { + Command.register(CommandType.Download, () => Download()); +} diff --git a/lib/oto/commands/ftp/upload.dart b/lib/oto/commands/ftp/upload.dart index d4e849e..0dc257b 100644 --- a/lib/oto/commands/ftp/upload.dart +++ b/lib/oto/commands/ftp/upload.dart @@ -72,3 +72,7 @@ class Upload extends Command { return complete(0, command); } } + +void registerFtpUploadCommand() { + Command.register(CommandType.Upload, () => Upload()); +} diff --git a/lib/oto/commands/git/git.dart b/lib/oto/commands/git/git.dart index 0451b05..8f07feb 100644 --- a/lib/oto/commands/git/git.dart +++ b/lib/oto/commands/git/git.dart @@ -292,3 +292,17 @@ class GitBranch extends Command { return await completeProcess(process, command); } } + +void registerGitCommands() { + Command.register(CommandType.Git, () => Git()); + Command.register(CommandType.GitCommit, () => GitCommit()); + Command.register(CommandType.GitPull, () => GitPull()); + Command.register(CommandType.GitPush, () => GitPush()); + Command.register(CommandType.GitCheckout, () => GitCheckout()); + Command.register(CommandType.GitRev, () => GitRev()); + Command.register(CommandType.GitCount, () => GitCount()); + Command.register(CommandType.GitReset, () => GitReset()); + Command.register(CommandType.GitStashPush, () => GitStashPush()); + Command.register(CommandType.GitStashApply, () => GitStashApply()); + Command.register(CommandType.GitBranch, () => GitBranch()); +} diff --git a/lib/oto/commands/git/git_hub.dart b/lib/oto/commands/git/git_hub.dart index a7ba91b..4c9ea77 100644 --- a/lib/oto/commands/git/git_hub.dart +++ b/lib/oto/commands/git/git_hub.dart @@ -122,3 +122,10 @@ class GitHubPullRequestClose extends Command { return await completeProcess(process, command); } } + +void registerGitHubCommands() { + Command.register(CommandType.GitHub, () => GitHub()); + Command.register(CommandType.GitHubPullRequestCreate, () => GitHubPullRequestCreate()); + Command.register(CommandType.GitHubPullRequestList, () => GitHubPullRequestList()); + Command.register(CommandType.GitHubPullRequestClose, () => GitHubPullRequestClose()); +} diff --git a/lib/oto/commands/gradle/gradle.dart b/lib/oto/commands/gradle/gradle.dart index 598de1f..51df916 100644 --- a/lib/oto/commands/gradle/gradle.dart +++ b/lib/oto/commands/gradle/gradle.dart @@ -22,3 +22,7 @@ class Gradle extends Command { return await completeProcess(process, command); } } + +void registerGradleCommand() { + Command.register(CommandType.Gradle, () => Gradle()); +} diff --git a/lib/oto/commands/infra/smb_authorize.dart b/lib/oto/commands/infra/smb_authorize.dart index 90a2799..272eb74 100644 --- a/lib/oto/commands/infra/smb_authorize.dart +++ b/lib/oto/commands/infra/smb_authorize.dart @@ -23,3 +23,7 @@ class SMBAuth extends Command { return complete(process.exitCode, command); } } + +void registerInfraCommands() { + Command.register(CommandType.SMBAuth, () => SMBAuth()); +} diff --git a/lib/oto/commands/jenkins/jenkins.dart b/lib/oto/commands/jenkins/jenkins.dart index 1f46144..8c02da2 100644 --- a/lib/oto/commands/jenkins/jenkins.dart +++ b/lib/oto/commands/jenkins/jenkins.dart @@ -63,3 +63,7 @@ class JenkinsParameterModify extends Command { return await complete(0, command); } } + +void registerJenkinsCommands() { + Command.register(CommandType.JenkinsParameterModify, () => JenkinsParameterModify()); +} diff --git a/lib/oto/commands/jira/jira.dart b/lib/oto/commands/jira/jira.dart index ec861d8..dda7a33 100644 --- a/lib/oto/commands/jira/jira.dart +++ b/lib/oto/commands/jira/jira.dart @@ -121,4 +121,7 @@ class Jira extends Command { return simpleFuture; } -} \ No newline at end of file +} +void registerJiraCommand() { + Command.register(CommandType.Jira, () => Jira()); +} diff --git a/lib/oto/commands/notification/mattermost.dart b/lib/oto/commands/notification/mattermost.dart index 02fec06..c2202f3 100644 --- a/lib/oto/commands/notification/mattermost.dart +++ b/lib/oto/commands/notification/mattermost.dart @@ -95,3 +95,8 @@ class MattermostBuild extends Command { return complete(0, command); } } + +void registerMattermostCommands() { + Command.register(CommandType.Mattermost, () => Mattermost()); + Command.register(CommandType.MattermostBuild, () => MattermostBuild()); +} diff --git a/lib/oto/commands/notification/slack.dart b/lib/oto/commands/notification/slack.dart index 045b3f8..77a8ff5 100644 --- a/lib/oto/commands/notification/slack.dart +++ b/lib/oto/commands/notification/slack.dart @@ -77,3 +77,9 @@ class SlackBuild extends Command { return complete(0, command); } } + +void registerSlackCommands() { + Command.register(CommandType.Slack, () => Slack()); + Command.register(CommandType.SlackFile, () => SlackFile()); + Command.register(CommandType.SlackBuild, () => SlackBuild()); +} diff --git a/lib/oto/commands/process/process.dart b/lib/oto/commands/process/process.dart index 018562e..46b1534 100644 --- a/lib/oto/commands/process/process.dart +++ b/lib/oto/commands/process/process.dart @@ -57,3 +57,9 @@ class ProcessKill extends Command { return complete(0, command); } } + +void registerProcessCommands() { + Command.register(CommandType.ProcessPortUse, () => ProcessPortUse()); + Command.register(CommandType.ProcessRun, () => ProcessRun()); + Command.register(CommandType.ProcessKill, () => ProcessKill()); +} diff --git a/lib/oto/commands/proto/protobuf.dart b/lib/oto/commands/proto/protobuf.dart index d00f36a..16ba4f4 100644 --- a/lib/oto/commands/proto/protobuf.dart +++ b/lib/oto/commands/proto/protobuf.dart @@ -21,3 +21,7 @@ class Protobuf extends Command { return await completeProcess(process, command); } } + +void registerProtobufCommand() { + Command.register(CommandType.Protobuf, () => Protobuf()); +} diff --git a/lib/oto/commands/shell/shell.dart b/lib/oto/commands/shell/shell.dart index e62bd74..67036e2 100644 --- a/lib/oto/commands/shell/shell.dart +++ b/lib/oto/commands/shell/shell.dart @@ -56,3 +56,8 @@ class ShellFile extends Command { return success; } } + +void registerShellCommands() { + Command.register(CommandType.Shell, () => Shell()); + Command.register(CommandType.ShellFile, () => ShellFile()); +} diff --git a/lib/oto/commands/util/json.dart b/lib/oto/commands/util/json.dart index d1b03ff..7be209b 100644 --- a/lib/oto/commands/util/json.dart +++ b/lib/oto/commands/util/json.dart @@ -134,3 +134,9 @@ class JsonWriterFile extends Command { return complete(0, command); } } + +void registerJsonCommands() { + Command.register(CommandType.JsonReader, () => JsonReader()); + Command.register(CommandType.JsonReaderFile, () => JsonReaderFile()); + Command.register(CommandType.JsonWriterFile, () => JsonWriterFile()); +} diff --git a/lib/oto/commands/util/print.dart b/lib/oto/commands/util/print.dart index e731ff6..2a9460c 100644 --- a/lib/oto/commands/util/print.dart +++ b/lib/oto/commands/util/print.dart @@ -15,3 +15,7 @@ class PrintCommand extends Command { return complete(0, command); } } + +void registerPrintCommand() { + Command.register(CommandType.Print, () => PrintCommand()); +} diff --git a/lib/oto/commands/util/set_value.dart b/lib/oto/commands/util/set_value.dart index 633b685..2c31854 100644 --- a/lib/oto/commands/util/set_value.dart +++ b/lib/oto/commands/util/set_value.dart @@ -85,3 +85,7 @@ class SetValueCommand extends Command { return '<@property.$key>'; } } + +void registerSetValueCommand() { + Command.register(CommandType.SetValue, () => SetValueCommand()); +} diff --git a/lib/oto/commands/util/string_util.dart b/lib/oto/commands/util/string_util.dart index 138e0cd..bab0633 100644 --- a/lib/oto/commands/util/string_util.dart +++ b/lib/oto/commands/util/string_util.dart @@ -113,3 +113,11 @@ class URLInfo extends Command { } } + +void registerStringUtilCommands() { + Command.register(CommandType.StringSub, () => StringSub()); + Command.register(CommandType.StringReplace, () => StringReplace()); + Command.register(CommandType.StringReplacePattern, () => StringReplacePattern()); + Command.register(CommandType.StringIndex, () => StringIndex()); + Command.register(CommandType.URLInfo, () => URLInfo()); +} diff --git a/lib/oto/commands/util/timer.dart b/lib/oto/commands/util/timer.dart index 0d786de..5981125 100644 --- a/lib/oto/commands/util/timer.dart +++ b/lib/oto/commands/util/timer.dart @@ -32,4 +32,7 @@ class Delay extends Command { return await complete(0, command); } -} \ No newline at end of file +} +void registerTimerCommand() { + Command.register(CommandType.Delay, () => Delay()); +} diff --git a/lib/oto/commands/web/web.dart b/lib/oto/commands/web/web.dart index fb40031..ffe17b4 100644 --- a/lib/oto/commands/web/web.dart +++ b/lib/oto/commands/web/web.dart @@ -80,3 +80,8 @@ class WebFile extends WebBase { return await complete(await super.request(data, form), command); } } + +void registerWebCommands() { + Command.register(CommandType.WebRequest, () => WebRequest()); + Command.register(CommandType.WebFile, () => WebFile()); +}