diff --git a/docs/en/CLI.md b/docs/en/CLI.md index dcab1b672e..68a5923a9f 100644 --- a/docs/en/CLI.md +++ b/docs/en/CLI.md @@ -59,6 +59,7 @@ abp new Acme.BookStore * `--output-folder` or `-o`: Specifies the output folder. Default value is the current directory. * `--version` or `-v`: Specifies the ABP & template version. It can be a [release tag](https://github.com/abpframework/abp/releases) or a [branch name](https://github.com/abpframework/abp/branches). Uses the latest release if not specified. Most of the times, you will want to use the latest version. * `--template-source` or `-ts`: Specifies a custom template source to use to build the project. Local and network sources can be used(Like `D\localTemplate` or `https://.zip`). +* `--create-solution-folder` or `-csf`: Specifies if the project will be in a new folder in the output folder or directly the output folder. ### add-package diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/NewCommand.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/NewCommand.cs index 04b9168a44..51950de215 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/NewCommand.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/NewCommand.cs @@ -85,10 +85,25 @@ namespace Volo.Abp.Cli.Commands Logger.LogInformation("Template Source: " + templateSource); } + var createSolutionFolder = (commandLineArgs.Options.GetOrNull(Options.CreateSolutionFolder.Short, Options.CreateSolutionFolder.Long) ?? "true").ToLowerInvariant() != "false"; + if (!createSolutionFolder) + { + Logger.LogInformation("Create Solution Folder: false"); + } + var outputFolder = commandLineArgs.Options.GetOrNull(Options.OutputFolder.Short, Options.OutputFolder.Long); - outputFolder = Path.Combine(outputFolder != null ? Path.GetFullPath(outputFolder) : Directory.GetCurrentDirectory(), - SolutionName.Parse(projectName).FullName); + var outputFolderRoot = + outputFolder != null ? Path.GetFullPath(outputFolder) : Directory.GetCurrentDirectory(); + + if (createSolutionFolder) + { + outputFolder = Path.Combine(outputFolderRoot, SolutionName.Parse(projectName).FullName); + } + else + { + outputFolder = outputFolderRoot; + } if (!Directory.Exists(outputFolder)) { @@ -289,6 +304,12 @@ namespace Volo.Abp.Cli.Commands public const string Short = "ts"; public const string Long = "template-source"; } + + public static class CreateSolutionFolder + { + public const string Short = "csf"; + public const string Long = "create-solution-folder"; + } } } }