From 545f1afb7b80b70c41a2ff335c9d379e351234da Mon Sep 17 00:00:00 2001 From: maliming Date: Tue, 28 Apr 2020 10:46:31 +0800 Subject: [PATCH 1/2] Add SolutionName option to update command. Resolve #3753 --- .../Volo/Abp/Cli/Commands/UpdateCommand.cs | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/UpdateCommand.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/UpdateCommand.cs index e6a2319c72..ca8bfa9bf8 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/UpdateCommand.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/UpdateCommand.cs @@ -57,7 +57,11 @@ namespace Volo.Abp.Cli.Commands .Options .GetOrNull(Options.IncludePreviews.Short, Options.IncludePreviews.Long) != null; - var solution = Directory.GetFiles(directory, "*.sln", SearchOption.AllDirectories).FirstOrDefault(); + var solution = commandLineArgs.Options.GetOrNull(Options.SolutionName.Short, Options.SolutionName.Long); + if (solution.IsNullOrWhiteSpace()) + { + solution = Directory.GetFiles(directory, "*.sln", SearchOption.AllDirectories).FirstOrDefault(); + } if (solution != null) { @@ -101,11 +105,14 @@ namespace Volo.Abp.Cli.Commands sb.AppendLine("-p|--include-previews (if supported by the template)"); sb.AppendLine("--npm (Only updates NPM packages)"); sb.AppendLine("--nuget (Only updates Nuget packages)"); + sb.AppendLine("-sp|--solution-path (Specify the solution path)"); + sb.AppendLine("-sn|--solution-name (Specify the solution name)"); sb.AppendLine(""); sb.AppendLine("Some examples:"); sb.AppendLine(""); sb.AppendLine(" abp update"); sb.AppendLine(" abp update -p"); + sb.AppendLine(" abp update -sp \"D:\\projects\\\" -sn Acme.BookStore"); sb.AppendLine(""); sb.AppendLine("See the documentation for more info: https://docs.abp.io/en/abp/latest/CLI"); @@ -125,6 +132,12 @@ namespace Volo.Abp.Cli.Commands public const string Long = "solution-path"; } + public static class SolutionName + { + public const string Short = "sn"; + public const string Long = "solution-name"; + } + public static class IncludePreviews { public const string Short = "p"; From b86606d0b8bbe80287ad695d4e34a81c8f16afbb Mon Sep 17 00:00:00 2001 From: maliming Date: Tue, 28 Apr 2020 11:11:12 +0800 Subject: [PATCH 2/2] Update CLI.md --- docs/en/CLI.md | 2 ++ docs/zh-Hans/CLI.md | 2 ++ 2 files changed, 4 insertions(+) diff --git a/docs/en/CLI.md b/docs/en/CLI.md index b687a5244a..6a5a331e8f 100644 --- a/docs/en/CLI.md +++ b/docs/en/CLI.md @@ -135,6 +135,8 @@ abp update [options] * `--include-previews` or `-p`: Includes preview, beta and rc packages while checking the latest versions. * `--npm`: Only updates NPM packages. * `--nuget`: Only updates NuGet packages. +* `--solution-path` or `-sp`: Specify the solution path. Use the current directory by default +* `--solution-name` or `-sn`: Specify the solution name. Search `*.sln` files in the directory by default. ### switch-to-preview diff --git a/docs/zh-Hans/CLI.md b/docs/zh-Hans/CLI.md index 4d037ef2fd..3b440ed722 100644 --- a/docs/zh-Hans/CLI.md +++ b/docs/zh-Hans/CLI.md @@ -135,6 +135,8 @@ abp update [options] * `--include-previews` 或 `-p`: 将预览版, 测试版本 和 rc 包 同时更新到最新版本. * `--npm`: 仅更新NPM包 * `--nuget`: 仅更新的NuGet包 +* `--solution-path` 或 `-sp`: 指定解决方案路径/目录. 默认使用当前目录 +* `--solution-name` 或 `-sn`: 指定解决方案名称. 默认在目录中搜索`*.sln`文件. ### 切换到每晚构建(预览)包