tool-path option -- "Session tool" (#8716)
* Change to escape string via XML * tool-path option -- "Session tool" From the beginning design, shim and packageInstaller take package location from constructor and don't have assumption anymore. From previous discussion, tool-path will simply change global location to the one user want, and everything else is the same. However, this "override" need to happen during the call, that means InstallToolCommand will create different shim and packageInstaller object according to the tool-path during the call instead of constructor DI. * global package location change * block of leading dot as command name * Localization of tool-path option
This commit is contained in:
parent
65a761ada8
commit
0598e6cb70
60 changed files with 884 additions and 265 deletions
|
@ -4,25 +4,19 @@
|
|||
using System;
|
||||
using System.IO;
|
||||
using System.Runtime.InteropServices;
|
||||
using Microsoft.DotNet.Cli.Utils;
|
||||
using Microsoft.DotNet.PlatformAbstractions;
|
||||
using NuGet.Common;
|
||||
|
||||
namespace Microsoft.DotNet.Configurer
|
||||
{
|
||||
public class CliFolderPathCalculator
|
||||
{
|
||||
// ToolsShimFolderName ToolPackageFolderName cannot be the same
|
||||
// or if the PackageId is the same as CommandName, they will conflict on unix.
|
||||
private const string ToolsShimFolderName = "tools";
|
||||
private const string ToolPackageFolderName = "toolspkgs";
|
||||
private const string DotnetProfileDirectoryName = ".dotnet";
|
||||
private const string ToolsShimFolderName = "tools";
|
||||
|
||||
public string CliFallbackFolderPath => Environment.GetEnvironmentVariable("DOTNET_CLI_TEST_FALLBACKFOLDER") ??
|
||||
Path.Combine(new DirectoryInfo(AppContext.BaseDirectory).Parent.FullName, "NuGetFallbackFolder");
|
||||
|
||||
public string ToolsShimPath => Path.Combine(DotnetUserProfileFolderPath, ToolsShimFolderName);
|
||||
public string ToolsPackagePath => Path.Combine(DotnetUserProfileFolderPath, ToolPackageFolderName);
|
||||
public string ToolsPackagePath => ToolPackageFolderPathCalculator.GetToolPackageFolderPath(ToolsShimPath);
|
||||
public BashPathUnderHomeDirectory ToolsShimPathInUnix
|
||||
{
|
||||
get
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
// Copyright (c) .NET Foundation and contributors. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
|
||||
using System.IO;
|
||||
|
||||
namespace Microsoft.DotNet.Configurer
|
||||
{
|
||||
public static class ToolPackageFolderPathCalculator
|
||||
{
|
||||
private const string NestedToolPackageFolderName = ".store";
|
||||
public static string GetToolPackageFolderPath(string toolsShimPath)
|
||||
{
|
||||
return Path.Combine(toolsShimPath, NestedToolPackageFolderName);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -34,6 +34,11 @@ namespace Microsoft.Extensions.EnvironmentAbstractions
|
|||
return $"\"{Value}\"";
|
||||
}
|
||||
|
||||
public string ToXmlEncodeString()
|
||||
{
|
||||
return System.Net.WebUtility.HtmlEncode(Value);
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return ToQuotedString();
|
||||
|
|
|
@ -625,4 +625,7 @@ setx PATH "%PATH%;{0}"
|
|||
<data name="ColumnMaxWidthMustBeGreaterThanZero" xml:space="preserve">
|
||||
<value>Column maximum width must be greater than zero.</value>
|
||||
</data>
|
||||
<data name="ToolSettingsInvalidLeadingDotCommandName" xml:space="preserve">
|
||||
<value>Command '{0}' has a leading dot.</value>
|
||||
</data>
|
||||
</root>
|
||||
|
|
22
src/dotnet/ShellShim/ShellShimRepositoryFactory.cs
Normal file
22
src/dotnet/ShellShim/ShellShimRepositoryFactory.cs
Normal file
|
@ -0,0 +1,22 @@
|
|||
// Copyright (c) .NET Foundation and contributors. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
|
||||
using Microsoft.DotNet.Configurer;
|
||||
using Microsoft.Extensions.EnvironmentAbstractions;
|
||||
|
||||
namespace Microsoft.DotNet.ShellShim
|
||||
{
|
||||
internal static class ShellShimRepositoryFactory
|
||||
{
|
||||
public static IShellShimRepository CreateShellShimRepository(DirectoryPath? nonGlobalLocation = null)
|
||||
{
|
||||
return new ShellShimRepository(nonGlobalLocation ?? GetShimLocation());
|
||||
}
|
||||
|
||||
private static DirectoryPath GetShimLocation()
|
||||
{
|
||||
var cliFolderPathCalculator = new CliFolderPathCalculator();
|
||||
return new DirectoryPath(cliFolderPathCalculator.ToolsShimPath);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -27,6 +27,7 @@ namespace Microsoft.DotNet.ToolPackage
|
|||
commandName));
|
||||
}
|
||||
|
||||
EnsureNoLeadingDot(commandName);
|
||||
EnsureNoInvalidFilenameCharacters(commandName);
|
||||
|
||||
CommandName = commandName;
|
||||
|
@ -46,6 +47,17 @@ namespace Microsoft.DotNet.ToolPackage
|
|||
}
|
||||
}
|
||||
|
||||
private void EnsureNoLeadingDot(string commandName)
|
||||
{
|
||||
if (commandName.StartsWith(".", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
throw new ToolConfigurationException(
|
||||
string.Format(
|
||||
CommonLocalizableStrings.ToolSettingsInvalidLeadingDotCommandName,
|
||||
commandName));
|
||||
}
|
||||
}
|
||||
|
||||
public string CommandName { get; }
|
||||
public string ToolAssemblyEntryPoint { get; }
|
||||
}
|
||||
|
|
41
src/dotnet/ToolPackage/ToolPackageFactory.cs
Normal file
41
src/dotnet/ToolPackage/ToolPackageFactory.cs
Normal file
|
@ -0,0 +1,41 @@
|
|||
// Copyright (c) .NET Foundation and contributors. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
|
||||
using Microsoft.DotNet.Cli.Utils;
|
||||
using Microsoft.DotNet.Configurer;
|
||||
using Microsoft.DotNet.Tools.Install.Tool;
|
||||
using Microsoft.Extensions.EnvironmentAbstractions;
|
||||
|
||||
namespace Microsoft.DotNet.ToolPackage
|
||||
{
|
||||
internal static class ToolPackageFactory
|
||||
{
|
||||
public static (IToolPackageStore, IToolPackageInstaller) CreateToolPackageStoreAndInstaller(
|
||||
DirectoryPath? nonGlobalLocation = null)
|
||||
{
|
||||
IToolPackageStore toolPackageStore = CreateToolPackageStore(nonGlobalLocation);
|
||||
var toolPackageInstaller = new ToolPackageInstaller(
|
||||
toolPackageStore,
|
||||
new ProjectRestorer(Reporter.Output));
|
||||
|
||||
return (toolPackageStore, toolPackageInstaller);
|
||||
}
|
||||
|
||||
public static IToolPackageStore CreateToolPackageStore(
|
||||
DirectoryPath? nonGlobalLocation = null)
|
||||
{
|
||||
var toolPackageStore =
|
||||
new ToolPackageStore(nonGlobalLocation.HasValue
|
||||
? new DirectoryPath(ToolPackageFolderPathCalculator.GetToolPackageFolderPath(nonGlobalLocation.Value.Value))
|
||||
: GetPackageLocation());
|
||||
|
||||
return toolPackageStore;
|
||||
}
|
||||
|
||||
private static DirectoryPath GetPackageLocation()
|
||||
{
|
||||
var cliFolderPathCalculator = new CliFolderPathCalculator();
|
||||
return new DirectoryPath(cliFolderPathCalculator.ToolsPackagePath);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -17,14 +17,16 @@ using NuGet.Versioning;
|
|||
|
||||
namespace Microsoft.DotNet.Tools.Install.Tool
|
||||
{
|
||||
internal delegate IShellShimRepository CreateShellShimRepository(DirectoryPath? nonGlobalLocation = null);
|
||||
internal delegate (IToolPackageStore, IToolPackageInstaller) CreateToolPackageStoreAndInstaller(DirectoryPath? nonGlobalLocation = null);
|
||||
|
||||
internal class InstallToolCommand : CommandBase
|
||||
{
|
||||
private readonly IToolPackageStore _toolPackageStore;
|
||||
private readonly IToolPackageInstaller _toolPackageInstaller;
|
||||
private readonly IShellShimRepository _shellShimRepository;
|
||||
private readonly IEnvironmentPathInstruction _environmentPathInstruction;
|
||||
private readonly IReporter _reporter;
|
||||
private readonly IReporter _errorReporter;
|
||||
private CreateShellShimRepository _createShellShimRepository;
|
||||
private CreateToolPackageStoreAndInstaller _createToolPackageStoreAndInstaller;
|
||||
|
||||
private readonly PackageId _packageId;
|
||||
private readonly string _packageVersion;
|
||||
|
@ -33,13 +35,13 @@ namespace Microsoft.DotNet.Tools.Install.Tool
|
|||
private readonly string _source;
|
||||
private readonly bool _global;
|
||||
private readonly string _verbosity;
|
||||
private readonly string _toolPath;
|
||||
|
||||
public InstallToolCommand(
|
||||
AppliedOption appliedCommand,
|
||||
ParseResult parseResult,
|
||||
IToolPackageStore toolPackageStore = null,
|
||||
IToolPackageInstaller toolPackageInstaller = null,
|
||||
IShellShimRepository shellShimRepository = null,
|
||||
CreateToolPackageStoreAndInstaller createToolPackageStoreAndInstaller = null,
|
||||
CreateShellShimRepository createShellShimRepository = null,
|
||||
IEnvironmentPathInstruction environmentPathInstruction = null,
|
||||
IReporter reporter = null)
|
||||
: base(parseResult)
|
||||
|
@ -56,22 +58,15 @@ namespace Microsoft.DotNet.Tools.Install.Tool
|
|||
_source = appliedCommand.ValueOrDefault<string>("source");
|
||||
_global = appliedCommand.ValueOrDefault<bool>("global");
|
||||
_verbosity = appliedCommand.SingleArgumentOrDefault("verbosity");
|
||||
_toolPath = appliedCommand.SingleArgumentOrDefault("tool-path");
|
||||
|
||||
var cliFolderPathCalculator = new CliFolderPathCalculator();
|
||||
|
||||
_toolPackageStore = toolPackageStore
|
||||
?? new ToolPackageStore(new DirectoryPath(cliFolderPathCalculator.ToolsPackagePath));
|
||||
|
||||
_toolPackageInstaller = toolPackageInstaller
|
||||
?? new ToolPackageInstaller(
|
||||
_toolPackageStore,
|
||||
new ProjectRestorer(_reporter));
|
||||
_createToolPackageStoreAndInstaller = createToolPackageStoreAndInstaller ?? ToolPackageFactory.CreateToolPackageStoreAndInstaller;
|
||||
|
||||
_environmentPathInstruction = environmentPathInstruction
|
||||
?? EnvironmentPathFactory.CreateEnvironmentPathInstruction();
|
||||
|
||||
_shellShimRepository = shellShimRepository
|
||||
?? new ShellShimRepository(new DirectoryPath(cliFolderPathCalculator.ToolsShimPath));
|
||||
_createShellShimRepository = createShellShimRepository ?? ShellShimRepositoryFactory.CreateShellShimRepository;
|
||||
|
||||
_reporter = (reporter ?? Reporter.Output);
|
||||
_errorReporter = (reporter ?? Reporter.Error);
|
||||
|
@ -79,9 +74,14 @@ namespace Microsoft.DotNet.Tools.Install.Tool
|
|||
|
||||
public override int Execute()
|
||||
{
|
||||
if (!_global)
|
||||
if (string.IsNullOrWhiteSpace(_toolPath) && !_global)
|
||||
{
|
||||
throw new GracefulException(LocalizableStrings.InstallToolCommandOnlySupportGlobal);
|
||||
throw new GracefulException(LocalizableStrings.InstallToolCommandNeedGlobalOrToolPath);
|
||||
}
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(_toolPath) && _global)
|
||||
{
|
||||
throw new GracefulException(LocalizableStrings.InstallToolCommandInvalidGlobalAndToolPath);
|
||||
}
|
||||
|
||||
if (_configFilePath != null && !File.Exists(_configFilePath))
|
||||
|
@ -92,6 +92,7 @@ namespace Microsoft.DotNet.Tools.Install.Tool
|
|||
Path.GetFullPath(_configFilePath)));
|
||||
}
|
||||
|
||||
|
||||
VersionRange versionRange = null;
|
||||
if (!string.IsNullOrEmpty(_packageVersion) && !VersionRange.TryParse(_packageVersion, out versionRange))
|
||||
{
|
||||
|
@ -101,7 +102,18 @@ namespace Microsoft.DotNet.Tools.Install.Tool
|
|||
_packageVersion));
|
||||
}
|
||||
|
||||
if (_toolPackageStore.EnumeratePackageVersions(_packageId).FirstOrDefault() != null)
|
||||
DirectoryPath? toolPath = null;
|
||||
if (_toolPath != null)
|
||||
{
|
||||
toolPath = new DirectoryPath(_toolPath);
|
||||
}
|
||||
|
||||
(IToolPackageStore toolPackageStore, IToolPackageInstaller toolPackageInstaller) =
|
||||
_createToolPackageStoreAndInstaller(toolPath);
|
||||
IShellShimRepository shellShimRepository = _createShellShimRepository(toolPath);
|
||||
|
||||
// Prevent installation if any version of the package is installed
|
||||
if (toolPackageStore.EnumeratePackageVersions(_packageId).FirstOrDefault() != null)
|
||||
{
|
||||
_errorReporter.WriteLine(string.Format(LocalizableStrings.ToolAlreadyInstalled, _packageId).Red());
|
||||
return 1;
|
||||
|
@ -120,7 +132,7 @@ namespace Microsoft.DotNet.Tools.Install.Tool
|
|||
TransactionScopeOption.Required,
|
||||
TimeSpan.Zero))
|
||||
{
|
||||
package = _toolPackageInstaller.InstallPackage(
|
||||
package = toolPackageInstaller.InstallPackage(
|
||||
packageId: _packageId,
|
||||
versionRange: versionRange,
|
||||
targetFramework: _framework,
|
||||
|
@ -130,13 +142,16 @@ namespace Microsoft.DotNet.Tools.Install.Tool
|
|||
|
||||
foreach (var command in package.Commands)
|
||||
{
|
||||
_shellShimRepository.CreateShim(command.Executable, command.Name);
|
||||
shellShimRepository.CreateShim(command.Executable, command.Name);
|
||||
}
|
||||
|
||||
scope.Complete();
|
||||
}
|
||||
|
||||
_environmentPathInstruction.PrintAddPathInstructionIfPathDoesNotExist();
|
||||
if (_global)
|
||||
{
|
||||
_environmentPathInstruction.PrintAddPathInstructionIfPathDoesNotExist();
|
||||
}
|
||||
|
||||
_reporter.WriteLine(
|
||||
string.Format(
|
||||
|
|
|
@ -19,6 +19,10 @@ namespace Microsoft.DotNet.Cli
|
|||
"-g|--global",
|
||||
LocalizableStrings.GlobalOptionDescription,
|
||||
Accept.NoArguments()),
|
||||
Create.Option(
|
||||
"--tool-path",
|
||||
LocalizableStrings.ToolPathDescription,
|
||||
Accept.ExactlyOneArgument()),
|
||||
Create.Option(
|
||||
"--version",
|
||||
LocalizableStrings.VersionOptionDescription,
|
||||
|
|
|
@ -157,9 +157,6 @@ Tool '{1}' (version '{2}') was successfully installed.</value>
|
|||
<data name="InstallFullCommandNameLocalized" xml:space="preserve">
|
||||
<value>.NET Install Command</value>
|
||||
</data>
|
||||
<data name="InstallToolCommandOnlySupportGlobal" xml:space="preserve">
|
||||
<value>The --global switch (-g) is currently required because only user wide tools are supported.</value>
|
||||
</data>
|
||||
<data name="InvalidToolConfiguration" xml:space="preserve">
|
||||
<value>The settings file in the tool's NuGet package is invalid: {0}</value>
|
||||
</data>
|
||||
|
@ -181,4 +178,13 @@ Tool '{1}' (version '{2}') was successfully installed.</value>
|
|||
<data name="InvalidNuGetVersionRange" xml:space="preserve">
|
||||
<value>Specified version '{0}' is not a valid NuGet version range.</value>
|
||||
</data>
|
||||
</root>
|
||||
<data name="InstallToolCommandNeedGlobalOrToolPath" xml:space="preserve">
|
||||
<value>Need either global or tool-path provided.</value>
|
||||
</data>
|
||||
<data name="InstallToolCommandInvalidGlobalAndToolPath" xml:space="preserve">
|
||||
<value>Cannot have global and tool-path as opinion at the same time.</value>
|
||||
</data>
|
||||
<data name="ToolPathDescription" xml:space="preserve">
|
||||
<value>Location of shim to access tool</value>
|
||||
</data>
|
||||
</root>
|
||||
|
|
|
@ -48,7 +48,7 @@ namespace Microsoft.DotNet.Tools.Install.Tool
|
|||
{
|
||||
"--runtime",
|
||||
AnyRid,
|
||||
$"/p:BaseIntermediateOutputPath={assetJsonOutput.ToQuotedString()}"
|
||||
$"/p:BaseIntermediateOutputPath={assetJsonOutput.ToXmlEncodeString()}"
|
||||
});
|
||||
|
||||
argsToPassToRestore.Add($"/verbosity:{verbosity ?? "quiet"}");
|
||||
|
|
|
@ -64,11 +64,6 @@ Instalace byla úspěšná. Pokud nejsou další pokyny, můžete přímo do já
|
|||
<target state="translated">Příkaz Instalovat rozhraní .NET</target>
|
||||
<note />
|
||||
</trans-unit>
|
||||
<trans-unit id="InstallToolCommandOnlySupportGlobal">
|
||||
<source>The --global switch (-g) is currently required because only user wide tools are supported.</source>
|
||||
<target state="translated">Přepínač --global (-g) se aktuálně vyžaduje, protože se podporují jenom nástroje pro všechny uživatele.</target>
|
||||
<note />
|
||||
</trans-unit>
|
||||
<trans-unit id="InvalidToolConfiguration">
|
||||
<source>The settings file in the tool's NuGet package is invalid: {0}</source>
|
||||
<target state="translated">Soubor nastavení v balíčku NuGet nástroje je neplatný: {0}.</target>
|
||||
|
@ -109,6 +104,21 @@ Instalace byla úspěšná. Pokud nejsou další pokyny, můžete přímo do já
|
|||
<target state="new">Specified version '{0}' is not a valid NuGet version range.</target>
|
||||
<note />
|
||||
</trans-unit>
|
||||
<trans-unit id="InstallToolCommandNeedGlobalOrToolPath">
|
||||
<source>Need either global or tool-path provided.</source>
|
||||
<target state="new">Need either global or tool-path provided.</target>
|
||||
<note />
|
||||
</trans-unit>
|
||||
<trans-unit id="InstallToolCommandInvalidGlobalAndToolPath">
|
||||
<source>Cannot have global and tool-path as opinion at the same time.</source>
|
||||
<target state="new">Cannot have global and tool-path as opinion at the same time.</target>
|
||||
<note />
|
||||
</trans-unit>
|
||||
<trans-unit id="ToolPathDescription">
|
||||
<source>Location of shim to access tool</source>
|
||||
<target state="new">Location of shim to access tool</target>
|
||||
<note />
|
||||
</trans-unit>
|
||||
</body>
|
||||
</file>
|
||||
</xliff>
|
|
@ -64,11 +64,6 @@ Die Installation war erfolgreich. Sofern keine weiteren Anweisungen vorliegen, k
|
|||
<target state="translated">.NET-Installationsbefehl</target>
|
||||
<note />
|
||||
</trans-unit>
|
||||
<trans-unit id="InstallToolCommandOnlySupportGlobal">
|
||||
<source>The --global switch (-g) is currently required because only user wide tools are supported.</source>
|
||||
<target state="translated">Die Option --global (-g) ist aktuell erforderlich, weil nur benutzerweite Tools unterstützt werden.</target>
|
||||
<note />
|
||||
</trans-unit>
|
||||
<trans-unit id="InvalidToolConfiguration">
|
||||
<source>The settings file in the tool's NuGet package is invalid: {0}</source>
|
||||
<target state="translated">Die Einstellungsdatei im NuGet-Paket des Tools ist ungültig: {0}</target>
|
||||
|
@ -109,6 +104,21 @@ Die Installation war erfolgreich. Sofern keine weiteren Anweisungen vorliegen, k
|
|||
<target state="new">Specified version '{0}' is not a valid NuGet version range.</target>
|
||||
<note />
|
||||
</trans-unit>
|
||||
<trans-unit id="InstallToolCommandNeedGlobalOrToolPath">
|
||||
<source>Need either global or tool-path provided.</source>
|
||||
<target state="new">Need either global or tool-path provided.</target>
|
||||
<note />
|
||||
</trans-unit>
|
||||
<trans-unit id="InstallToolCommandInvalidGlobalAndToolPath">
|
||||
<source>Cannot have global and tool-path as opinion at the same time.</source>
|
||||
<target state="new">Cannot have global and tool-path as opinion at the same time.</target>
|
||||
<note />
|
||||
</trans-unit>
|
||||
<trans-unit id="ToolPathDescription">
|
||||
<source>Location of shim to access tool</source>
|
||||
<target state="new">Location of shim to access tool</target>
|
||||
<note />
|
||||
</trans-unit>
|
||||
</body>
|
||||
</file>
|
||||
</xliff>
|
|
@ -64,11 +64,6 @@ La instalación se completó correctamente. Si no hay más instrucciones, puede
|
|||
<target state="translated">Comando para la instalación de .NET</target>
|
||||
<note />
|
||||
</trans-unit>
|
||||
<trans-unit id="InstallToolCommandOnlySupportGlobal">
|
||||
<source>The --global switch (-g) is currently required because only user wide tools are supported.</source>
|
||||
<target state="translated">El conmutador --global (g) se requiere actualmente porque solo se admiten herramientas para todos los usuarios.</target>
|
||||
<note />
|
||||
</trans-unit>
|
||||
<trans-unit id="InvalidToolConfiguration">
|
||||
<source>The settings file in the tool's NuGet package is invalid: {0}</source>
|
||||
<target state="translated">El archivo de configuración del paquete NuGet de la herramienta no es válido: {0}</target>
|
||||
|
@ -109,6 +104,21 @@ La instalación se completó correctamente. Si no hay más instrucciones, puede
|
|||
<target state="new">Specified version '{0}' is not a valid NuGet version range.</target>
|
||||
<note />
|
||||
</trans-unit>
|
||||
<trans-unit id="InstallToolCommandNeedGlobalOrToolPath">
|
||||
<source>Need either global or tool-path provided.</source>
|
||||
<target state="new">Need either global or tool-path provided.</target>
|
||||
<note />
|
||||
</trans-unit>
|
||||
<trans-unit id="InstallToolCommandInvalidGlobalAndToolPath">
|
||||
<source>Cannot have global and tool-path as opinion at the same time.</source>
|
||||
<target state="new">Cannot have global and tool-path as opinion at the same time.</target>
|
||||
<note />
|
||||
</trans-unit>
|
||||
<trans-unit id="ToolPathDescription">
|
||||
<source>Location of shim to access tool</source>
|
||||
<target state="new">Location of shim to access tool</target>
|
||||
<note />
|
||||
</trans-unit>
|
||||
</body>
|
||||
</file>
|
||||
</xliff>
|
|
@ -64,11 +64,6 @@ L'installation a réussi. En l'absence d'instructions supplémentaires, vous pou
|
|||
<target state="translated">Commande d'installation .NET</target>
|
||||
<note />
|
||||
</trans-unit>
|
||||
<trans-unit id="InstallToolCommandOnlySupportGlobal">
|
||||
<source>The --global switch (-g) is currently required because only user wide tools are supported.</source>
|
||||
<target state="translated">Le commutateur --global (-g) est obligatoire, car seuls les outils à l'échelle des utilisateurs sont pris en charge.</target>
|
||||
<note />
|
||||
</trans-unit>
|
||||
<trans-unit id="InvalidToolConfiguration">
|
||||
<source>The settings file in the tool's NuGet package is invalid: {0}</source>
|
||||
<target state="translated">Le fichier de paramètres dans le package NuGet de l'outil n'est pas valide : {0}</target>
|
||||
|
@ -109,6 +104,21 @@ L'installation a réussi. En l'absence d'instructions supplémentaires, vous pou
|
|||
<target state="new">Specified version '{0}' is not a valid NuGet version range.</target>
|
||||
<note />
|
||||
</trans-unit>
|
||||
<trans-unit id="InstallToolCommandNeedGlobalOrToolPath">
|
||||
<source>Need either global or tool-path provided.</source>
|
||||
<target state="new">Need either global or tool-path provided.</target>
|
||||
<note />
|
||||
</trans-unit>
|
||||
<trans-unit id="InstallToolCommandInvalidGlobalAndToolPath">
|
||||
<source>Cannot have global and tool-path as opinion at the same time.</source>
|
||||
<target state="new">Cannot have global and tool-path as opinion at the same time.</target>
|
||||
<note />
|
||||
</trans-unit>
|
||||
<trans-unit id="ToolPathDescription">
|
||||
<source>Location of shim to access tool</source>
|
||||
<target state="new">Location of shim to access tool</target>
|
||||
<note />
|
||||
</trans-unit>
|
||||
</body>
|
||||
</file>
|
||||
</xliff>
|
|
@ -64,11 +64,6 @@ L'installazione è riuscita. Se non ci sono altre istruzioni, è possibile digit
|
|||
<target state="translated">Comando di installazione .NET</target>
|
||||
<note />
|
||||
</trans-unit>
|
||||
<trans-unit id="InstallToolCommandOnlySupportGlobal">
|
||||
<source>The --global switch (-g) is currently required because only user wide tools are supported.</source>
|
||||
<target state="translated">L'opzione --global (-g) è attualmente obbligatoria perché sono supportati solo gli strumenti a livello di utente.</target>
|
||||
<note />
|
||||
</trans-unit>
|
||||
<trans-unit id="InvalidToolConfiguration">
|
||||
<source>The settings file in the tool's NuGet package is invalid: {0}</source>
|
||||
<target state="translated">Il file di impostazioni nel pacchetto NuGet dello strumento non è valido: {0}</target>
|
||||
|
@ -109,6 +104,21 @@ L'installazione è riuscita. Se non ci sono altre istruzioni, è possibile digit
|
|||
<target state="new">Specified version '{0}' is not a valid NuGet version range.</target>
|
||||
<note />
|
||||
</trans-unit>
|
||||
<trans-unit id="InstallToolCommandNeedGlobalOrToolPath">
|
||||
<source>Need either global or tool-path provided.</source>
|
||||
<target state="new">Need either global or tool-path provided.</target>
|
||||
<note />
|
||||
</trans-unit>
|
||||
<trans-unit id="InstallToolCommandInvalidGlobalAndToolPath">
|
||||
<source>Cannot have global and tool-path as opinion at the same time.</source>
|
||||
<target state="new">Cannot have global and tool-path as opinion at the same time.</target>
|
||||
<note />
|
||||
</trans-unit>
|
||||
<trans-unit id="ToolPathDescription">
|
||||
<source>Location of shim to access tool</source>
|
||||
<target state="new">Location of shim to access tool</target>
|
||||
<note />
|
||||
</trans-unit>
|
||||
</body>
|
||||
</file>
|
||||
</xliff>
|
|
@ -64,11 +64,6 @@ Tool '{1}' (version '{2}') was successfully installed.</source>
|
|||
<target state="translated">.NET インストール コマンド</target>
|
||||
<note />
|
||||
</trans-unit>
|
||||
<trans-unit id="InstallToolCommandOnlySupportGlobal">
|
||||
<source>The --global switch (-g) is currently required because only user wide tools are supported.</source>
|
||||
<target state="translated">サポートされているのはユーザー全体のツールだけなので、現在 --global スイッチ (-g) が必要です。</target>
|
||||
<note />
|
||||
</trans-unit>
|
||||
<trans-unit id="InvalidToolConfiguration">
|
||||
<source>The settings file in the tool's NuGet package is invalid: {0}</source>
|
||||
<target state="translated">ツールの NuGet パッケージ内の設定ファイルが無効です: {0}</target>
|
||||
|
@ -109,6 +104,21 @@ Tool '{1}' (version '{2}') was successfully installed.</source>
|
|||
<target state="new">Specified version '{0}' is not a valid NuGet version range.</target>
|
||||
<note />
|
||||
</trans-unit>
|
||||
<trans-unit id="InstallToolCommandNeedGlobalOrToolPath">
|
||||
<source>Need either global or tool-path provided.</source>
|
||||
<target state="new">Need either global or tool-path provided.</target>
|
||||
<note />
|
||||
</trans-unit>
|
||||
<trans-unit id="InstallToolCommandInvalidGlobalAndToolPath">
|
||||
<source>Cannot have global and tool-path as opinion at the same time.</source>
|
||||
<target state="new">Cannot have global and tool-path as opinion at the same time.</target>
|
||||
<note />
|
||||
</trans-unit>
|
||||
<trans-unit id="ToolPathDescription">
|
||||
<source>Location of shim to access tool</source>
|
||||
<target state="new">Location of shim to access tool</target>
|
||||
<note />
|
||||
</trans-unit>
|
||||
</body>
|
||||
</file>
|
||||
</xliff>
|
|
@ -64,11 +64,6 @@ Tool '{1}' (version '{2}') was successfully installed.</source>
|
|||
<target state="translated">.NET 설치 명령</target>
|
||||
<note />
|
||||
</trans-unit>
|
||||
<trans-unit id="InstallToolCommandOnlySupportGlobal">
|
||||
<source>The --global switch (-g) is currently required because only user wide tools are supported.</source>
|
||||
<target state="translated">사용자 전체 도구만 지원되므로 -global 스위치(-g)가 필요합니다.</target>
|
||||
<note />
|
||||
</trans-unit>
|
||||
<trans-unit id="InvalidToolConfiguration">
|
||||
<source>The settings file in the tool's NuGet package is invalid: {0}</source>
|
||||
<target state="translated">도구의 NuGet 패키지에 있는 설정 파일이 잘못되었습니다. {0}</target>
|
||||
|
@ -109,6 +104,21 @@ Tool '{1}' (version '{2}') was successfully installed.</source>
|
|||
<target state="new">Specified version '{0}' is not a valid NuGet version range.</target>
|
||||
<note />
|
||||
</trans-unit>
|
||||
<trans-unit id="InstallToolCommandNeedGlobalOrToolPath">
|
||||
<source>Need either global or tool-path provided.</source>
|
||||
<target state="new">Need either global or tool-path provided.</target>
|
||||
<note />
|
||||
</trans-unit>
|
||||
<trans-unit id="InstallToolCommandInvalidGlobalAndToolPath">
|
||||
<source>Cannot have global and tool-path as opinion at the same time.</source>
|
||||
<target state="new">Cannot have global and tool-path as opinion at the same time.</target>
|
||||
<note />
|
||||
</trans-unit>
|
||||
<trans-unit id="ToolPathDescription">
|
||||
<source>Location of shim to access tool</source>
|
||||
<target state="new">Location of shim to access tool</target>
|
||||
<note />
|
||||
</trans-unit>
|
||||
</body>
|
||||
</file>
|
||||
</xliff>
|
|
@ -64,11 +64,6 @@ Instalacja powiodła się. Jeśli nie ma dodatkowych instrukcji, możesz wpisać
|
|||
<target state="translated">Polecenie instalacji platformy .NET</target>
|
||||
<note />
|
||||
</trans-unit>
|
||||
<trans-unit id="InstallToolCommandOnlySupportGlobal">
|
||||
<source>The --global switch (-g) is currently required because only user wide tools are supported.</source>
|
||||
<target state="translated">Obecnie jest wymagany przełącznik --global (-g), ponieważ obsługiwane są tylko narzędzia użytkownika.</target>
|
||||
<note />
|
||||
</trans-unit>
|
||||
<trans-unit id="InvalidToolConfiguration">
|
||||
<source>The settings file in the tool's NuGet package is invalid: {0}</source>
|
||||
<target state="translated">Plik ustawień w pakiecie NuGet narzędzia jest nieprawidłowy: {0}</target>
|
||||
|
@ -109,6 +104,21 @@ Instalacja powiodła się. Jeśli nie ma dodatkowych instrukcji, możesz wpisać
|
|||
<target state="new">Specified version '{0}' is not a valid NuGet version range.</target>
|
||||
<note />
|
||||
</trans-unit>
|
||||
<trans-unit id="InstallToolCommandNeedGlobalOrToolPath">
|
||||
<source>Need either global or tool-path provided.</source>
|
||||
<target state="new">Need either global or tool-path provided.</target>
|
||||
<note />
|
||||
</trans-unit>
|
||||
<trans-unit id="InstallToolCommandInvalidGlobalAndToolPath">
|
||||
<source>Cannot have global and tool-path as opinion at the same time.</source>
|
||||
<target state="new">Cannot have global and tool-path as opinion at the same time.</target>
|
||||
<note />
|
||||
</trans-unit>
|
||||
<trans-unit id="ToolPathDescription">
|
||||
<source>Location of shim to access tool</source>
|
||||
<target state="new">Location of shim to access tool</target>
|
||||
<note />
|
||||
</trans-unit>
|
||||
</body>
|
||||
</file>
|
||||
</xliff>
|
|
@ -64,11 +64,6 @@ A instalação foi bem-sucedida. Se não houver outras instruções, digite o se
|
|||
<target state="translated">Comando de instalação do .NET</target>
|
||||
<note />
|
||||
</trans-unit>
|
||||
<trans-unit id="InstallToolCommandOnlySupportGlobal">
|
||||
<source>The --global switch (-g) is currently required because only user wide tools are supported.</source>
|
||||
<target state="translated">A opção --global (-g) é obrigatória, pois somente ferramentas para todo o usuário são compatíveis.</target>
|
||||
<note />
|
||||
</trans-unit>
|
||||
<trans-unit id="InvalidToolConfiguration">
|
||||
<source>The settings file in the tool's NuGet package is invalid: {0}</source>
|
||||
<target state="translated">O arquivo de configurações no pacote NuGet da ferramenta é inválido: {0}</target>
|
||||
|
@ -109,6 +104,21 @@ A instalação foi bem-sucedida. Se não houver outras instruções, digite o se
|
|||
<target state="new">Specified version '{0}' is not a valid NuGet version range.</target>
|
||||
<note />
|
||||
</trans-unit>
|
||||
<trans-unit id="InstallToolCommandNeedGlobalOrToolPath">
|
||||
<source>Need either global or tool-path provided.</source>
|
||||
<target state="new">Need either global or tool-path provided.</target>
|
||||
<note />
|
||||
</trans-unit>
|
||||
<trans-unit id="InstallToolCommandInvalidGlobalAndToolPath">
|
||||
<source>Cannot have global and tool-path as opinion at the same time.</source>
|
||||
<target state="new">Cannot have global and tool-path as opinion at the same time.</target>
|
||||
<note />
|
||||
</trans-unit>
|
||||
<trans-unit id="ToolPathDescription">
|
||||
<source>Location of shim to access tool</source>
|
||||
<target state="new">Location of shim to access tool</target>
|
||||
<note />
|
||||
</trans-unit>
|
||||
</body>
|
||||
</file>
|
||||
</xliff>
|
|
@ -64,11 +64,6 @@ Tool '{1}' (version '{2}') was successfully installed.</source>
|
|||
<target state="translated">Команда установки .NET</target>
|
||||
<note />
|
||||
</trans-unit>
|
||||
<trans-unit id="InstallToolCommandOnlySupportGlobal">
|
||||
<source>The --global switch (-g) is currently required because only user wide tools are supported.</source>
|
||||
<target state="translated">Параметр "--global switch (-g)" сейчас обязателен, так как поддерживаются только инструменты уровня пользователя.</target>
|
||||
<note />
|
||||
</trans-unit>
|
||||
<trans-unit id="InvalidToolConfiguration">
|
||||
<source>The settings file in the tool's NuGet package is invalid: {0}</source>
|
||||
<target state="translated">Недопустимый файл параметров в пакете NuGet инструмента: {0}</target>
|
||||
|
@ -109,6 +104,21 @@ Tool '{1}' (version '{2}') was successfully installed.</source>
|
|||
<target state="new">Specified version '{0}' is not a valid NuGet version range.</target>
|
||||
<note />
|
||||
</trans-unit>
|
||||
<trans-unit id="InstallToolCommandNeedGlobalOrToolPath">
|
||||
<source>Need either global or tool-path provided.</source>
|
||||
<target state="new">Need either global or tool-path provided.</target>
|
||||
<note />
|
||||
</trans-unit>
|
||||
<trans-unit id="InstallToolCommandInvalidGlobalAndToolPath">
|
||||
<source>Cannot have global and tool-path as opinion at the same time.</source>
|
||||
<target state="new">Cannot have global and tool-path as opinion at the same time.</target>
|
||||
<note />
|
||||
</trans-unit>
|
||||
<trans-unit id="ToolPathDescription">
|
||||
<source>Location of shim to access tool</source>
|
||||
<target state="new">Location of shim to access tool</target>
|
||||
<note />
|
||||
</trans-unit>
|
||||
</body>
|
||||
</file>
|
||||
</xliff>
|
|
@ -64,11 +64,6 @@ Yükleme başarılı oldu. Daha fazla yönerge yoksa, çağırmak için şu komu
|
|||
<target state="translated">.NET Yükleme Komutu</target>
|
||||
<note />
|
||||
</trans-unit>
|
||||
<trans-unit id="InstallToolCommandOnlySupportGlobal">
|
||||
<source>The --global switch (-g) is currently required because only user wide tools are supported.</source>
|
||||
<target state="translated">Yalnızca kullanıcı için araçlar desteklendiğinden --global anahtarı (-g) şu anda gereklidir.</target>
|
||||
<note />
|
||||
</trans-unit>
|
||||
<trans-unit id="InvalidToolConfiguration">
|
||||
<source>The settings file in the tool's NuGet package is invalid: {0}</source>
|
||||
<target state="translated">Aracın NuGet paketindeki ayar dosyası geçersiz: {0}</target>
|
||||
|
@ -109,6 +104,21 @@ Yükleme başarılı oldu. Daha fazla yönerge yoksa, çağırmak için şu komu
|
|||
<target state="new">Specified version '{0}' is not a valid NuGet version range.</target>
|
||||
<note />
|
||||
</trans-unit>
|
||||
<trans-unit id="InstallToolCommandNeedGlobalOrToolPath">
|
||||
<source>Need either global or tool-path provided.</source>
|
||||
<target state="new">Need either global or tool-path provided.</target>
|
||||
<note />
|
||||
</trans-unit>
|
||||
<trans-unit id="InstallToolCommandInvalidGlobalAndToolPath">
|
||||
<source>Cannot have global and tool-path as opinion at the same time.</source>
|
||||
<target state="new">Cannot have global and tool-path as opinion at the same time.</target>
|
||||
<note />
|
||||
</trans-unit>
|
||||
<trans-unit id="ToolPathDescription">
|
||||
<source>Location of shim to access tool</source>
|
||||
<target state="new">Location of shim to access tool</target>
|
||||
<note />
|
||||
</trans-unit>
|
||||
</body>
|
||||
</file>
|
||||
</xliff>
|
|
@ -64,11 +64,6 @@ Tool '{1}' (version '{2}') was successfully installed.</source>
|
|||
<target state="translated">.NET 安装命令</target>
|
||||
<note />
|
||||
</trans-unit>
|
||||
<trans-unit id="InstallToolCommandOnlySupportGlobal">
|
||||
<source>The --global switch (-g) is currently required because only user wide tools are supported.</source>
|
||||
<target state="translated">目前需要 --global 开关 (-g),因为仅支持用户范围工具。</target>
|
||||
<note />
|
||||
</trans-unit>
|
||||
<trans-unit id="InvalidToolConfiguration">
|
||||
<source>The settings file in the tool's NuGet package is invalid: {0}</source>
|
||||
<target state="translated">工具的 NuGet 包中的设置文件无效: {0}</target>
|
||||
|
@ -109,6 +104,21 @@ Tool '{1}' (version '{2}') was successfully installed.</source>
|
|||
<target state="new">Specified version '{0}' is not a valid NuGet version range.</target>
|
||||
<note />
|
||||
</trans-unit>
|
||||
<trans-unit id="InstallToolCommandNeedGlobalOrToolPath">
|
||||
<source>Need either global or tool-path provided.</source>
|
||||
<target state="new">Need either global or tool-path provided.</target>
|
||||
<note />
|
||||
</trans-unit>
|
||||
<trans-unit id="InstallToolCommandInvalidGlobalAndToolPath">
|
||||
<source>Cannot have global and tool-path as opinion at the same time.</source>
|
||||
<target state="new">Cannot have global and tool-path as opinion at the same time.</target>
|
||||
<note />
|
||||
</trans-unit>
|
||||
<trans-unit id="ToolPathDescription">
|
||||
<source>Location of shim to access tool</source>
|
||||
<target state="new">Location of shim to access tool</target>
|
||||
<note />
|
||||
</trans-unit>
|
||||
</body>
|
||||
</file>
|
||||
</xliff>
|
|
@ -64,11 +64,6 @@ Tool '{1}' (version '{2}') was successfully installed.</source>
|
|||
<target state="translated">.NET 安裝命令</target>
|
||||
<note />
|
||||
</trans-unit>
|
||||
<trans-unit id="InstallToolCommandOnlySupportGlobal">
|
||||
<source>The --global switch (-g) is currently required because only user wide tools are supported.</source>
|
||||
<target state="translated">因為只支援適用於全體使用者的工具,所以目前必須有 --global 參數 (-g)。</target>
|
||||
<note />
|
||||
</trans-unit>
|
||||
<trans-unit id="InvalidToolConfiguration">
|
||||
<source>The settings file in the tool's NuGet package is invalid: {0}</source>
|
||||
<target state="translated">工具之 NuGet 套件中的設定檔案無效: {0}</target>
|
||||
|
@ -109,6 +104,21 @@ Tool '{1}' (version '{2}') was successfully installed.</source>
|
|||
<target state="new">Specified version '{0}' is not a valid NuGet version range.</target>
|
||||
<note />
|
||||
</trans-unit>
|
||||
<trans-unit id="InstallToolCommandNeedGlobalOrToolPath">
|
||||
<source>Need either global or tool-path provided.</source>
|
||||
<target state="new">Need either global or tool-path provided.</target>
|
||||
<note />
|
||||
</trans-unit>
|
||||
<trans-unit id="InstallToolCommandInvalidGlobalAndToolPath">
|
||||
<source>Cannot have global and tool-path as opinion at the same time.</source>
|
||||
<target state="new">Cannot have global and tool-path as opinion at the same time.</target>
|
||||
<note />
|
||||
</trans-unit>
|
||||
<trans-unit id="ToolPathDescription">
|
||||
<source>Location of shim to access tool</source>
|
||||
<target state="new">Location of shim to access tool</target>
|
||||
<note />
|
||||
</trans-unit>
|
||||
</body>
|
||||
</file>
|
||||
</xliff>
|
|
@ -132,9 +132,6 @@
|
|||
<data name="GlobalOptionDescription" xml:space="preserve">
|
||||
<value>Uninstall user wide.</value>
|
||||
</data>
|
||||
<data name="UninstallToolCommandOnlySupportsGlobal" xml:space="preserve">
|
||||
<value>The --global switch (-g) is currently required because only user wide tools are supported.</value>
|
||||
</data>
|
||||
<data name="UninstallSucceeded" xml:space="preserve">
|
||||
<value>Tool '{0}' (version '{1}') was successfully uninstalled.</value>
|
||||
</data>
|
||||
|
@ -147,4 +144,13 @@
|
|||
<data name="FailedToUninstallTool" xml:space="preserve">
|
||||
<value>Failed to uninstall tool '{0}': {1}</value>
|
||||
</data>
|
||||
<data name="UninstallToolCommandNeedGlobalOrToolPath" xml:space="preserve">
|
||||
<value>Need either global or tool-path provided.</value>
|
||||
</data>
|
||||
<data name="ToolPathDescription" xml:space="preserve">
|
||||
<value>Location of shim to access tool</value>
|
||||
</data>
|
||||
<data name="UninstallToolCommandInvalidGlobalAndToolPath" xml:space="preserve">
|
||||
<value>Cannot have global and tool-path as opinion at the same time."</value>
|
||||
</data>
|
||||
</root>
|
|
@ -15,45 +15,63 @@ using Microsoft.Extensions.EnvironmentAbstractions;
|
|||
|
||||
namespace Microsoft.DotNet.Tools.Uninstall.Tool
|
||||
{
|
||||
internal delegate IShellShimRepository CreateShellShimRepository(DirectoryPath? nonGlobalLocation = null);
|
||||
internal delegate IToolPackageStore CreateToolPackageStore(DirectoryPath? nonGlobalLocation = null);
|
||||
internal class UninstallToolCommand : CommandBase
|
||||
{
|
||||
private readonly AppliedOption _options;
|
||||
private readonly IToolPackageStore _toolPackageStore;
|
||||
private readonly IShellShimRepository _shellShimRepository;
|
||||
private readonly IReporter _reporter;
|
||||
private readonly IReporter _errorReporter;
|
||||
private CreateShellShimRepository _createShellShimRepository;
|
||||
private CreateToolPackageStore _createToolPackageStoreAndInstaller;
|
||||
|
||||
public UninstallToolCommand(
|
||||
AppliedOption options,
|
||||
ParseResult result,
|
||||
IToolPackageStore toolPackageStore = null,
|
||||
IShellShimRepository shellShimRepository = null,
|
||||
CreateToolPackageStore createToolPackageStoreAndInstaller = null,
|
||||
CreateShellShimRepository createShellShimRepository = null,
|
||||
IReporter reporter = null)
|
||||
: base(result)
|
||||
{
|
||||
var pathCalculator = new CliFolderPathCalculator();
|
||||
|
||||
_options = options ?? throw new ArgumentNullException(nameof(options));
|
||||
_toolPackageStore = toolPackageStore ?? new ToolPackageStore(
|
||||
new DirectoryPath(pathCalculator.ToolsPackagePath));
|
||||
_shellShimRepository = shellShimRepository ?? new ShellShimRepository(
|
||||
new DirectoryPath(pathCalculator.ToolsShimPath));
|
||||
_reporter = reporter ?? Reporter.Output;
|
||||
_errorReporter = reporter ?? Reporter.Error;
|
||||
|
||||
_createShellShimRepository = createShellShimRepository ?? ShellShimRepositoryFactory.CreateShellShimRepository;
|
||||
_createToolPackageStoreAndInstaller = createToolPackageStoreAndInstaller ?? ToolPackageFactory.CreateToolPackageStore;
|
||||
}
|
||||
|
||||
public override int Execute()
|
||||
{
|
||||
if (!_options.ValueOrDefault<bool>("global"))
|
||||
var global = _options.ValueOrDefault<bool>("global");
|
||||
var toolPath = _options.SingleArgumentOrDefault("tool-path");
|
||||
|
||||
if (string.IsNullOrWhiteSpace(toolPath) && !global)
|
||||
{
|
||||
throw new GracefulException(LocalizableStrings.UninstallToolCommandOnlySupportsGlobal);
|
||||
throw new GracefulException(LocalizableStrings.UninstallToolCommandNeedGlobalOrToolPath);
|
||||
}
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(toolPath) && global)
|
||||
{
|
||||
throw new GracefulException(LocalizableStrings.UninstallToolCommandInvalidGlobalAndToolPath);
|
||||
}
|
||||
|
||||
DirectoryPath? toolDirectoryPath = null;
|
||||
if (!string.IsNullOrWhiteSpace(toolPath))
|
||||
{
|
||||
toolDirectoryPath = new DirectoryPath(toolPath);
|
||||
}
|
||||
|
||||
IToolPackageStore toolPackageStore = _createToolPackageStoreAndInstaller(toolDirectoryPath);
|
||||
IShellShimRepository shellShimRepository = _createShellShimRepository(toolDirectoryPath);
|
||||
|
||||
var packageId = new PackageId(_options.Arguments.Single());
|
||||
IToolPackage package = null;
|
||||
try
|
||||
{
|
||||
package = _toolPackageStore.EnumeratePackageVersions(packageId).SingleOrDefault();
|
||||
package = toolPackageStore.EnumeratePackageVersions(packageId).SingleOrDefault();
|
||||
if (package == null)
|
||||
{
|
||||
_errorReporter.WriteLine(
|
||||
|
@ -80,7 +98,7 @@ namespace Microsoft.DotNet.Tools.Uninstall.Tool
|
|||
{
|
||||
foreach (var command in package.Commands)
|
||||
{
|
||||
_shellShimRepository.RemoveShim(command.Name);
|
||||
shellShimRepository.RemoveShim(command.Name);
|
||||
}
|
||||
|
||||
package.Uninstall();
|
||||
|
|
|
@ -19,6 +19,10 @@ namespace Microsoft.DotNet.Cli
|
|||
"-g|--global",
|
||||
LocalizableStrings.GlobalOptionDescription,
|
||||
Accept.NoArguments()),
|
||||
Create.Option(
|
||||
"--tool-path",
|
||||
LocalizableStrings.ToolPathDescription,
|
||||
Accept.ExactlyOneArgument()),
|
||||
CommonOptions.HelpOption());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -27,11 +27,6 @@
|
|||
<target state="new">Uninstall user wide.</target>
|
||||
<note />
|
||||
</trans-unit>
|
||||
<trans-unit id="UninstallToolCommandOnlySupportsGlobal">
|
||||
<source>The --global switch (-g) is currently required because only user wide tools are supported.</source>
|
||||
<target state="new">The --global switch (-g) is currently required because only user wide tools are supported.</target>
|
||||
<note />
|
||||
</trans-unit>
|
||||
<trans-unit id="UninstallSucceeded">
|
||||
<source>Tool '{0}' (version '{1}') was successfully uninstalled.</source>
|
||||
<target state="new">Tool '{0}' (version '{1}') was successfully uninstalled.</target>
|
||||
|
@ -52,6 +47,21 @@
|
|||
<target state="new">Failed to uninstall tool '{0}': {1}</target>
|
||||
<note />
|
||||
</trans-unit>
|
||||
<trans-unit id="UninstallToolCommandNeedGlobalOrToolPath">
|
||||
<source>Need either global or tool-path provided.</source>
|
||||
<target state="new">Need either global or tool-path provided.</target>
|
||||
<note />
|
||||
</trans-unit>
|
||||
<trans-unit id="ToolPathDescription">
|
||||
<source>Location of shim to access tool</source>
|
||||
<target state="new">Location of shim to access tool</target>
|
||||
<note />
|
||||
</trans-unit>
|
||||
<trans-unit id="UninstallToolCommandInvalidGlobalAndToolPath">
|
||||
<source>Cannot have global and tool-path as opinion at the same time."</source>
|
||||
<target state="new">Cannot have global and tool-path as opinion at the same time."</target>
|
||||
<note />
|
||||
</trans-unit>
|
||||
</body>
|
||||
</file>
|
||||
</xliff>
|
|
@ -27,11 +27,6 @@
|
|||
<target state="new">Uninstall user wide.</target>
|
||||
<note />
|
||||
</trans-unit>
|
||||
<trans-unit id="UninstallToolCommandOnlySupportsGlobal">
|
||||
<source>The --global switch (-g) is currently required because only user wide tools are supported.</source>
|
||||
<target state="new">The --global switch (-g) is currently required because only user wide tools are supported.</target>
|
||||
<note />
|
||||
</trans-unit>
|
||||
<trans-unit id="UninstallSucceeded">
|
||||
<source>Tool '{0}' (version '{1}') was successfully uninstalled.</source>
|
||||
<target state="new">Tool '{0}' (version '{1}') was successfully uninstalled.</target>
|
||||
|
@ -52,6 +47,21 @@
|
|||
<target state="new">Failed to uninstall tool '{0}': {1}</target>
|
||||
<note />
|
||||
</trans-unit>
|
||||
<trans-unit id="UninstallToolCommandNeedGlobalOrToolPath">
|
||||
<source>Need either global or tool-path provided.</source>
|
||||
<target state="new">Need either global or tool-path provided.</target>
|
||||
<note />
|
||||
</trans-unit>
|
||||
<trans-unit id="ToolPathDescription">
|
||||
<source>Location of shim to access tool</source>
|
||||
<target state="new">Location of shim to access tool</target>
|
||||
<note />
|
||||
</trans-unit>
|
||||
<trans-unit id="UninstallToolCommandInvalidGlobalAndToolPath">
|
||||
<source>Cannot have global and tool-path as opinion at the same time."</source>
|
||||
<target state="new">Cannot have global and tool-path as opinion at the same time."</target>
|
||||
<note />
|
||||
</trans-unit>
|
||||
</body>
|
||||
</file>
|
||||
</xliff>
|
|
@ -27,11 +27,6 @@
|
|||
<target state="new">Uninstall user wide.</target>
|
||||
<note />
|
||||
</trans-unit>
|
||||
<trans-unit id="UninstallToolCommandOnlySupportsGlobal">
|
||||
<source>The --global switch (-g) is currently required because only user wide tools are supported.</source>
|
||||
<target state="new">The --global switch (-g) is currently required because only user wide tools are supported.</target>
|
||||
<note />
|
||||
</trans-unit>
|
||||
<trans-unit id="UninstallSucceeded">
|
||||
<source>Tool '{0}' (version '{1}') was successfully uninstalled.</source>
|
||||
<target state="new">Tool '{0}' (version '{1}') was successfully uninstalled.</target>
|
||||
|
@ -52,6 +47,21 @@
|
|||
<target state="new">Failed to uninstall tool '{0}': {1}</target>
|
||||
<note />
|
||||
</trans-unit>
|
||||
<trans-unit id="UninstallToolCommandNeedGlobalOrToolPath">
|
||||
<source>Need either global or tool-path provided.</source>
|
||||
<target state="new">Need either global or tool-path provided.</target>
|
||||
<note />
|
||||
</trans-unit>
|
||||
<trans-unit id="ToolPathDescription">
|
||||
<source>Location of shim to access tool</source>
|
||||
<target state="new">Location of shim to access tool</target>
|
||||
<note />
|
||||
</trans-unit>
|
||||
<trans-unit id="UninstallToolCommandInvalidGlobalAndToolPath">
|
||||
<source>Cannot have global and tool-path as opinion at the same time."</source>
|
||||
<target state="new">Cannot have global and tool-path as opinion at the same time."</target>
|
||||
<note />
|
||||
</trans-unit>
|
||||
</body>
|
||||
</file>
|
||||
</xliff>
|
|
@ -27,11 +27,6 @@
|
|||
<target state="new">Uninstall user wide.</target>
|
||||
<note />
|
||||
</trans-unit>
|
||||
<trans-unit id="UninstallToolCommandOnlySupportsGlobal">
|
||||
<source>The --global switch (-g) is currently required because only user wide tools are supported.</source>
|
||||
<target state="new">The --global switch (-g) is currently required because only user wide tools are supported.</target>
|
||||
<note />
|
||||
</trans-unit>
|
||||
<trans-unit id="UninstallSucceeded">
|
||||
<source>Tool '{0}' (version '{1}') was successfully uninstalled.</source>
|
||||
<target state="new">Tool '{0}' (version '{1}') was successfully uninstalled.</target>
|
||||
|
@ -52,6 +47,21 @@
|
|||
<target state="new">Failed to uninstall tool '{0}': {1}</target>
|
||||
<note />
|
||||
</trans-unit>
|
||||
<trans-unit id="UninstallToolCommandNeedGlobalOrToolPath">
|
||||
<source>Need either global or tool-path provided.</source>
|
||||
<target state="new">Need either global or tool-path provided.</target>
|
||||
<note />
|
||||
</trans-unit>
|
||||
<trans-unit id="ToolPathDescription">
|
||||
<source>Location of shim to access tool</source>
|
||||
<target state="new">Location of shim to access tool</target>
|
||||
<note />
|
||||
</trans-unit>
|
||||
<trans-unit id="UninstallToolCommandInvalidGlobalAndToolPath">
|
||||
<source>Cannot have global and tool-path as opinion at the same time."</source>
|
||||
<target state="new">Cannot have global and tool-path as opinion at the same time."</target>
|
||||
<note />
|
||||
</trans-unit>
|
||||
</body>
|
||||
</file>
|
||||
</xliff>
|
|
@ -27,11 +27,6 @@
|
|||
<target state="new">Uninstall user wide.</target>
|
||||
<note />
|
||||
</trans-unit>
|
||||
<trans-unit id="UninstallToolCommandOnlySupportsGlobal">
|
||||
<source>The --global switch (-g) is currently required because only user wide tools are supported.</source>
|
||||
<target state="new">The --global switch (-g) is currently required because only user wide tools are supported.</target>
|
||||
<note />
|
||||
</trans-unit>
|
||||
<trans-unit id="UninstallSucceeded">
|
||||
<source>Tool '{0}' (version '{1}') was successfully uninstalled.</source>
|
||||
<target state="new">Tool '{0}' (version '{1}') was successfully uninstalled.</target>
|
||||
|
@ -52,6 +47,21 @@
|
|||
<target state="new">Failed to uninstall tool '{0}': {1}</target>
|
||||
<note />
|
||||
</trans-unit>
|
||||
<trans-unit id="UninstallToolCommandNeedGlobalOrToolPath">
|
||||
<source>Need either global or tool-path provided.</source>
|
||||
<target state="new">Need either global or tool-path provided.</target>
|
||||
<note />
|
||||
</trans-unit>
|
||||
<trans-unit id="ToolPathDescription">
|
||||
<source>Location of shim to access tool</source>
|
||||
<target state="new">Location of shim to access tool</target>
|
||||
<note />
|
||||
</trans-unit>
|
||||
<trans-unit id="UninstallToolCommandInvalidGlobalAndToolPath">
|
||||
<source>Cannot have global and tool-path as opinion at the same time."</source>
|
||||
<target state="new">Cannot have global and tool-path as opinion at the same time."</target>
|
||||
<note />
|
||||
</trans-unit>
|
||||
</body>
|
||||
</file>
|
||||
</xliff>
|
|
@ -27,11 +27,6 @@
|
|||
<target state="new">Uninstall user wide.</target>
|
||||
<note />
|
||||
</trans-unit>
|
||||
<trans-unit id="UninstallToolCommandOnlySupportsGlobal">
|
||||
<source>The --global switch (-g) is currently required because only user wide tools are supported.</source>
|
||||
<target state="new">The --global switch (-g) is currently required because only user wide tools are supported.</target>
|
||||
<note />
|
||||
</trans-unit>
|
||||
<trans-unit id="UninstallSucceeded">
|
||||
<source>Tool '{0}' (version '{1}') was successfully uninstalled.</source>
|
||||
<target state="new">Tool '{0}' (version '{1}') was successfully uninstalled.</target>
|
||||
|
@ -52,6 +47,21 @@
|
|||
<target state="new">Failed to uninstall tool '{0}': {1}</target>
|
||||
<note />
|
||||
</trans-unit>
|
||||
<trans-unit id="UninstallToolCommandNeedGlobalOrToolPath">
|
||||
<source>Need either global or tool-path provided.</source>
|
||||
<target state="new">Need either global or tool-path provided.</target>
|
||||
<note />
|
||||
</trans-unit>
|
||||
<trans-unit id="ToolPathDescription">
|
||||
<source>Location of shim to access tool</source>
|
||||
<target state="new">Location of shim to access tool</target>
|
||||
<note />
|
||||
</trans-unit>
|
||||
<trans-unit id="UninstallToolCommandInvalidGlobalAndToolPath">
|
||||
<source>Cannot have global and tool-path as opinion at the same time."</source>
|
||||
<target state="new">Cannot have global and tool-path as opinion at the same time."</target>
|
||||
<note />
|
||||
</trans-unit>
|
||||
</body>
|
||||
</file>
|
||||
</xliff>
|
|
@ -27,11 +27,6 @@
|
|||
<target state="new">Uninstall user wide.</target>
|
||||
<note />
|
||||
</trans-unit>
|
||||
<trans-unit id="UninstallToolCommandOnlySupportsGlobal">
|
||||
<source>The --global switch (-g) is currently required because only user wide tools are supported.</source>
|
||||
<target state="new">The --global switch (-g) is currently required because only user wide tools are supported.</target>
|
||||
<note />
|
||||
</trans-unit>
|
||||
<trans-unit id="UninstallSucceeded">
|
||||
<source>Tool '{0}' (version '{1}') was successfully uninstalled.</source>
|
||||
<target state="new">Tool '{0}' (version '{1}') was successfully uninstalled.</target>
|
||||
|
@ -52,6 +47,21 @@
|
|||
<target state="new">Failed to uninstall tool '{0}': {1}</target>
|
||||
<note />
|
||||
</trans-unit>
|
||||
<trans-unit id="UninstallToolCommandNeedGlobalOrToolPath">
|
||||
<source>Need either global or tool-path provided.</source>
|
||||
<target state="new">Need either global or tool-path provided.</target>
|
||||
<note />
|
||||
</trans-unit>
|
||||
<trans-unit id="ToolPathDescription">
|
||||
<source>Location of shim to access tool</source>
|
||||
<target state="new">Location of shim to access tool</target>
|
||||
<note />
|
||||
</trans-unit>
|
||||
<trans-unit id="UninstallToolCommandInvalidGlobalAndToolPath">
|
||||
<source>Cannot have global and tool-path as opinion at the same time."</source>
|
||||
<target state="new">Cannot have global and tool-path as opinion at the same time."</target>
|
||||
<note />
|
||||
</trans-unit>
|
||||
</body>
|
||||
</file>
|
||||
</xliff>
|
|
@ -27,11 +27,6 @@
|
|||
<target state="new">Uninstall user wide.</target>
|
||||
<note />
|
||||
</trans-unit>
|
||||
<trans-unit id="UninstallToolCommandOnlySupportsGlobal">
|
||||
<source>The --global switch (-g) is currently required because only user wide tools are supported.</source>
|
||||
<target state="new">The --global switch (-g) is currently required because only user wide tools are supported.</target>
|
||||
<note />
|
||||
</trans-unit>
|
||||
<trans-unit id="UninstallSucceeded">
|
||||
<source>Tool '{0}' (version '{1}') was successfully uninstalled.</source>
|
||||
<target state="new">Tool '{0}' (version '{1}') was successfully uninstalled.</target>
|
||||
|
@ -52,6 +47,21 @@
|
|||
<target state="new">Failed to uninstall tool '{0}': {1}</target>
|
||||
<note />
|
||||
</trans-unit>
|
||||
<trans-unit id="UninstallToolCommandNeedGlobalOrToolPath">
|
||||
<source>Need either global or tool-path provided.</source>
|
||||
<target state="new">Need either global or tool-path provided.</target>
|
||||
<note />
|
||||
</trans-unit>
|
||||
<trans-unit id="ToolPathDescription">
|
||||
<source>Location of shim to access tool</source>
|
||||
<target state="new">Location of shim to access tool</target>
|
||||
<note />
|
||||
</trans-unit>
|
||||
<trans-unit id="UninstallToolCommandInvalidGlobalAndToolPath">
|
||||
<source>Cannot have global and tool-path as opinion at the same time."</source>
|
||||
<target state="new">Cannot have global and tool-path as opinion at the same time."</target>
|
||||
<note />
|
||||
</trans-unit>
|
||||
</body>
|
||||
</file>
|
||||
</xliff>
|
|
@ -27,11 +27,6 @@
|
|||
<target state="new">Uninstall user wide.</target>
|
||||
<note />
|
||||
</trans-unit>
|
||||
<trans-unit id="UninstallToolCommandOnlySupportsGlobal">
|
||||
<source>The --global switch (-g) is currently required because only user wide tools are supported.</source>
|
||||
<target state="new">The --global switch (-g) is currently required because only user wide tools are supported.</target>
|
||||
<note />
|
||||
</trans-unit>
|
||||
<trans-unit id="UninstallSucceeded">
|
||||
<source>Tool '{0}' (version '{1}') was successfully uninstalled.</source>
|
||||
<target state="new">Tool '{0}' (version '{1}') was successfully uninstalled.</target>
|
||||
|
@ -52,6 +47,21 @@
|
|||
<target state="new">Failed to uninstall tool '{0}': {1}</target>
|
||||
<note />
|
||||
</trans-unit>
|
||||
<trans-unit id="UninstallToolCommandNeedGlobalOrToolPath">
|
||||
<source>Need either global or tool-path provided.</source>
|
||||
<target state="new">Need either global or tool-path provided.</target>
|
||||
<note />
|
||||
</trans-unit>
|
||||
<trans-unit id="ToolPathDescription">
|
||||
<source>Location of shim to access tool</source>
|
||||
<target state="new">Location of shim to access tool</target>
|
||||
<note />
|
||||
</trans-unit>
|
||||
<trans-unit id="UninstallToolCommandInvalidGlobalAndToolPath">
|
||||
<source>Cannot have global and tool-path as opinion at the same time."</source>
|
||||
<target state="new">Cannot have global and tool-path as opinion at the same time."</target>
|
||||
<note />
|
||||
</trans-unit>
|
||||
</body>
|
||||
</file>
|
||||
</xliff>
|
|
@ -27,11 +27,6 @@
|
|||
<target state="new">Uninstall user wide.</target>
|
||||
<note />
|
||||
</trans-unit>
|
||||
<trans-unit id="UninstallToolCommandOnlySupportsGlobal">
|
||||
<source>The --global switch (-g) is currently required because only user wide tools are supported.</source>
|
||||
<target state="new">The --global switch (-g) is currently required because only user wide tools are supported.</target>
|
||||
<note />
|
||||
</trans-unit>
|
||||
<trans-unit id="UninstallSucceeded">
|
||||
<source>Tool '{0}' (version '{1}') was successfully uninstalled.</source>
|
||||
<target state="new">Tool '{0}' (version '{1}') was successfully uninstalled.</target>
|
||||
|
@ -52,6 +47,21 @@
|
|||
<target state="new">Failed to uninstall tool '{0}': {1}</target>
|
||||
<note />
|
||||
</trans-unit>
|
||||
<trans-unit id="UninstallToolCommandNeedGlobalOrToolPath">
|
||||
<source>Need either global or tool-path provided.</source>
|
||||
<target state="new">Need either global or tool-path provided.</target>
|
||||
<note />
|
||||
</trans-unit>
|
||||
<trans-unit id="ToolPathDescription">
|
||||
<source>Location of shim to access tool</source>
|
||||
<target state="new">Location of shim to access tool</target>
|
||||
<note />
|
||||
</trans-unit>
|
||||
<trans-unit id="UninstallToolCommandInvalidGlobalAndToolPath">
|
||||
<source>Cannot have global and tool-path as opinion at the same time."</source>
|
||||
<target state="new">Cannot have global and tool-path as opinion at the same time."</target>
|
||||
<note />
|
||||
</trans-unit>
|
||||
</body>
|
||||
</file>
|
||||
</xliff>
|
|
@ -27,11 +27,6 @@
|
|||
<target state="new">Uninstall user wide.</target>
|
||||
<note />
|
||||
</trans-unit>
|
||||
<trans-unit id="UninstallToolCommandOnlySupportsGlobal">
|
||||
<source>The --global switch (-g) is currently required because only user wide tools are supported.</source>
|
||||
<target state="new">The --global switch (-g) is currently required because only user wide tools are supported.</target>
|
||||
<note />
|
||||
</trans-unit>
|
||||
<trans-unit id="UninstallSucceeded">
|
||||
<source>Tool '{0}' (version '{1}') was successfully uninstalled.</source>
|
||||
<target state="new">Tool '{0}' (version '{1}') was successfully uninstalled.</target>
|
||||
|
@ -52,6 +47,21 @@
|
|||
<target state="new">Failed to uninstall tool '{0}': {1}</target>
|
||||
<note />
|
||||
</trans-unit>
|
||||
<trans-unit id="UninstallToolCommandNeedGlobalOrToolPath">
|
||||
<source>Need either global or tool-path provided.</source>
|
||||
<target state="new">Need either global or tool-path provided.</target>
|
||||
<note />
|
||||
</trans-unit>
|
||||
<trans-unit id="ToolPathDescription">
|
||||
<source>Location of shim to access tool</source>
|
||||
<target state="new">Location of shim to access tool</target>
|
||||
<note />
|
||||
</trans-unit>
|
||||
<trans-unit id="UninstallToolCommandInvalidGlobalAndToolPath">
|
||||
<source>Cannot have global and tool-path as opinion at the same time."</source>
|
||||
<target state="new">Cannot have global and tool-path as opinion at the same time."</target>
|
||||
<note />
|
||||
</trans-unit>
|
||||
</body>
|
||||
</file>
|
||||
</xliff>
|
|
@ -27,11 +27,6 @@
|
|||
<target state="new">Uninstall user wide.</target>
|
||||
<note />
|
||||
</trans-unit>
|
||||
<trans-unit id="UninstallToolCommandOnlySupportsGlobal">
|
||||
<source>The --global switch (-g) is currently required because only user wide tools are supported.</source>
|
||||
<target state="new">The --global switch (-g) is currently required because only user wide tools are supported.</target>
|
||||
<note />
|
||||
</trans-unit>
|
||||
<trans-unit id="UninstallSucceeded">
|
||||
<source>Tool '{0}' (version '{1}') was successfully uninstalled.</source>
|
||||
<target state="new">Tool '{0}' (version '{1}') was successfully uninstalled.</target>
|
||||
|
@ -52,6 +47,21 @@
|
|||
<target state="new">Failed to uninstall tool '{0}': {1}</target>
|
||||
<note />
|
||||
</trans-unit>
|
||||
<trans-unit id="UninstallToolCommandNeedGlobalOrToolPath">
|
||||
<source>Need either global or tool-path provided.</source>
|
||||
<target state="new">Need either global or tool-path provided.</target>
|
||||
<note />
|
||||
</trans-unit>
|
||||
<trans-unit id="ToolPathDescription">
|
||||
<source>Location of shim to access tool</source>
|
||||
<target state="new">Location of shim to access tool</target>
|
||||
<note />
|
||||
</trans-unit>
|
||||
<trans-unit id="UninstallToolCommandInvalidGlobalAndToolPath">
|
||||
<source>Cannot have global and tool-path as opinion at the same time."</source>
|
||||
<target state="new">Cannot have global and tool-path as opinion at the same time."</target>
|
||||
<note />
|
||||
</trans-unit>
|
||||
</body>
|
||||
</file>
|
||||
</xliff>
|
|
@ -27,11 +27,6 @@
|
|||
<target state="new">Uninstall user wide.</target>
|
||||
<note />
|
||||
</trans-unit>
|
||||
<trans-unit id="UninstallToolCommandOnlySupportsGlobal">
|
||||
<source>The --global switch (-g) is currently required because only user wide tools are supported.</source>
|
||||
<target state="new">The --global switch (-g) is currently required because only user wide tools are supported.</target>
|
||||
<note />
|
||||
</trans-unit>
|
||||
<trans-unit id="UninstallSucceeded">
|
||||
<source>Tool '{0}' (version '{1}') was successfully uninstalled.</source>
|
||||
<target state="new">Tool '{0}' (version '{1}') was successfully uninstalled.</target>
|
||||
|
@ -52,6 +47,21 @@
|
|||
<target state="new">Failed to uninstall tool '{0}': {1}</target>
|
||||
<note />
|
||||
</trans-unit>
|
||||
<trans-unit id="UninstallToolCommandNeedGlobalOrToolPath">
|
||||
<source>Need either global or tool-path provided.</source>
|
||||
<target state="new">Need either global or tool-path provided.</target>
|
||||
<note />
|
||||
</trans-unit>
|
||||
<trans-unit id="ToolPathDescription">
|
||||
<source>Location of shim to access tool</source>
|
||||
<target state="new">Location of shim to access tool</target>
|
||||
<note />
|
||||
</trans-unit>
|
||||
<trans-unit id="UninstallToolCommandInvalidGlobalAndToolPath">
|
||||
<source>Cannot have global and tool-path as opinion at the same time."</source>
|
||||
<target state="new">Cannot have global and tool-path as opinion at the same time."</target>
|
||||
<note />
|
||||
</trans-unit>
|
||||
</body>
|
||||
</file>
|
||||
</xliff>
|
|
@ -77,4 +77,4 @@
|
|||
<Folder Include="dotnet-complete\commands\" />
|
||||
</ItemGroup>
|
||||
<Import Project="dotnet.win.targets" Condition="'$(OS)' == 'Windows_NT'" />
|
||||
</Project>
|
||||
</Project>
|
|
@ -858,6 +858,11 @@ setx PATH "%PATH%;{0}"
|
|||
<target state="new">Failed to find staged tool package '{0}'.</target>
|
||||
<note />
|
||||
</trans-unit>
|
||||
<trans-unit id="ToolSettingsInvalidLeadingDotCommandName">
|
||||
<source>Command '{0}' has a leading dot.</source>
|
||||
<target state="new">Command '{0}' has a leading dot.</target>
|
||||
<note />
|
||||
</trans-unit>
|
||||
</body>
|
||||
</file>
|
||||
</xliff>
|
|
@ -858,6 +858,11 @@ setx PATH "%PATH%;{0}"
|
|||
<target state="new">Failed to find staged tool package '{0}'.</target>
|
||||
<note />
|
||||
</trans-unit>
|
||||
<trans-unit id="ToolSettingsInvalidLeadingDotCommandName">
|
||||
<source>Command '{0}' has a leading dot.</source>
|
||||
<target state="new">Command '{0}' has a leading dot.</target>
|
||||
<note />
|
||||
</trans-unit>
|
||||
</body>
|
||||
</file>
|
||||
</xliff>
|
|
@ -858,6 +858,11 @@ setx PATH "%PATH%;{0}"
|
|||
<target state="new">Failed to find staged tool package '{0}'.</target>
|
||||
<note />
|
||||
</trans-unit>
|
||||
<trans-unit id="ToolSettingsInvalidLeadingDotCommandName">
|
||||
<source>Command '{0}' has a leading dot.</source>
|
||||
<target state="new">Command '{0}' has a leading dot.</target>
|
||||
<note />
|
||||
</trans-unit>
|
||||
</body>
|
||||
</file>
|
||||
</xliff>
|
|
@ -858,6 +858,11 @@ setx PATH "%PATH%;{0}"
|
|||
<target state="new">Failed to find staged tool package '{0}'.</target>
|
||||
<note />
|
||||
</trans-unit>
|
||||
<trans-unit id="ToolSettingsInvalidLeadingDotCommandName">
|
||||
<source>Command '{0}' has a leading dot.</source>
|
||||
<target state="new">Command '{0}' has a leading dot.</target>
|
||||
<note />
|
||||
</trans-unit>
|
||||
</body>
|
||||
</file>
|
||||
</xliff>
|
|
@ -858,6 +858,11 @@ setx PATH "%PATH%;{0}"
|
|||
<target state="new">Failed to find staged tool package '{0}'.</target>
|
||||
<note />
|
||||
</trans-unit>
|
||||
<trans-unit id="ToolSettingsInvalidLeadingDotCommandName">
|
||||
<source>Command '{0}' has a leading dot.</source>
|
||||
<target state="new">Command '{0}' has a leading dot.</target>
|
||||
<note />
|
||||
</trans-unit>
|
||||
</body>
|
||||
</file>
|
||||
</xliff>
|
|
@ -858,6 +858,11 @@ setx PATH "%PATH%;{0}"
|
|||
<target state="new">Failed to find staged tool package '{0}'.</target>
|
||||
<note />
|
||||
</trans-unit>
|
||||
<trans-unit id="ToolSettingsInvalidLeadingDotCommandName">
|
||||
<source>Command '{0}' has a leading dot.</source>
|
||||
<target state="new">Command '{0}' has a leading dot.</target>
|
||||
<note />
|
||||
</trans-unit>
|
||||
</body>
|
||||
</file>
|
||||
</xliff>
|
|
@ -858,6 +858,11 @@ setx PATH "%PATH%;{0}"
|
|||
<target state="new">Failed to find staged tool package '{0}'.</target>
|
||||
<note />
|
||||
</trans-unit>
|
||||
<trans-unit id="ToolSettingsInvalidLeadingDotCommandName">
|
||||
<source>Command '{0}' has a leading dot.</source>
|
||||
<target state="new">Command '{0}' has a leading dot.</target>
|
||||
<note />
|
||||
</trans-unit>
|
||||
</body>
|
||||
</file>
|
||||
</xliff>
|
|
@ -858,6 +858,11 @@ setx PATH "%PATH%;{0}"
|
|||
<target state="new">Failed to find staged tool package '{0}'.</target>
|
||||
<note />
|
||||
</trans-unit>
|
||||
<trans-unit id="ToolSettingsInvalidLeadingDotCommandName">
|
||||
<source>Command '{0}' has a leading dot.</source>
|
||||
<target state="new">Command '{0}' has a leading dot.</target>
|
||||
<note />
|
||||
</trans-unit>
|
||||
</body>
|
||||
</file>
|
||||
</xliff>
|
|
@ -858,6 +858,11 @@ setx PATH "%PATH%;{0}"
|
|||
<target state="new">Failed to find staged tool package '{0}'.</target>
|
||||
<note />
|
||||
</trans-unit>
|
||||
<trans-unit id="ToolSettingsInvalidLeadingDotCommandName">
|
||||
<source>Command '{0}' has a leading dot.</source>
|
||||
<target state="new">Command '{0}' has a leading dot.</target>
|
||||
<note />
|
||||
</trans-unit>
|
||||
</body>
|
||||
</file>
|
||||
</xliff>
|
|
@ -858,6 +858,11 @@ setx PATH "%PATH%;{0}"
|
|||
<target state="new">Failed to find staged tool package '{0}'.</target>
|
||||
<note />
|
||||
</trans-unit>
|
||||
<trans-unit id="ToolSettingsInvalidLeadingDotCommandName">
|
||||
<source>Command '{0}' has a leading dot.</source>
|
||||
<target state="new">Command '{0}' has a leading dot.</target>
|
||||
<note />
|
||||
</trans-unit>
|
||||
</body>
|
||||
</file>
|
||||
</xliff>
|
|
@ -858,6 +858,11 @@ setx PATH "%PATH%;{0}"
|
|||
<target state="new">Failed to find staged tool package '{0}'.</target>
|
||||
<note />
|
||||
</trans-unit>
|
||||
<trans-unit id="ToolSettingsInvalidLeadingDotCommandName">
|
||||
<source>Command '{0}' has a leading dot.</source>
|
||||
<target state="new">Command '{0}' has a leading dot.</target>
|
||||
<note />
|
||||
</trans-unit>
|
||||
</body>
|
||||
</file>
|
||||
</xliff>
|
|
@ -858,6 +858,11 @@ setx PATH "%PATH%;{0}"
|
|||
<target state="new">Failed to find staged tool package '{0}'.</target>
|
||||
<note />
|
||||
</trans-unit>
|
||||
<trans-unit id="ToolSettingsInvalidLeadingDotCommandName">
|
||||
<source>Command '{0}' has a leading dot.</source>
|
||||
<target state="new">Command '{0}' has a leading dot.</target>
|
||||
<note />
|
||||
</trans-unit>
|
||||
</body>
|
||||
</file>
|
||||
</xliff>
|
|
@ -858,6 +858,11 @@ setx PATH "%PATH%;{0}"
|
|||
<target state="new">Failed to find staged tool package '{0}'.</target>
|
||||
<note />
|
||||
</trans-unit>
|
||||
<trans-unit id="ToolSettingsInvalidLeadingDotCommandName">
|
||||
<source>Command '{0}' has a leading dot.</source>
|
||||
<target state="new">Command '{0}' has a leading dot.</target>
|
||||
<note />
|
||||
</trans-unit>
|
||||
</body>
|
||||
</file>
|
||||
</xliff>
|
|
@ -54,5 +54,17 @@ namespace Microsoft.DotNet.ToolPackage.Tests
|
|||
invalidCommandName,
|
||||
string.Join(", ", Path.GetInvalidFileNameChars().Select(c => $"'{c}'"))));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void GivenALeadingDotAsFileNameItThrows()
|
||||
{
|
||||
var invalidCommandName = ".mytool";
|
||||
Action a = () => new ToolConfiguration(invalidCommandName, "my.dll");
|
||||
a.ShouldThrow<ToolConfigurationException>()
|
||||
.And.Message.Should()
|
||||
.Contain(string.Format(
|
||||
CommonLocalizableStrings.ToolSettingsInvalidLeadingDotCommandName,
|
||||
invalidCommandName));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,6 +11,7 @@ namespace Microsoft.DotNet.Tools.Tests.ComponentMocks
|
|||
private readonly string _packageExecutablePath;
|
||||
private readonly bool _packageExecutablePathExists;
|
||||
private readonly IReporter _reporter;
|
||||
public const string MockInstructionText = "MOCK INSTRUCTION";
|
||||
|
||||
public EnvironmentPathInstructionMock(
|
||||
IReporter reporter,
|
||||
|
@ -27,7 +28,7 @@ namespace Microsoft.DotNet.Tools.Tests.ComponentMocks
|
|||
{
|
||||
if (!PackageExecutablePathExists())
|
||||
{
|
||||
_reporter.WriteLine("INSTRUCTION");
|
||||
_reporter.WriteLine(MockInstructionText);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -19,8 +19,9 @@ using Microsoft.Extensions.EnvironmentAbstractions;
|
|||
using Newtonsoft.Json;
|
||||
using Xunit;
|
||||
using Parser = Microsoft.DotNet.Cli.Parser;
|
||||
using LocalizableStrings = Microsoft.DotNet.Tools.Install.Tool.LocalizableStrings;
|
||||
using System.Runtime.InteropServices;
|
||||
using LocalizableStrings = Microsoft.DotNet.Tools.Install.Tool.LocalizableStrings;
|
||||
using Microsoft.DotNet.ShellShim;
|
||||
|
||||
namespace Microsoft.DotNet.Tests.Commands
|
||||
{
|
||||
|
@ -28,7 +29,8 @@ namespace Microsoft.DotNet.Tests.Commands
|
|||
{
|
||||
private readonly IFileSystem _fileSystem;
|
||||
private readonly IToolPackageStore _toolPackageStore;
|
||||
private readonly ShellShimRepositoryMock _shellShimRepositoryMock;
|
||||
private readonly CreateShellShimRepository _createShellShimRepository;
|
||||
private readonly CreateToolPackageStoreAndInstaller _createToolPackageStoreAndInstaller;
|
||||
private readonly EnvironmentPathInstructionMock _environmentPathInstructionMock;
|
||||
private readonly AppliedOption _appliedCommand;
|
||||
private readonly ParseResult _parseResult;
|
||||
|
@ -43,9 +45,11 @@ namespace Microsoft.DotNet.Tests.Commands
|
|||
_reporter = new BufferedReporter();
|
||||
_fileSystem = new FileSystemMockBuilder().Build();
|
||||
_toolPackageStore = new ToolPackageStoreMock(new DirectoryPath(PathToPlacePackages), _fileSystem);
|
||||
_shellShimRepositoryMock = new ShellShimRepositoryMock(new DirectoryPath(PathToPlaceShim), _fileSystem);
|
||||
_createShellShimRepository =
|
||||
(nonGlobalLocation) => new ShellShimRepositoryMock(new DirectoryPath(PathToPlaceShim), _fileSystem);
|
||||
_environmentPathInstructionMock =
|
||||
new EnvironmentPathInstructionMock(_reporter, PathToPlaceShim);
|
||||
_createToolPackageStoreAndInstaller = (_) => (_toolPackageStore, CreateToolPackageInstaller());
|
||||
|
||||
ParseResult result = Parser.Instance.Parse($"dotnet install tool -g {PackageId}");
|
||||
_appliedCommand = result["dotnet"]["install"]["tool"];
|
||||
|
@ -58,9 +62,8 @@ namespace Microsoft.DotNet.Tests.Commands
|
|||
{
|
||||
var installToolCommand = new InstallToolCommand(_appliedCommand,
|
||||
_parseResult,
|
||||
_toolPackageStore,
|
||||
CreateToolPackageInstaller(),
|
||||
_shellShimRepositoryMock,
|
||||
_createToolPackageStoreAndInstaller,
|
||||
_createShellShimRepository,
|
||||
_environmentPathInstructionMock,
|
||||
_reporter);
|
||||
|
||||
|
@ -83,26 +86,28 @@ namespace Microsoft.DotNet.Tests.Commands
|
|||
ParseResult parseResult =
|
||||
Parser.Instance.ParseFrom("dotnet install", new[] { "tool", PackageId, "--source", sourcePath });
|
||||
|
||||
var installToolCommand = new InstallToolCommand(appliedCommand,
|
||||
parseResult,
|
||||
_toolPackageStore,
|
||||
CreateToolPackageInstaller(
|
||||
feeds: new MockFeed[] {
|
||||
new MockFeed
|
||||
|
||||
var toolToolPackageInstaller = CreateToolPackageInstaller(
|
||||
feeds: new MockFeed[] {
|
||||
new MockFeed
|
||||
{
|
||||
Type = MockFeedType.Source,
|
||||
Uri = sourcePath,
|
||||
Packages = new List<MockFeedPackage>
|
||||
{
|
||||
Type = MockFeedType.Source,
|
||||
Uri = sourcePath,
|
||||
Packages = new List<MockFeedPackage>
|
||||
new MockFeedPackage
|
||||
{
|
||||
new MockFeedPackage
|
||||
{
|
||||
PackageId = PackageId,
|
||||
Version = PackageVersion
|
||||
}
|
||||
PackageId = PackageId,
|
||||
Version = PackageVersion
|
||||
}
|
||||
}
|
||||
}),
|
||||
_shellShimRepositoryMock,
|
||||
}
|
||||
});
|
||||
|
||||
var installToolCommand = new InstallToolCommand(appliedCommand,
|
||||
parseResult,
|
||||
(_) => (_toolPackageStore, toolToolPackageInstaller),
|
||||
_createShellShimRepository,
|
||||
_environmentPathInstructionMock,
|
||||
_reporter);
|
||||
|
||||
|
@ -122,27 +127,28 @@ namespace Microsoft.DotNet.Tests.Commands
|
|||
{
|
||||
var installToolCommand = new InstallToolCommand(_appliedCommand,
|
||||
_parseResult,
|
||||
_toolPackageStore,
|
||||
CreateToolPackageInstaller(),
|
||||
_shellShimRepositoryMock,
|
||||
_createToolPackageStoreAndInstaller,
|
||||
_createShellShimRepository,
|
||||
_environmentPathInstructionMock,
|
||||
_reporter);
|
||||
|
||||
installToolCommand.Execute().Should().Be(0);
|
||||
|
||||
_reporter.Lines.First().Should().Be("INSTRUCTION");
|
||||
_reporter.Lines.First().Should().Be(EnvironmentPathInstructionMock.MockInstructionText);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void GivenFailedPackageInstallWhenRunWithPackageIdItShouldFail()
|
||||
{
|
||||
var toolPackageInstaller =
|
||||
CreateToolPackageInstaller(
|
||||
installCallback: () => throw new ToolPackageException("Simulated error"));
|
||||
|
||||
var installToolCommand = new InstallToolCommand(
|
||||
_appliedCommand,
|
||||
_parseResult,
|
||||
_toolPackageStore,
|
||||
CreateToolPackageInstaller(
|
||||
installCallback: () => throw new ToolPackageException("Simulated error")),
|
||||
_shellShimRepositoryMock,
|
||||
(_) => (_toolPackageStore, toolPackageInstaller),
|
||||
_createShellShimRepository,
|
||||
_environmentPathInstructionMock,
|
||||
_reporter);
|
||||
|
||||
|
@ -166,9 +172,8 @@ namespace Microsoft.DotNet.Tests.Commands
|
|||
var installToolCommand = new InstallToolCommand(
|
||||
_appliedCommand,
|
||||
_parseResult,
|
||||
_toolPackageStore,
|
||||
CreateToolPackageInstaller(),
|
||||
_shellShimRepositoryMock,
|
||||
_createToolPackageStoreAndInstaller,
|
||||
_createShellShimRepository,
|
||||
_environmentPathInstructionMock,
|
||||
_reporter);
|
||||
|
||||
|
@ -188,13 +193,15 @@ namespace Microsoft.DotNet.Tests.Commands
|
|||
[Fact]
|
||||
public void GivenInCorrectToolConfigurationWhenRunWithPackageIdItShouldFail()
|
||||
{
|
||||
var toolPackageInstaller =
|
||||
CreateToolPackageInstaller(
|
||||
installCallback: () => throw new ToolConfigurationException("Simulated error"));
|
||||
|
||||
var installToolCommand = new InstallToolCommand(
|
||||
_appliedCommand,
|
||||
_parseResult,
|
||||
_toolPackageStore,
|
||||
CreateToolPackageInstaller(
|
||||
installCallback: () => throw new ToolConfigurationException("Simulated error")),
|
||||
_shellShimRepositoryMock,
|
||||
(_) => (_toolPackageStore, toolPackageInstaller),
|
||||
_createShellShimRepository,
|
||||
_environmentPathInstructionMock,
|
||||
_reporter);
|
||||
|
||||
|
@ -216,9 +223,8 @@ namespace Microsoft.DotNet.Tests.Commands
|
|||
var installToolCommand = new InstallToolCommand(
|
||||
_appliedCommand,
|
||||
_parseResult,
|
||||
_toolPackageStore,
|
||||
CreateToolPackageInstaller(),
|
||||
_shellShimRepositoryMock,
|
||||
_createToolPackageStoreAndInstaller,
|
||||
_createShellShimRepository,
|
||||
new EnvironmentPathInstructionMock(_reporter, PathToPlaceShim, true),
|
||||
_reporter);
|
||||
|
||||
|
@ -244,9 +250,8 @@ namespace Microsoft.DotNet.Tests.Commands
|
|||
var installToolCommand = new InstallToolCommand(
|
||||
appliedCommand,
|
||||
result,
|
||||
_toolPackageStore,
|
||||
CreateToolPackageInstaller(),
|
||||
_shellShimRepositoryMock,
|
||||
_createToolPackageStoreAndInstaller,
|
||||
_createShellShimRepository,
|
||||
new EnvironmentPathInstructionMock(_reporter, PathToPlaceShim, true),
|
||||
_reporter);
|
||||
|
||||
|
@ -268,9 +273,8 @@ namespace Microsoft.DotNet.Tests.Commands
|
|||
var installToolCommand = new InstallToolCommand(
|
||||
appliedCommand,
|
||||
result,
|
||||
_toolPackageStore,
|
||||
CreateToolPackageInstaller(),
|
||||
_shellShimRepositoryMock,
|
||||
_createToolPackageStoreAndInstaller,
|
||||
_createShellShimRepository,
|
||||
new EnvironmentPathInstructionMock(_reporter, PathToPlaceShim, true),
|
||||
_reporter);
|
||||
|
||||
|
@ -295,9 +299,8 @@ namespace Microsoft.DotNet.Tests.Commands
|
|||
var installToolCommand = new InstallToolCommand(
|
||||
appliedCommand,
|
||||
result,
|
||||
_toolPackageStore,
|
||||
CreateToolPackageInstaller(),
|
||||
_shellShimRepositoryMock,
|
||||
_createToolPackageStoreAndInstaller,
|
||||
_createShellShimRepository,
|
||||
new EnvironmentPathInstructionMock(_reporter, PathToPlaceShim, true),
|
||||
_reporter);
|
||||
|
||||
|
@ -322,9 +325,8 @@ namespace Microsoft.DotNet.Tests.Commands
|
|||
var installToolCommand = new InstallToolCommand(
|
||||
appliedCommand,
|
||||
result,
|
||||
_toolPackageStore,
|
||||
CreateToolPackageInstaller(),
|
||||
_shellShimRepositoryMock,
|
||||
_createToolPackageStoreAndInstaller,
|
||||
_createShellShimRepository,
|
||||
new EnvironmentPathInstructionMock(_reporter, PathToPlaceShim, true),
|
||||
_reporter);
|
||||
|
||||
|
@ -348,9 +350,8 @@ namespace Microsoft.DotNet.Tests.Commands
|
|||
var installToolCommand = new InstallToolCommand(
|
||||
appliedCommand,
|
||||
result,
|
||||
_toolPackageStore,
|
||||
CreateToolPackageInstaller(),
|
||||
_shellShimRepositoryMock,
|
||||
_createToolPackageStoreAndInstaller,
|
||||
_createShellShimRepository,
|
||||
new EnvironmentPathInstructionMock(_reporter, PathToPlaceShim, true),
|
||||
_reporter);
|
||||
|
||||
|
@ -366,6 +367,70 @@ namespace Microsoft.DotNet.Tests.Commands
|
|||
PackageVersion).Green());
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void WhenRunWithBothGlobalAndToolPathShowErrorMessage()
|
||||
{
|
||||
var result = Parser.Instance.Parse($"dotnet install tool -g --tool-path /tmp/folder {PackageId}");
|
||||
var appliedCommand = result["dotnet"]["install"]["tool"];
|
||||
var parser = Parser.Instance;
|
||||
var parseResult = parser.ParseFrom("dotnet install", new[] {"tool", PackageId});
|
||||
|
||||
var installToolCommand = new InstallToolCommand(
|
||||
appliedCommand,
|
||||
parseResult,
|
||||
_createToolPackageStoreAndInstaller,
|
||||
_createShellShimRepository,
|
||||
new EnvironmentPathInstructionMock(_reporter, PathToPlaceShim, true),
|
||||
_reporter);
|
||||
|
||||
Action a = () => installToolCommand.Execute();
|
||||
|
||||
a.ShouldThrow<GracefulException>().And.Message
|
||||
.Should().Contain(LocalizableStrings.InstallToolCommandInvalidGlobalAndToolPath);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void WhenRunWithNeitherOfGlobalNorToolPathShowErrorMessage()
|
||||
{
|
||||
var result = Parser.Instance.Parse($"dotnet install tool {PackageId}");
|
||||
var appliedCommand = result["dotnet"]["install"]["tool"];
|
||||
var parser = Parser.Instance;
|
||||
var parseResult = parser.ParseFrom("dotnet install", new[] { "tool", PackageId });
|
||||
|
||||
var installToolCommand = new InstallToolCommand(
|
||||
appliedCommand,
|
||||
parseResult,
|
||||
_createToolPackageStoreAndInstaller,
|
||||
_createShellShimRepository,
|
||||
new EnvironmentPathInstructionMock(_reporter, PathToPlaceShim, true),
|
||||
_reporter);
|
||||
|
||||
Action a = () => installToolCommand.Execute();
|
||||
|
||||
a.ShouldThrow<GracefulException>().And.Message
|
||||
.Should().Contain(LocalizableStrings.InstallToolCommandNeedGlobalOrToolPath);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void WhenRunWithPackageIdAndBinPathItShouldNoteHaveEnvironmentPathInstruction()
|
||||
{
|
||||
var result = Parser.Instance.Parse($"dotnet install tool --tool-path /tmp/folder {PackageId}");
|
||||
var appliedCommand = result["dotnet"]["install"]["tool"];
|
||||
var parser = Parser.Instance;
|
||||
var parseResult = parser.ParseFrom("dotnet install", new[] {"tool", PackageId});
|
||||
|
||||
var installToolCommand = new InstallToolCommand(appliedCommand,
|
||||
parseResult,
|
||||
_createToolPackageStoreAndInstaller,
|
||||
_createShellShimRepository,
|
||||
new EnvironmentPathInstructionMock(_reporter, PathToPlaceShim),
|
||||
_reporter);
|
||||
|
||||
installToolCommand.Execute().Should().Be(0);
|
||||
|
||||
_reporter.Lines.Should().NotContain(l => l.Contains(EnvironmentPathInstructionMock.MockInstructionText));
|
||||
}
|
||||
|
||||
private IToolPackageInstaller CreateToolPackageInstaller(
|
||||
IEnumerable<MockFeed> feeds = null,
|
||||
Action installCallback = null)
|
||||
|
|
|
@ -29,7 +29,6 @@ namespace Microsoft.DotNet.Tests.Commands
|
|||
{
|
||||
private readonly BufferedReporter _reporter;
|
||||
private readonly IFileSystem _fileSystem;
|
||||
private readonly ShellShimRepositoryMock _shellShimRepositoryMock;
|
||||
private readonly EnvironmentPathInstructionMock _environmentPathInstructionMock;
|
||||
|
||||
private const string PackageId = "global.tool.console.demo";
|
||||
|
@ -41,7 +40,6 @@ namespace Microsoft.DotNet.Tests.Commands
|
|||
{
|
||||
_reporter = new BufferedReporter();
|
||||
_fileSystem = new FileSystemMockBuilder().Build();
|
||||
_shellShimRepositoryMock = new ShellShimRepositoryMock(new DirectoryPath(ShimsDirectory), _fileSystem);
|
||||
_environmentPathInstructionMock = new EnvironmentPathInstructionMock(_reporter, ShimsDirectory);
|
||||
}
|
||||
|
||||
|
@ -62,22 +60,6 @@ namespace Microsoft.DotNet.Tests.Commands
|
|||
packageId).Red());
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void GivenAMissingGlobalOptionItErrors()
|
||||
{
|
||||
var command = CreateUninstallCommand("does.not.exist");
|
||||
|
||||
Action a = () => {
|
||||
command.Execute();
|
||||
};
|
||||
|
||||
a.ShouldThrow<GracefulException>()
|
||||
.And
|
||||
.Message
|
||||
.Should()
|
||||
.Be(LocalizableStrings.UninstallToolCommandOnlySupportsGlobal);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void GivenAPackageItUninstalls()
|
||||
{
|
||||
|
@ -165,22 +147,45 @@ namespace Microsoft.DotNet.Tests.Commands
|
|||
_fileSystem.File.Exists(shimPath).Should().BeTrue();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void WhenRunWithBothGlobalAndToolPathShowErrorMessage()
|
||||
{
|
||||
var uninstallCommand = CreateUninstallCommand($"-g --tool-path /tmp/folder {PackageId}");
|
||||
|
||||
Action a = () => uninstallCommand.Execute();
|
||||
|
||||
a.ShouldThrow<GracefulException>().And.Message
|
||||
.Should().Contain(LocalizableStrings.UninstallToolCommandInvalidGlobalAndToolPath);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void WhenRunWithNeitherOfGlobalNorToolPathShowErrorMessage()
|
||||
{
|
||||
var uninstallCommand = CreateUninstallCommand(PackageId);
|
||||
|
||||
Action a = () => uninstallCommand.Execute();
|
||||
|
||||
a.ShouldThrow<GracefulException>().And.Message
|
||||
.Should().Contain(LocalizableStrings.UninstallToolCommandNeedGlobalOrToolPath);
|
||||
}
|
||||
|
||||
private InstallToolCommand CreateInstallCommand(string options)
|
||||
{
|
||||
ParseResult result = Parser.Instance.Parse("dotnet install tool " + options);
|
||||
|
||||
var store = new ToolPackageStoreMock(new DirectoryPath(ToolsDirectory), _fileSystem);
|
||||
var packageInstallerMock = new ToolPackageInstallerMock(
|
||||
_fileSystem,
|
||||
store,
|
||||
new ProjectRestorerMock(
|
||||
_fileSystem,
|
||||
_reporter));
|
||||
|
||||
return new InstallToolCommand(
|
||||
result["dotnet"]["install"]["tool"],
|
||||
result,
|
||||
store,
|
||||
new ToolPackageInstallerMock(
|
||||
_fileSystem,
|
||||
store,
|
||||
new ProjectRestorerMock(
|
||||
_fileSystem,
|
||||
_reporter)),
|
||||
_shellShimRepositoryMock,
|
||||
(_) => (store, packageInstallerMock),
|
||||
(_) => new ShellShimRepositoryMock(new DirectoryPath(ShimsDirectory), _fileSystem),
|
||||
_environmentPathInstructionMock,
|
||||
_reporter);
|
||||
}
|
||||
|
@ -192,11 +197,11 @@ namespace Microsoft.DotNet.Tests.Commands
|
|||
return new UninstallToolCommand(
|
||||
result["dotnet"]["uninstall"]["tool"],
|
||||
result,
|
||||
new ToolPackageStoreMock(
|
||||
(_) => new ToolPackageStoreMock(
|
||||
new DirectoryPath(ToolsDirectory),
|
||||
_fileSystem,
|
||||
uninstallCallback),
|
||||
_shellShimRepositoryMock,
|
||||
(_) => new ShellShimRepositoryMock(new DirectoryPath(ShimsDirectory), _fileSystem),
|
||||
_reporter);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -79,5 +79,15 @@ namespace Microsoft.DotNet.Tests.ParserTests
|
|||
var appliedOptions = result["dotnet"]["install"]["tool"];
|
||||
appliedOptions.SingleArgumentOrDefault("verbosity").Should().Be(expectedVerbosityLevel);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void InstallToolParserCanParseToolPathOption()
|
||||
{
|
||||
var result =
|
||||
Parser.Instance.Parse(@"dotnet install tool --tool-path C:\TestAssetLocalNugetFeed console.test.app");
|
||||
|
||||
var appliedOptions = result["dotnet"]["install"]["tool"];
|
||||
appliedOptions.SingleArgumentOrDefault("tool-path").Should().Be(@"C:\TestAssetLocalNugetFeed");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,55 @@
|
|||
// Copyright (c) .NET Foundation and contributors. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
|
||||
using System.Linq;
|
||||
using FluentAssertions;
|
||||
using Microsoft.DotNet.Cli;
|
||||
using Microsoft.DotNet.Cli.CommandLine;
|
||||
using Xunit;
|
||||
using Xunit.Abstractions;
|
||||
using Parser = Microsoft.DotNet.Cli.Parser;
|
||||
|
||||
namespace Microsoft.DotNet.Tests.ParserTests
|
||||
{
|
||||
public class UninstallInstallToolParserTests
|
||||
{
|
||||
private readonly ITestOutputHelper output;
|
||||
|
||||
public UninstallInstallToolParserTests(ITestOutputHelper output)
|
||||
{
|
||||
this.output = output;
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void UninstallGlobaltoolParserCanGetPackageId()
|
||||
{
|
||||
var command = Parser.Instance;
|
||||
var result = command.Parse("dotnet uninstall tool -g console.test.app");
|
||||
|
||||
var parseResult = result["dotnet"]["uninstall"]["tool"];
|
||||
|
||||
var packageId = parseResult.Arguments.Single();
|
||||
|
||||
packageId.Should().Be("console.test.app");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void UninstallToolParserCanGetGlobalOption()
|
||||
{
|
||||
var result = Parser.Instance.Parse("dotnet uninstall tool -g console.test.app");
|
||||
|
||||
var appliedOptions = result["dotnet"]["uninstall"]["tool"];
|
||||
appliedOptions.ValueOrDefault<bool>("global").Should().Be(true);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void UninstallToolParserCanParseToolPathOption()
|
||||
{
|
||||
var result =
|
||||
Parser.Instance.Parse(@"dotnet uninstall tool --tool-path C:\TestAssetLocalNugetFeed console.test.app");
|
||||
|
||||
var appliedOptions = result["dotnet"]["uninstall"]["tool"];
|
||||
appliedOptions.SingleArgumentOrDefault("tool-path").Should().Be(@"C:\TestAssetLocalNugetFeed");
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue