Skip to content

Commit

Permalink
Merge pull request #10921 from iyilm4z/cli-refactoring
Browse files Browse the repository at this point in the history
Fixes #10920 - Define constants for missing cli command names
  • Loading branch information
maliming authored Dec 22, 2021
2 parents a4bb218 + 199e40d commit 98c4291
Show file tree
Hide file tree
Showing 21 changed files with 60 additions and 21 deletions.
41 changes: 20 additions & 21 deletions framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/AbpCliCoreModule.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,29 +41,28 @@ public override void ConfigureServices(ServiceConfigurationContext context)

Configure<AbpCliOptions>(options =>
{
//TODO: Define constants like done for GenerateProxyCommand.Name.
options.Commands["help"] = typeof(HelpCommand);
options.Commands["prompt"] = typeof(PromptCommand);
options.Commands["new"] = typeof(NewCommand);
options.Commands["get-source"] = typeof(GetSourceCommand);
options.Commands["update"] = typeof(UpdateCommand);
options.Commands["add-package"] = typeof(AddPackageCommand);
options.Commands["add-module"] = typeof(AddModuleCommand);
options.Commands["list-modules"] = typeof(ListModulesCommand);
options.Commands["login"] = typeof(LoginCommand);
options.Commands["login-info"] = typeof(LoginInfoCommand);
options.Commands["logout"] = typeof(LogoutCommand);
options.Commands[HelpCommand.Name] = typeof(HelpCommand);
options.Commands[PromptCommand.Name] = typeof(PromptCommand);
options.Commands[NewCommand.Name] = typeof(NewCommand);
options.Commands[GetSourceCommand.Name] = typeof(GetSourceCommand);
options.Commands[UpdateCommand.Name] = typeof(UpdateCommand);
options.Commands[AddPackageCommand.Name] = typeof(AddPackageCommand);
options.Commands[AddModuleCommand.Name] = typeof(AddModuleCommand);
options.Commands[ListModulesCommand.Name] = typeof(ListModulesCommand);
options.Commands[LoginCommand.Name] = typeof(LoginCommand);
options.Commands[LoginInfoCommand.Name] = typeof(LoginInfoCommand);
options.Commands[LogoutCommand.Name] = typeof(LogoutCommand);
options.Commands[GenerateProxyCommand.Name] = typeof(GenerateProxyCommand);
options.Commands[RemoveProxyCommand.Name] = typeof(RemoveProxyCommand);
options.Commands["suite"] = typeof(SuiteCommand);
options.Commands["switch-to-preview"] = typeof(SwitchToPreviewCommand);
options.Commands["switch-to-stable"] = typeof(SwitchToStableCommand);
options.Commands["switch-to-nightly"] = typeof(SwitchToNightlyCommand);
options.Commands["translate"] = typeof(TranslateCommand);
options.Commands["build"] = typeof(BuildCommand);
options.Commands["bundle"] = typeof(BundleCommand);
options.Commands["create-migration-and-run-migrator"] = typeof(CreateMigrationAndRunMigratorCommand);
options.Commands["install-libs"] = typeof(InstallLibsCommand);
options.Commands[SuiteCommand.Name] = typeof(SuiteCommand);
options.Commands[SwitchToPreviewCommand.Name] = typeof(SwitchToPreviewCommand);
options.Commands[SwitchToStableCommand.Name] = typeof(SwitchToStableCommand);
options.Commands[SwitchToNightlyCommand.Name] = typeof(SwitchToNightlyCommand);
options.Commands[TranslateCommand.Name] = typeof(TranslateCommand);
options.Commands[BuildCommand.Name] = typeof(BuildCommand);
options.Commands[BundleCommand.Name] = typeof(BundleCommand);
options.Commands[CreateMigrationAndRunMigratorCommand.Name] = typeof(CreateMigrationAndRunMigratorCommand);
options.Commands[InstallLibsCommand.Name] = typeof(InstallLibsCommand);
});

Configure<AbpCliServiceProxyOptions>(options =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ namespace Volo.Abp.Cli.Commands;

public class AddModuleCommand : IConsoleCommand, ITransientDependency
{
public const string Name = "add-module";

private AddModuleInfoOutput _lastAddedModuleInfo;
public ILogger<AddModuleCommand> Logger { get; set; }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ namespace Volo.Abp.Cli.Commands;

public class AddPackageCommand : IConsoleCommand, ITransientDependency
{
public const string Name = "add-package";

public ILogger<AddPackageCommand> Logger { get; set; }

protected ProjectNugetPackageAdder ProjectNugetPackageAdder { get; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ namespace Volo.Abp.Cli.Commands;

public class BuildCommand : IConsoleCommand, ITransientDependency
{
public const string Name = "build";

public IDotNetProjectDependencyFiller DotNetProjectDependencyFiller { get; set; }

public IChangedProjectFinder ChangedProjectFinder { get; set; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ namespace Volo.Abp.Cli.Commands;

public class BundleCommand : IConsoleCommand, ITransientDependency
{
public const string Name = "bundle";

public ILogger<BundleCommand> Logger { get; set; }

public IBundlingService BundlingService { get; set; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ namespace Volo.Abp.Cli.Commands;

public class CreateMigrationAndRunMigratorCommand : IConsoleCommand, ITransientDependency
{
public const string Name = "create-migration-and-run-migrator";

public ICmdHelper CmdHelper { get; }
public ILogger<CreateMigrationAndRunMigratorCommand> Logger { get; set; }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ namespace Volo.Abp.Cli.Commands;

public class GetSourceCommand : IConsoleCommand, ITransientDependency
{
public const string Name = "get-source";

private readonly SourceCodeDownloadService _sourceCodeDownloadService;
public ModuleProjectBuilder ModuleProjectBuilder { get; }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ namespace Volo.Abp.Cli.Commands;

public class HelpCommand : IConsoleCommand, ITransientDependency
{
public const string Name = "help";

public ILogger<HelpCommand> Logger { get; set; }
protected AbpCliOptions AbpCliOptions { get; }
protected IServiceScopeFactory ServiceScopeFactory { get; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ namespace Volo.Abp.Cli.Commands;

public class InstallLibsCommand : IConsoleCommand, ITransientDependency
{
public const string Name = "install-libs";

public ILogger<InstallLibsCommand> Logger { get; set; }

protected IInstallLibsService InstallLibsService { get; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ namespace Volo.Abp.Cli.Commands;

public class ListModulesCommand : IConsoleCommand, ITransientDependency
{
public const string Name = "list-modules";

public ModuleInfoProvider ModuleInfoProvider { get; }
public ILogger<ListModulesCommand> Logger { get; set; }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ namespace Volo.Abp.Cli.Commands;

public class LoginCommand : IConsoleCommand, ITransientDependency
{
public const string Name = "login";

public ILogger<LoginCommand> Logger { get; set; }

protected AuthService AuthService { get; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ namespace Volo.Abp.Cli.Commands;

public class LoginInfoCommand : IConsoleCommand, ITransientDependency
{
public const string Name = "login-info";

public ILogger<LoginInfoCommand> Logger { get; set; }

protected AuthService AuthService { get; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ namespace Volo.Abp.Cli.Commands;

public class LogoutCommand : IConsoleCommand, ITransientDependency
{
public const string Name = "logout";

public ILogger<LogoutCommand> Logger { get; set; }

protected AuthService AuthService { get; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ namespace Volo.Abp.Cli.Commands;

public class NewCommand : ProjectCreationCommandBase, IConsoleCommand, ITransientDependency
{
public const string Name = "new";

public ILogger<NewCommand> Logger { get; set; }

protected TemplateProjectBuilder TemplateProjectBuilder { get; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ namespace Volo.Abp.Cli.Commands;

public class PromptCommand : IConsoleCommand, ITransientDependency
{
public const string Name = "prompt";

public Task ExecuteAsync(CommandLineArgs commandLineArgs)
{
return Task.CompletedTask;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ namespace Volo.Abp.Cli.Commands;

public class SuiteCommand : IConsoleCommand, ITransientDependency
{
public const string Name = "suite";

public ICmdHelper CmdHelper { get; }
private readonly AbpNuGetIndexUrlService _nuGetIndexUrlService;
private readonly NuGetService _nuGetService;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ namespace Volo.Abp.Cli.Commands;

public class SwitchToNightlyCommand : IConsoleCommand, ITransientDependency
{
public const string Name = "switch-to-nightly";

private readonly PackagePreviewSwitcher _packagePreviewSwitcher;

public SwitchToNightlyCommand(PackagePreviewSwitcher packagePreviewSwitcher)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ namespace Volo.Abp.Cli.Commands;

public class SwitchToPreviewCommand : IConsoleCommand, ITransientDependency
{
public const string Name = "switch-to-preview";

private readonly PackagePreviewSwitcher _packagePreviewSwitcher;

public SwitchToPreviewCommand(PackagePreviewSwitcher packagePreviewSwitcher)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ namespace Volo.Abp.Cli.Commands;

public class SwitchToStableCommand : IConsoleCommand, ITransientDependency
{
public const string Name = "switch-to-stable";

private readonly PackagePreviewSwitcher _packagePreviewSwitcher;

public SwitchToStableCommand(PackagePreviewSwitcher packagePreviewSwitcher)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ namespace Volo.Abp.Cli.Commands;

public class TranslateCommand : IConsoleCommand, ITransientDependency
{
public const string Name = "translate";

public ILogger<TranslateCommand> Logger { get; set; }

public Task ExecuteAsync(CommandLineArgs commandLineArgs)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ namespace Volo.Abp.Cli.Commands;

public class UpdateCommand : IConsoleCommand, ITransientDependency
{
public const string Name = "update";

public ILogger<UpdateCommand> Logger { get; set; }

private readonly VoloNugetPackagesVersionUpdater _nugetPackagesVersionUpdater;
Expand Down

0 comments on commit 98c4291

Please sign in to comment.