diff --git a/src/Cli/dotnet/CommonLocalizableStrings.resx b/src/Cli/dotnet/CommonLocalizableStrings.resx index 50e7a04745ef..8c101c3ad761 100644 --- a/src/Cli/dotnet/CommonLocalizableStrings.resx +++ b/src/Cli/dotnet/CommonLocalizableStrings.resx @@ -566,22 +566,6 @@ EOF You can add it to the current session by running the following command: -export PATH="$PATH:{0}" - - - - Tools directory '{0}' is not currently on the PATH environment variable. -If you are using zsh, you can add it to your profile by running the following command: - -cat << \EOF >> ~/.zprofile -# Add .NET Core SDK tools -export PATH="$PATH:{0}" -EOF - -And run `zsh -l` to make it available for current session. - -You can only add it to the current session by running the following command: - export PATH="$PATH:{0}" diff --git a/src/Cli/dotnet/ShellShim/EnvironmentPathFactory.cs b/src/Cli/dotnet/ShellShim/EnvironmentPathFactory.cs index 340b62362044..1c82e2018555 100644 --- a/src/Cli/dotnet/ShellShim/EnvironmentPathFactory.cs +++ b/src/Cli/dotnet/ShellShim/EnvironmentPathFactory.cs @@ -46,7 +46,7 @@ public static IEnvironmentPath CreateEnvironmentPath( } else if (OperatingSystem.IsMacOS() && isDotnetBeingInvokedFromNativeInstaller) { - environmentPath = new OsxBashEnvironmentPath( + environmentPath = new OsxEnvironmentPath( executablePath: CliFolderPathCalculator.ToolsShimPathInUnix, reporter: Reporter.Output, environmentProvider: environmentProvider, @@ -64,14 +64,6 @@ public static IEnvironmentPathInstruction CreateEnvironmentPathInstruction( environmentProvider = new EnvironmentProvider(); } - if (OperatingSystem.IsMacOS() && ZshDetector.IsZshTheUsersShell(environmentProvider)) - { - return new OsxZshEnvironmentPathInstruction( - executablePath: CliFolderPathCalculator.ToolsShimPathInUnix, - reporter: Reporter.Output, - environmentProvider: environmentProvider); - } - if (OperatingSystem.IsWindows()) { return new WindowsEnvironmentPath( diff --git a/src/Cli/dotnet/ShellShim/OsxBashEnvironmentPath.cs b/src/Cli/dotnet/ShellShim/OsxEnvironmentPath.cs similarity index 95% rename from src/Cli/dotnet/ShellShim/OsxBashEnvironmentPath.cs rename to src/Cli/dotnet/ShellShim/OsxEnvironmentPath.cs index 401c325b52a4..5f3523f9a7b2 100644 --- a/src/Cli/dotnet/ShellShim/OsxBashEnvironmentPath.cs +++ b/src/Cli/dotnet/ShellShim/OsxEnvironmentPath.cs @@ -8,7 +8,7 @@ namespace Microsoft.DotNet.ShellShim { - internal class OsxBashEnvironmentPath : IEnvironmentPath + internal class OsxEnvironmentPath : IEnvironmentPath { private const string PathName = "PATH"; private readonly BashPathUnderHomeDirectory _packageExecutablePath; @@ -20,7 +20,7 @@ internal static readonly string DotnetCliToolsPathsDPath = Environment.GetEnvironmentVariable("DOTNET_CLI_TEST_OSX_PATHSD_PATH") ?? @"/etc/paths.d/dotnet-cli-tools"; - public OsxBashEnvironmentPath( + public OsxEnvironmentPath( BashPathUnderHomeDirectory executablePath, IReporter reporter, IEnvironmentProvider environmentProvider, @@ -42,7 +42,7 @@ public void AddPackageExecutablePathToUserPath() return; } - _fileSystem.WriteAllText(DotnetCliToolsPathsDPath, _packageExecutablePath.PathWithTilde); + _fileSystem.WriteAllText(DotnetCliToolsPathsDPath, _packageExecutablePath.Path); } private bool PackageExecutablePathExists() diff --git a/src/Cli/dotnet/ShellShim/OsxZshEnvironmentPathInstruction.cs b/src/Cli/dotnet/ShellShim/OsxZshEnvironmentPathInstruction.cs deleted file mode 100644 index a7ac8a649a7d..000000000000 --- a/src/Cli/dotnet/ShellShim/OsxZshEnvironmentPathInstruction.cs +++ /dev/null @@ -1,56 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -using Microsoft.DotNet.Cli.Utils; -using Microsoft.DotNet.Configurer; -using Microsoft.DotNet.Tools; - -namespace Microsoft.DotNet.ShellShim -{ - internal class OsxZshEnvironmentPathInstruction : IEnvironmentPathInstruction - { - private const string PathName = "PATH"; - private readonly BashPathUnderHomeDirectory _packageExecutablePath; - private readonly IEnvironmentProvider _environmentProvider; - private readonly IReporter _reporter; - - - public OsxZshEnvironmentPathInstruction( - BashPathUnderHomeDirectory executablePath, - IReporter reporter, - IEnvironmentProvider environmentProvider - ) - { - _packageExecutablePath = executablePath; - _environmentProvider - = environmentProvider ?? throw new ArgumentNullException(nameof(environmentProvider)); - _reporter - = reporter ?? throw new ArgumentNullException(nameof(reporter)); - } - - private bool PackageExecutablePathExists() - { - string value = _environmentProvider.GetEnvironmentVariable(PathName); - if (value == null) - { - return false; - } - - return value - .Split(':') - .Any(p => p == _packageExecutablePath.Path); - } - - public void PrintAddPathInstructionIfPathDoesNotExist() - { - if (!PackageExecutablePathExists()) - { - // similar to https://code.visualstudio.com/docs/setup/mac - _reporter.WriteLine( - string.Format( - CommonLocalizableStrings.EnvironmentPathOSXZshManualInstructions, - _packageExecutablePath.Path)); - } - } - } -} diff --git a/src/Cli/dotnet/ShellShim/ZshDetector.cs b/src/Cli/dotnet/ShellShim/ZshDetector.cs deleted file mode 100644 index 82e71703cb3f..000000000000 --- a/src/Cli/dotnet/ShellShim/ZshDetector.cs +++ /dev/null @@ -1,30 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -using Microsoft.DotNet.Cli.Utils; - -namespace Microsoft.DotNet.ShellShim -{ - internal static class ZshDetector - { - private const string ZshFileName = "zsh"; - /// - /// Returns true if the `SHELL` environment variable ends with `zsh` for the filename. - /// - public static bool IsZshTheUsersShell(IEnvironmentProvider environmentProvider) - { - string environmentVariable = environmentProvider.GetEnvironmentVariable("SHELL"); - if (string.IsNullOrWhiteSpace(environmentVariable)) - { - return false; - } - - if (Path.GetFileName(environmentVariable).Equals(ZshFileName, StringComparison.OrdinalIgnoreCase)) - { - return true; - } - - return false; - } - } -} diff --git a/src/Cli/dotnet/xlf/CommonLocalizableStrings.cs.xlf b/src/Cli/dotnet/xlf/CommonLocalizableStrings.cs.xlf index f7bdb5ac0171..94ac35ee401f 100644 --- a/src/Cli/dotnet/xlf/CommonLocalizableStrings.cs.xlf +++ b/src/Cli/dotnet/xlf/CommonLocalizableStrings.cs.xlf @@ -90,37 +90,6 @@ EOF Pokud ho chcete přidat do aktuální relace, slouží k tomuto tento příkaz: -export PATH="$PATH:{0}" - - - - - Tools directory '{0}' is not currently on the PATH environment variable. -If you are using zsh, you can add it to your profile by running the following command: - -cat << \EOF >> ~/.zprofile -# Add .NET Core SDK tools -export PATH="$PATH:{0}" -EOF - -And run `zsh -l` to make it available for current session. - -You can only add it to the current session by running the following command: - -export PATH="$PATH:{0}" - - Adresář nástrojů {0} se aktuálně nenachází v proměnné prostředí PATH. -Pokud používáte zsh, můžete si ho přidat do profilu tak, že spustíte následující příkaz: - -cat << \EOF >> ~/.zprofile -# Přidání nástrojů .NET Core SDK -export PATH="$PATH:{0}" -EOF - -Pak ho spuštěním příkazu zsh -l zpřístupněte pro aktuální relaci. - -Pokud ho chcete přidat do aktuální relace, slouží k tomuto tento příkaz: - export PATH="$PATH:{0}" diff --git a/src/Cli/dotnet/xlf/CommonLocalizableStrings.de.xlf b/src/Cli/dotnet/xlf/CommonLocalizableStrings.de.xlf index 1defd573463a..e71876387142 100644 --- a/src/Cli/dotnet/xlf/CommonLocalizableStrings.de.xlf +++ b/src/Cli/dotnet/xlf/CommonLocalizableStrings.de.xlf @@ -90,37 +90,6 @@ EOF Sie können es der aktuellen Sitzung hinzufügen, indem Sie den folgenden Befehl ausführen: -export PATH="$PATH:{0}" - - - - - Tools directory '{0}' is not currently on the PATH environment variable. -If you are using zsh, you can add it to your profile by running the following command: - -cat << \EOF >> ~/.zprofile -# Add .NET Core SDK tools -export PATH="$PATH:{0}" -EOF - -And run `zsh -l` to make it available for current session. - -You can only add it to the current session by running the following command: - -export PATH="$PATH:{0}" - - Das Toolverzeichnis "{0}" ist aktuell nicht in der PATH-Umgebungsvariable enthalten. -Wenn Sie zsh verwenden, können Sie es Ihrem Profil hinzufügen, indem Sie folgenden Befehl ausführen: - -cat << \EOF >> ~/.zprofile -# Add .NET Core SDK tools -export PATH="$PATH:{0}" -EOF - -Führen Sie anschließend "zsh -l" aus, um das Tool für die aktuelle Sitzung verfügbar zu machen. - -Um es nur der aktuellen Sitzung hinzuzufügen, führen Sie den folgenden Befehl aus: - export PATH="$PATH:{0}" diff --git a/src/Cli/dotnet/xlf/CommonLocalizableStrings.es.xlf b/src/Cli/dotnet/xlf/CommonLocalizableStrings.es.xlf index 3cea6479154f..b8fe8cb96e47 100644 --- a/src/Cli/dotnet/xlf/CommonLocalizableStrings.es.xlf +++ b/src/Cli/dotnet/xlf/CommonLocalizableStrings.es.xlf @@ -90,37 +90,6 @@ EOF Agréguelo a la sesión actual mediante la ejecución del comando siguiente: -export PATH="$PATH:{0}" - - - - - Tools directory '{0}' is not currently on the PATH environment variable. -If you are using zsh, you can add it to your profile by running the following command: - -cat << \EOF >> ~/.zprofile -# Add .NET Core SDK tools -export PATH="$PATH:{0}" -EOF - -And run `zsh -l` to make it available for current session. - -You can only add it to the current session by running the following command: - -export PATH="$PATH:{0}" - - El directorio de herramientas "{0}" no está en la variable de entorno PATH. -Si usa zsh, puede agregarlo a su perfil mediante la ejecución del comando siguiente: - -cat << \EOF >> ~/.zprofile -# Agregue las herramientas del SDK de .NET Core -export PATH="$PATH:{0}" -EOF - -Y ejecute "zsh -l" para que esté disponible para la sesión actual. - -Solo puede agregarlo a la sesión actual ejecutando el comando siguiente: - export PATH="$PATH:{0}" diff --git a/src/Cli/dotnet/xlf/CommonLocalizableStrings.fr.xlf b/src/Cli/dotnet/xlf/CommonLocalizableStrings.fr.xlf index ba4e05a9f6cf..914f0e98d4ec 100644 --- a/src/Cli/dotnet/xlf/CommonLocalizableStrings.fr.xlf +++ b/src/Cli/dotnet/xlf/CommonLocalizableStrings.fr.xlf @@ -90,37 +90,6 @@ EOF Vous pouvez l'ajouter à la session active en exécutant la commande suivante : -export PATH="$PATH:{0}" - - - - - Tools directory '{0}' is not currently on the PATH environment variable. -If you are using zsh, you can add it to your profile by running the following command: - -cat << \EOF >> ~/.zprofile -# Add .NET Core SDK tools -export PATH="$PATH:{0}" -EOF - -And run `zsh -l` to make it available for current session. - -You can only add it to the current session by running the following command: - -export PATH="$PATH:{0}" - - Le répertoire d'outils '{0}' n'est pas dans la variable d'environnement PATH. -Si vous utilisez zsh, vous pouvez l'ajouter à votre profil en exécutant la commande suivante : - -cat << \EOF >> ~/.zprofile -# Ajouter les outils du kit SDK .NET Core -export PATH="$PATH:{0}" -EOF - -Exécutez ensuite 'zsh -l' afin de le rendre disponible pour la session active. - -Vous pouvez uniquement l'ajouter à la session active en exécutant la commande suivante : - export PATH="$PATH:{0}" diff --git a/src/Cli/dotnet/xlf/CommonLocalizableStrings.it.xlf b/src/Cli/dotnet/xlf/CommonLocalizableStrings.it.xlf index 07944103ece3..22f07b0eeb69 100644 --- a/src/Cli/dotnet/xlf/CommonLocalizableStrings.it.xlf +++ b/src/Cli/dotnet/xlf/CommonLocalizableStrings.it.xlf @@ -90,37 +90,6 @@ EOF Per aggiungerla alla sessione corrente, eseguire il comando seguente: -export PATH="$PATH:{0}" - - - - - Tools directory '{0}' is not currently on the PATH environment variable. -If you are using zsh, you can add it to your profile by running the following command: - -cat << \EOF >> ~/.zprofile -# Add .NET Core SDK tools -export PATH="$PATH:{0}" -EOF - -And run `zsh -l` to make it available for current session. - -You can only add it to the current session by running the following command: - -export PATH="$PATH:{0}" - - La directory '{0}' degli strumenti non si trova attualmente nella variabile di ambiente PATH. -Se si usa zsh, è possibile aggiungerla al profilo eseguendo il comando seguente: - -cat << \EOF >> ~/.zprofile -# Aggiungi strumenti .NET Core SDK -export PATH="$PATH:{0}" -EOF - -Eseguire `zsh -l` per renderla disponibile per la sessione corrente. - -Per aggiungerla solo alla sessione corrente, eseguire il comando seguente: - export PATH="$PATH:{0}" diff --git a/src/Cli/dotnet/xlf/CommonLocalizableStrings.ja.xlf b/src/Cli/dotnet/xlf/CommonLocalizableStrings.ja.xlf index d0aa6925f528..fa32f78c9ada 100644 --- a/src/Cli/dotnet/xlf/CommonLocalizableStrings.ja.xlf +++ b/src/Cli/dotnet/xlf/CommonLocalizableStrings.ja.xlf @@ -90,37 +90,6 @@ EOF 次のコマンドを実行して現在のセッションに追加できます。 -export PATH="$PATH:{0}" - - - - - Tools directory '{0}' is not currently on the PATH environment variable. -If you are using zsh, you can add it to your profile by running the following command: - -cat << \EOF >> ~/.zprofile -# Add .NET Core SDK tools -export PATH="$PATH:{0}" -EOF - -And run `zsh -l` to make it available for current session. - -You can only add it to the current session by running the following command: - -export PATH="$PATH:{0}" - - ツール ディレクトリ '{0}' は現在、PATH 環境変数にありません。 -zsh を使用している場合、次のコマンドを実行してプロファイルに追加できます: - -cat << \EOF >> ~/.zprofile -# .NET Core SDK tools -export PATH="$PATH:{0}" -EOF - -`zsh -l` を実行して現在のセッションで利用できるようにします。 - -これは、次のコマンドを実行することによってのみ、現行のセッションに追加できます: - export PATH="$PATH:{0}" diff --git a/src/Cli/dotnet/xlf/CommonLocalizableStrings.ko.xlf b/src/Cli/dotnet/xlf/CommonLocalizableStrings.ko.xlf index c5e95e77e0d8..e5d44c65b039 100644 --- a/src/Cli/dotnet/xlf/CommonLocalizableStrings.ko.xlf +++ b/src/Cli/dotnet/xlf/CommonLocalizableStrings.ko.xlf @@ -90,37 +90,6 @@ EOF 다음 명령을 실행하여 현재 세션에 Bash를 추가할 수 있습니다. -export PATH="$PATH:{0}" - - - - - Tools directory '{0}' is not currently on the PATH environment variable. -If you are using zsh, you can add it to your profile by running the following command: - -cat << \EOF >> ~/.zprofile -# Add .NET Core SDK tools -export PATH="$PATH:{0}" -EOF - -And run `zsh -l` to make it available for current session. - -You can only add it to the current session by running the following command: - -export PATH="$PATH:{0}" - - 도구 디렉터리 '{0}'이(가) 현재 PATH 환경 변수에 없습니다. -zsh를 사용하는 경우 다음 명령을 실행하여 프로필에 zsh를 추가할 수 있습니다. - -cat << \EOF >> ~/.zprofile -# Add .NET Core SDK tools -export PATH="$PATH:{0}" -EOF - -또한 'zsh -l'을 실행하여 현재 세션에 zsh를 사용하도록 설정합니다. - -현재 세션에 추가하려면 다음 명령을 실행해야 합니다. - export PATH="$PATH:{0}" diff --git a/src/Cli/dotnet/xlf/CommonLocalizableStrings.pl.xlf b/src/Cli/dotnet/xlf/CommonLocalizableStrings.pl.xlf index fe436540c9c0..5fcfffb32a07 100644 --- a/src/Cli/dotnet/xlf/CommonLocalizableStrings.pl.xlf +++ b/src/Cli/dotnet/xlf/CommonLocalizableStrings.pl.xlf @@ -90,37 +90,6 @@ EOF Aby dodać go na potrzeby bieżącej sesji, uruchom następujące polecenie: -export PATH="$PATH:{0}" - - - - - Tools directory '{0}' is not currently on the PATH environment variable. -If you are using zsh, you can add it to your profile by running the following command: - -cat << \EOF >> ~/.zprofile -# Add .NET Core SDK tools -export PATH="$PATH:{0}" -EOF - -And run `zsh -l` to make it available for current session. - -You can only add it to the current session by running the following command: - -export PATH="$PATH:{0}" - - Katalog narzędzi „{0}” nie znajduje się obecnie w zmiennej środowiskowej PATH. -Jeśli używasz powłoki zsh, możesz go dodać do swojego profilu, uruchamiając następujące polecenie: - -cat << \EOF >> ~/.zprofile -# Dodaj narzędzia zestawu platformy .NET Core -export PATH="$PATH:{0}" -EOF - -Aby udostępnić go w bieżącej sesji, uruchom polecenie „zsh -l”. - -Możesz go dodać tylko do bieżącej sesji, uruchamiając następujące polecenie: - export PATH="$PATH:{0}" diff --git a/src/Cli/dotnet/xlf/CommonLocalizableStrings.pt-BR.xlf b/src/Cli/dotnet/xlf/CommonLocalizableStrings.pt-BR.xlf index d4483aee4997..a8984013c257 100644 --- a/src/Cli/dotnet/xlf/CommonLocalizableStrings.pt-BR.xlf +++ b/src/Cli/dotnet/xlf/CommonLocalizableStrings.pt-BR.xlf @@ -90,37 +90,6 @@ EOF Você pode adicioná-lo à sessão atual executando o seguinte comando: -export PATH="$PATH:{0}" - - - - - Tools directory '{0}' is not currently on the PATH environment variable. -If you are using zsh, you can add it to your profile by running the following command: - -cat << \EOF >> ~/.zprofile -# Add .NET Core SDK tools -export PATH="$PATH:{0}" -EOF - -And run `zsh -l` to make it available for current session. - -You can only add it to the current session by running the following command: - -export PATH="$PATH:{0}" - - O diretório de ferramentas '{0}' não está na variável de ambiente PATH no momento. -Se você estiver usando zsh, adicione-o ao seu perfil executando o seguinte comando: - -cat << \EOF >> ~/.zprofile -# Add .NET Core SDK tools -export PATH="$PATH:{0}" -EOF - -E execute `zsh -l` para disponibilizá-lo para sua sessão atual. - -Você pode adicioná-lo à sessão atual executando o seguinte comando: - export PATH="$PATH:{0}" diff --git a/src/Cli/dotnet/xlf/CommonLocalizableStrings.ru.xlf b/src/Cli/dotnet/xlf/CommonLocalizableStrings.ru.xlf index 38f3941da111..03adb5f6d691 100644 --- a/src/Cli/dotnet/xlf/CommonLocalizableStrings.ru.xlf +++ b/src/Cli/dotnet/xlf/CommonLocalizableStrings.ru.xlf @@ -90,37 +90,6 @@ EOF Вы можете добавить его в текущий сеанс, выполнив следующую команду: -export PATH="$PATH:{0}" - - - - - Tools directory '{0}' is not currently on the PATH environment variable. -If you are using zsh, you can add it to your profile by running the following command: - -cat << \EOF >> ~/.zprofile -# Add .NET Core SDK tools -export PATH="$PATH:{0}" -EOF - -And run `zsh -l` to make it available for current session. - -You can only add it to the current session by running the following command: - -export PATH="$PATH:{0}" - - Каталог средств "{0}" сейчас не входит в переменную среды PATH. -Если вы используете zsh, можете добавить его в свой профиль, выполнив следующую команду: - -cat << \EOF >> ~/.zprofile -# Добавление средств пакета SDK для .NET Core -export PATH="$PATH:{0}" -EOF - -И выполните команду "zsh -l", чтобы сделать его доступным для текущего сеанса. - -Вы можете добавить его только в текущий сеанс, выполнив следующую команду: - export PATH="$PATH:{0}" diff --git a/src/Cli/dotnet/xlf/CommonLocalizableStrings.tr.xlf b/src/Cli/dotnet/xlf/CommonLocalizableStrings.tr.xlf index 500570fcaeaa..2e70d5df353e 100644 --- a/src/Cli/dotnet/xlf/CommonLocalizableStrings.tr.xlf +++ b/src/Cli/dotnet/xlf/CommonLocalizableStrings.tr.xlf @@ -90,37 +90,6 @@ EOF Şu komutu çalıştırarak geçerli komuta ekleyebilirsiniz: -export PATH="$PATH:{0}" - - - - - Tools directory '{0}' is not currently on the PATH environment variable. -If you are using zsh, you can add it to your profile by running the following command: - -cat << \EOF >> ~/.zprofile -# Add .NET Core SDK tools -export PATH="$PATH:{0}" -EOF - -And run `zsh -l` to make it available for current session. - -You can only add it to the current session by running the following command: - -export PATH="$PATH:{0}" - - '{0}' araçlar dizini şu anda PATH ortam değişkeninde değil. -zsh kullanıyorsanız, aşağıdaki komutu çalıştırarak bunu profilinize ekleyebilirsiniz: - -cat << \EOF >> ~/.zprofile -# .NET Core SDK araçları ekleyin -export PATH="$PATH:{0}" -EOF - -Geçerli oturum için kullanılabilir hale getirmek üzere `zsh -l` komutunu çalıştırın. - -Aşağıdaki komutu çalıştırarak araçlar dizinini yalnızca geçerli oturuma ekleyebilirsiniz: - export PATH="$PATH:{0}" diff --git a/src/Cli/dotnet/xlf/CommonLocalizableStrings.zh-Hans.xlf b/src/Cli/dotnet/xlf/CommonLocalizableStrings.zh-Hans.xlf index de29e4e88760..8160d10877b6 100644 --- a/src/Cli/dotnet/xlf/CommonLocalizableStrings.zh-Hans.xlf +++ b/src/Cli/dotnet/xlf/CommonLocalizableStrings.zh-Hans.xlf @@ -90,37 +90,6 @@ EOF 可运行以下命令将其添加到当前会话: -export PATH="$PATH:{0}" - - - - - Tools directory '{0}' is not currently on the PATH environment variable. -If you are using zsh, you can add it to your profile by running the following command: - -cat << \EOF >> ~/.zprofile -# Add .NET Core SDK tools -export PATH="$PATH:{0}" -EOF - -And run `zsh -l` to make it available for current session. - -You can only add it to the current session by running the following command: - -export PATH="$PATH:{0}" - - 工具目录 "{0}" 当前不在 PATH 环境变量上。 -如果使用的是 zsh,可运行以下命令直接将其添加到配置文件: - -cat << \EOF >> ~/.zprofile -# 添加 .NET Core SDK 工具 -export PATH="$PATH:{0}" -EOF - -并运行 `zsh -l` 使其用于当前会话。 - -只可通过运行以下命令将其添加到当前会话: - export PATH="$PATH:{0}" diff --git a/src/Cli/dotnet/xlf/CommonLocalizableStrings.zh-Hant.xlf b/src/Cli/dotnet/xlf/CommonLocalizableStrings.zh-Hant.xlf index d5b225ea08f3..431d2d610879 100644 --- a/src/Cli/dotnet/xlf/CommonLocalizableStrings.zh-Hant.xlf +++ b/src/Cli/dotnet/xlf/CommonLocalizableStrings.zh-Hant.xlf @@ -90,37 +90,6 @@ EOF 您可執行下列命令,將其新增至目前的工作階段: -export PATH="$PATH:{0}" - - - - - Tools directory '{0}' is not currently on the PATH environment variable. -If you are using zsh, you can add it to your profile by running the following command: - -cat << \EOF >> ~/.zprofile -# Add .NET Core SDK tools -export PATH="$PATH:{0}" -EOF - -And run `zsh -l` to make it available for current session. - -You can only add it to the current session by running the following command: - -export PATH="$PATH:{0}" - - 工具目錄 '{0}' 目前不在 PATH 環境變數上。 -如果您在使用 zsh,可以執行以下命令將其新增至您的設定檔: - -cat << \EOF >> ~/.zprofile -# 新增 .NET Core SDK 工具 -export PATH="$PATH:{0}" -EOF - -並執行 `zsh -l` 讓其可用於目前的工作階段。 - -您只能執行以下命令將其新增至目前的工作階段: - export PATH="$PATH:{0}" diff --git a/src/Tests/Microsoft.DotNet.ShellShim.Tests/EnvironmentPathFactoryTests.cs b/src/Tests/Microsoft.DotNet.ShellShim.Tests/EnvironmentPathFactoryTests.cs index 5b1cf56e197a..5aeb60a6515c 100644 --- a/src/Tests/Microsoft.DotNet.ShellShim.Tests/EnvironmentPathFactoryTests.cs +++ b/src/Tests/Microsoft.DotNet.ShellShim.Tests/EnvironmentPathFactoryTests.cs @@ -9,35 +9,17 @@ namespace Microsoft.DotNet.ShellShim.Tests public class EnvironmentPathFactoryTests { [MacOsOnlyFact] - public void GivenFollowingEnvironmentVariableValueItCanReturnOsxZshEnvironmentPathInstruction() + public void GivenFollowingEnvironmentVariableValueItShouldReturnOsxEnvironmentPath() { Mock provider = new Mock(MockBehavior.Strict); - provider - .Setup(p => p.GetEnvironmentVariable("SHELL")) - .Returns("/bin/zsh"); - - IEnvironmentPathInstruction result = - EnvironmentPathFactory.CreateEnvironmentPathInstruction(provider.Object); - (result is OsxZshEnvironmentPathInstruction).Should().BeTrue(); - } - - [MacOsOnlyFact] - public void GivenFollowingEnvironmentVariableValueItShouldReturnOsxBashEnvironmentPath() - { - Mock provider = new Mock(MockBehavior.Strict); - - provider - .Setup(p => p.GetEnvironmentVariable("SHELL")) - .Returns("/bin/bash"); - IEnvironmentPathInstruction result = EnvironmentPathFactory.CreateEnvironmentPathInstruction(provider.Object); - (result is OsxBashEnvironmentPath).Should().BeTrue(); + (result is OsxEnvironmentPath).Should().BeTrue(); } [WindowsOnlyFact] - public void GivenWindowsItShouldReturnOsxBashEnvironmentPath() + public void GivenWindowsItShouldReturnWindowsEnvironmentPath() { Mock provider = new Mock(MockBehavior.Loose); @@ -47,7 +29,7 @@ public void GivenWindowsItShouldReturnOsxBashEnvironmentPath() } [LinuxOnlyFact] - public void GivenLinuxItShouldReturnOsxBashEnvironmentPath() + public void GivenLinuxItShouldReturnLinuxEnvironmentPath() { Mock provider = new Mock(MockBehavior.Loose); diff --git a/src/Tests/Microsoft.DotNet.ShellShim.Tests/OsxEnvironmentPathTests.cs b/src/Tests/Microsoft.DotNet.ShellShim.Tests/OsxEnvironmentPathTests.cs index 0639f79564b4..190a97b3f4ca 100644 --- a/src/Tests/Microsoft.DotNet.ShellShim.Tests/OsxEnvironmentPathTests.cs +++ b/src/Tests/Microsoft.DotNet.ShellShim.Tests/OsxEnvironmentPathTests.cs @@ -24,7 +24,7 @@ public void GivenPathNotSetItPrintsManualInstructions() .Setup(p => p.GetEnvironmentVariable("PATH")) .Returns(pathValue); - var environmentPath = new OsxBashEnvironmentPath( + var environmentPath = new OsxEnvironmentPath( toolsPath, reporter, provider.Object, @@ -50,12 +50,12 @@ public void GivenPathNotSetAndProfileExistsItPrintsReopenMessage() .Setup(p => p.GetEnvironmentVariable("PATH")) .Returns(pathValue); - var environmentPath = new OsxBashEnvironmentPath( + var environmentPath = new OsxEnvironmentPath( toolsPath, reporter, provider.Object, new FileSystemMockBuilder() - .AddFile(OsxBashEnvironmentPath.DotnetCliToolsPathsDPath, "") + .AddFile(OsxEnvironmentPath.DotnetCliToolsPathsDPath, "") .Build() .File); @@ -78,7 +78,7 @@ public void GivenPathSetItPrintsNothing(string toolsDirectoryOnPath) .Setup(p => p.GetEnvironmentVariable("PATH")) .Returns(pathValue + ":" + toolsDirectoryOnPath); - var environmentPath = new OsxBashEnvironmentPath( + var environmentPath = new OsxEnvironmentPath( toolsPath, reporter, provider.Object, @@ -102,7 +102,7 @@ public void GivenPathSetItDoesNotAddPathToEnvironment() .Setup(p => p.GetEnvironmentVariable("PATH")) .Returns(pathValue + ":" + toolsPath.Path); - var environmentPath = new OsxBashEnvironmentPath( + var environmentPath = new OsxEnvironmentPath( toolsPath, reporter, provider.Object, @@ -113,7 +113,7 @@ public void GivenPathSetItDoesNotAddPathToEnvironment() reporter.Lines.Should().BeEmpty(); fileSystem - .Exists(OsxBashEnvironmentPath.DotnetCliToolsPathsDPath) + .Exists(OsxEnvironmentPath.DotnetCliToolsPathsDPath) .Should() .Be(false); } @@ -132,7 +132,7 @@ public void GivenPathNotSetItAddsToEnvironment() .Setup(p => p.GetEnvironmentVariable("PATH")) .Returns(pathValue); - var environmentPath = new OsxBashEnvironmentPath( + var environmentPath = new OsxEnvironmentPath( toolsPath, reporter, provider.Object, @@ -144,9 +144,9 @@ public void GivenPathNotSetItAddsToEnvironment() fileSystem .File - .ReadAllText(OsxBashEnvironmentPath.DotnetCliToolsPathsDPath) + .ReadAllText(OsxEnvironmentPath.DotnetCliToolsPathsDPath) .Should() - .Be(toolsPath.PathWithTilde); + .Be(toolsPath.Path); } } } diff --git a/src/Tests/Microsoft.DotNet.ShellShim.Tests/OsxZshEnvironmentPathInstructionTests.cs b/src/Tests/Microsoft.DotNet.ShellShim.Tests/OsxZshEnvironmentPathInstructionTests.cs deleted file mode 100644 index 188a0aaacaf8..000000000000 --- a/src/Tests/Microsoft.DotNet.ShellShim.Tests/OsxZshEnvironmentPathInstructionTests.cs +++ /dev/null @@ -1,101 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -using Microsoft.DotNet.Cli.Utils; -using Microsoft.DotNet.Configurer; -using Microsoft.DotNet.Tools; -using Moq; - -namespace Microsoft.DotNet.ShellShim.Tests -{ - public class OsxZshEnvironmentPathInstructionTests - { - [UnixOnlyFact] - public void GivenPathNotSetItPrintsManualInstructions() - { - BufferedReporter reporter = new BufferedReporter(); - BashPathUnderHomeDirectory toolsPath = new BashPathUnderHomeDirectory( - "/home/user", - ".dotnet/tools"); - string pathValue = @"/usr/bin"; - Mock provider = new Mock(MockBehavior.Strict); - - provider - .Setup(p => p.GetEnvironmentVariable("PATH")) - .Returns(pathValue); - - provider - .Setup(p => p.GetEnvironmentVariable("SHELL")) - .Returns("/bin/bash"); - - OsxZshEnvironmentPathInstruction environmentPath = new OsxZshEnvironmentPathInstruction( - toolsPath, - reporter, - provider.Object); - - environmentPath.PrintAddPathInstructionIfPathDoesNotExist(); - - reporter.Lines.Should().Equal( - string.Format( - CommonLocalizableStrings.EnvironmentPathOSXZshManualInstructions, - toolsPath.Path)); - } - - [UnixOnlyTheory] - [InlineData("/home/user/.dotnet/tools")] - public void GivenPathSetItPrintsNothing(string toolsDirectoryOnPath) - { - BufferedReporter reporter = new BufferedReporter(); - BashPathUnderHomeDirectory toolsPath = new BashPathUnderHomeDirectory( - "/home/user", - ".dotnet/tools"); - string pathValue = @"/usr/bin"; - Mock provider = new Mock(MockBehavior.Strict); - - provider - .Setup(p => p.GetEnvironmentVariable("PATH")) - .Returns(pathValue + ":" + toolsDirectoryOnPath); - - OsxZshEnvironmentPathInstruction environmentPath = new OsxZshEnvironmentPathInstruction( - toolsPath, - reporter, - provider.Object); - - environmentPath.PrintAddPathInstructionIfPathDoesNotExist(); - - reporter.Lines.Should().BeEmpty(); - } - - [UnixOnlyTheory] - [InlineData("~/.dotnet/tools")] - public void GivenPathSetItPrintsInstruction(string toolsDirectoryOnPath) - { - BufferedReporter reporter = new BufferedReporter(); - BashPathUnderHomeDirectory toolsPath = new BashPathUnderHomeDirectory( - "/home/user", - ".dotnet/tools"); - string pathValue = @"/usr/bin"; - Mock provider = new Mock(MockBehavior.Strict); - - provider - .Setup(p => p.GetEnvironmentVariable("PATH")) - .Returns(pathValue + ":" + toolsDirectoryOnPath); - - provider - .Setup(p => p.GetEnvironmentVariable("SHELL")) - .Returns("/bin/zsh"); - - OsxZshEnvironmentPathInstruction environmentPath = new OsxZshEnvironmentPathInstruction( - toolsPath, - reporter, - provider.Object); - - environmentPath.PrintAddPathInstructionIfPathDoesNotExist(); - - reporter.Lines.Should().Equal( - string.Format( - CommonLocalizableStrings.EnvironmentPathOSXZshManualInstructions, - toolsPath.Path)); - } - } -} diff --git a/src/Tests/Microsoft.DotNet.ShellShim.Tests/ZshDetectorTests.cs b/src/Tests/Microsoft.DotNet.ShellShim.Tests/ZshDetectorTests.cs deleted file mode 100644 index 4704fddb4b02..000000000000 --- a/src/Tests/Microsoft.DotNet.ShellShim.Tests/ZshDetectorTests.cs +++ /dev/null @@ -1,40 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -using Microsoft.DotNet.Cli.Utils; -using Moq; - -namespace Microsoft.DotNet.ShellShim.Tests -{ - public class ZshDetectorTests - { - [Theory] - [InlineData("/bin/zsh")] - [InlineData("/other-place/zsh")] - public void GivenFollowingEnvironmentVariableValueItCanDetectZsh(string environmentVariableValue) - { - Mock provider = new Mock(MockBehavior.Strict); - - provider - .Setup(p => p.GetEnvironmentVariable("SHELL")) - .Returns(environmentVariableValue); - - ZshDetector.IsZshTheUsersShell(provider.Object).Should().BeTrue(); - } - - [Theory] - [InlineData("/bin/bash")] - [InlineData("/other/value")] - [InlineData(null)] - public void GivenFollowingEnvironmentVariableValueItCanDetectItIsNotZsh(string environmentVariableValue) - { - Mock provider = new Mock(MockBehavior.Strict); - - provider - .Setup(p => p.GetEnvironmentVariable("SHELL")) - .Returns(environmentVariableValue); - - ZshDetector.IsZshTheUsersShell(provider.Object).Should().BeFalse(); - } - } -}