Browse Source

Cli: createSolutionFolder option

pull/3209/head
Yunus Emre Kalkan 6 years ago
parent
commit
8bbbbf9a14
  1. 1
      docs/en/CLI.md
  2. 25
      framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/NewCommand.cs

1
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://<your url>.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

25
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";
}
}
}
}

Loading…
Cancel
Save