From a7fbfa29e5eaf3b613a7bed49590c4ec2cd3400a Mon Sep 17 00:00:00 2001 From: Yunus Emre Kalkan Date: Tue, 10 Nov 2020 14:34:22 +0300 Subject: [PATCH 1/3] abp add-module --new-template command name chaned to --new --- docs/en/CLI.md | 6 +++--- .../Volo/Abp/Cli/Commands/AddModuleCommand.cs | 14 +++++++++----- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/docs/en/CLI.md b/docs/en/CLI.md index df20031d71..48ec779c1e 100644 --- a/docs/en/CLI.md +++ b/docs/en/CLI.md @@ -178,7 +178,7 @@ abp add-module Volo.Blogging * This example adds the `Volo.Blogging` module to the solution. ```bash -abp add-module ProductManagement --new-template --add-to-solution-file +abp add-module ProductManagement --new --add-to-solution-file ``` * This command creates a fresh new module customized for your solution (named `ProductManagement`) and adds it to your solution. @@ -189,8 +189,8 @@ abp add-module ProductManagement --new-template --add-to-solution-file * `--solution` or `-s`: Specifies the solution (.sln) file path. If not specified, CLI tries to find a .sln file in the current directory. * `--skip-db-migrations`: For EF Core database provider, it automatically adds a new code first migration (`Add-Migration`) and updates the database (`Update-Database`) if necessary. Specify this option to skip this operation. * `-sp` or `--startup-project`: Relative path to the project folder of the startup project. Default value is the current folder. -* `--new-template`: Creates a fresh new module (customized for your solution) and adds it to your solution. -* `--with-source-code`: Downloads the source code of the module to your solution folder and uses local project references instead of NuGet/NPM packages. This options is always `True` if `--new-template` is used. +* `--new`: Creates a fresh new module (customized for your solution) and adds it to your solution. +* `--with-source-code`: Downloads the source code of the module to your solution folder and uses local project references instead of NuGet/NPM packages. This options is always `True` if `--new` is used. * `--add-to-solution-file`: Adds the downloaded/created module to your solution file, so you will also see the projects of the module when you open the solution on a IDE. (only available when `--with-source-code` is `True`.) ### get-source diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/AddModuleCommand.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/AddModuleCommand.cs index 5b4180d989..fee803137e 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/AddModuleCommand.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/AddModuleCommand.cs @@ -37,7 +37,10 @@ namespace Volo.Abp.Cli.Commands } var newTemplate = commandLineArgs.Options.ContainsKey(Options.NewTemplate.Long); - var newProTemplate = commandLineArgs.Options.ContainsKey(Options.NewProTemplate.Long); + + var newProTemplateOption = commandLineArgs.Options.GetOrNull(Options.NewProTemplate.Short, Options.NewProTemplate.Long); + var newProTemplate = !string.IsNullOrEmpty(newProTemplateOption) && newProTemplateOption == "module-pro"; + var withSourceCode = newTemplate || newProTemplate || commandLineArgs.Options.ContainsKey(Options.SourceCode.Long); var addSourceCodeToSolutionFile = withSourceCode && commandLineArgs.Options.ContainsKey("add-to-solution-file"); @@ -91,8 +94,8 @@ namespace Volo.Abp.Cli.Commands sb.AppendLine(" abp add-module Volo.Blogging -s Acme.BookStore Adds the module to the given solution."); sb.AppendLine(" abp add-module Volo.Blogging -s Acme.BookStore --skip-db-migrations false Adds the module to the given solution but doesn't create a database migration."); sb.AppendLine(@" abp add-module Volo.Blogging -s Acme.BookStore -sp ..\Acme.BookStore.Web\Acme.BookStore.Web.csproj Adds the module to the given solution and specify migration startup project."); - sb.AppendLine(@" abp add-module ProductManagement --new-template -sp ..\Acme.BookStore.Web\Acme.BookStore.Web.csproj Crates a new module named `ProductManagement` and adds it to your solution."); - sb.AppendLine(@" abp add-module ProductManagement --new-template --add-to-solution-file -sp ..\Acme.BookStore.Web\Acme.BookStore.Web.csproj Crates a new module named `ProductManagement`, adds it to your solution & solution file."); + sb.AppendLine(@" abp add-module ProductManagement --new -sp ..\Acme.BookStore.Web\Acme.BookStore.Web.csproj Crates a new module named `ProductManagement` and adds it to your solution."); + sb.AppendLine(@" abp add-module ProductManagement --new --add-to-solution-file -sp ..\Acme.BookStore.Web\Acme.BookStore.Web.csproj Crates a new module named `ProductManagement`, adds it to your solution & solution file."); sb.AppendLine(""); sb.AppendLine("See the documentation for more info: https://docs.abp.io/en/abp/latest/CLI"); @@ -176,12 +179,13 @@ namespace Volo.Abp.Cli.Commands public class NewTemplate { - public const string Long = "new-template"; + public const string Long = "new"; } public class NewProTemplate { - public const string Long = "new-pro-template"; + public const string Short = "t"; + public const string Long = "template"; } } } From e65a349c8a53f75c7fd6554fc4a3a76b5c4e8bd8 Mon Sep 17 00:00:00 2001 From: Yunus Emre Kalkan Date: Tue, 10 Nov 2020 14:35:19 +0300 Subject: [PATCH 2/3] Update AddModuleCommand.cs --- .../Volo/Abp/Cli/Commands/AddModuleCommand.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/AddModuleCommand.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/AddModuleCommand.cs index fee803137e..9b6c9a4ea2 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/AddModuleCommand.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/AddModuleCommand.cs @@ -38,8 +38,8 @@ namespace Volo.Abp.Cli.Commands var newTemplate = commandLineArgs.Options.ContainsKey(Options.NewTemplate.Long); - var newProTemplateOption = commandLineArgs.Options.GetOrNull(Options.NewProTemplate.Short, Options.NewProTemplate.Long); - var newProTemplate = !string.IsNullOrEmpty(newProTemplateOption) && newProTemplateOption == "module-pro"; + var template = commandLineArgs.Options.GetOrNull(Options.Template.Short, Options.Template.Long); + var newProTemplate = !string.IsNullOrEmpty(template) && template == "module-pro"; var withSourceCode = newTemplate || newProTemplate || commandLineArgs.Options.ContainsKey(Options.SourceCode.Long); var addSourceCodeToSolutionFile = withSourceCode && commandLineArgs.Options.ContainsKey("add-to-solution-file"); @@ -182,7 +182,7 @@ namespace Volo.Abp.Cli.Commands public const string Long = "new"; } - public class NewProTemplate + public class Template { public const string Short = "t"; public const string Long = "template"; From 9a78e91a00d18c0b964c96e200cadf2af17c570d Mon Sep 17 00:00:00 2001 From: Yunus Emre Kalkan Date: Tue, 10 Nov 2020 14:38:35 +0300 Subject: [PATCH 3/3] Update AddModuleCommand.cs --- .../Volo/Abp/Cli/Commands/AddModuleCommand.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/AddModuleCommand.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/AddModuleCommand.cs index 9b6c9a4ea2..26574c1c68 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/AddModuleCommand.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/AddModuleCommand.cs @@ -5,6 +5,7 @@ using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging.Abstractions; using System.Threading.Tasks; using Volo.Abp.Cli.Args; +using Volo.Abp.Cli.ProjectBuilding.Templates.MvcModule; using Volo.Abp.Cli.ProjectModification; using Volo.Abp.Cli.Utils; using Volo.Abp.DependencyInjection; @@ -39,7 +40,7 @@ namespace Volo.Abp.Cli.Commands var newTemplate = commandLineArgs.Options.ContainsKey(Options.NewTemplate.Long); var template = commandLineArgs.Options.GetOrNull(Options.Template.Short, Options.Template.Long); - var newProTemplate = !string.IsNullOrEmpty(template) && template == "module-pro"; + var newProTemplate = !string.IsNullOrEmpty(template) && template == ModuleProTemplate.TemplateName; var withSourceCode = newTemplate || newProTemplate || commandLineArgs.Options.ContainsKey(Options.SourceCode.Long); var addSourceCodeToSolutionFile = withSourceCode && commandLineArgs.Options.ContainsKey("add-to-solution-file");