From a7fbfa29e5eaf3b613a7bed49590c4ec2cd3400a Mon Sep 17 00:00:00 2001 From: Yunus Emre Kalkan Date: Tue, 10 Nov 2020 14:34:22 +0300 Subject: [PATCH] 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"; } } }