From 8a18186341277c90f8ed72993838cb47550ad6d1 Mon Sep 17 00:00:00 2001 From: Yunus Emre Kalkan Date: Wed, 27 Nov 2019 16:19:57 +0300 Subject: [PATCH] update command solution directory option --- .../Volo/Abp/Cli/Commands/UpdateCommand.cs | 24 ++++++++++++++----- 1 file changed, 18 insertions(+), 6 deletions(-) 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 0f31af2eb0..a1775bb987 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 @@ -44,31 +44,37 @@ namespace Volo.Abp.Cli.Commands var updateNpm = commandLineArgs.Options.ContainsKey(Options.Packages.Npm); var updateNuget = commandLineArgs.Options.ContainsKey(Options.Packages.NuGet); + var directory = commandLineArgs.Options.GetOrNull(Options.SolutionPath.Short, Options.SolutionPath.Long); + if (directory == null) + { + directory = Directory.GetCurrentDirectory(); + } + var both = (updateNuget && updateNpm) || (!updateNuget && !updateNpm); if (updateNuget || both) { - await UpdateNugetPackages(commandLineArgs); + await UpdateNugetPackages(commandLineArgs, directory); } if (updateNpm || both) { - UpdateNpmPackages(); + UpdateNpmPackages(directory); } } - private void UpdateNpmPackages() + private void UpdateNpmPackages(string directory) { - _npmPackagesUpdater.Update(Directory.GetCurrentDirectory()); + _npmPackagesUpdater.Update(directory); } - private async Task UpdateNugetPackages(CommandLineArgs commandLineArgs) + private async Task UpdateNugetPackages(CommandLineArgs commandLineArgs, string directory) { var includePreviews = commandLineArgs.Options.GetOrNull(Options.IncludePreviews.Short, Options.IncludePreviews.Long) != null; - var solution = Directory.GetFiles(Directory.GetCurrentDirectory(), "*.sln").FirstOrDefault(); + var solution = Directory.GetFiles(directory, "*.sln").FirstOrDefault(); if (solution != null) { @@ -131,6 +137,12 @@ namespace Volo.Abp.Cli.Commands public static class Options { + public static class SolutionPath + { + public const string Short = "sp"; + public const string Long = "solution-path"; + } + public static class IncludePreviews { public const string Short = "p";