From 5be50fc52e8080cd09b1867983cc6764175fb124 Mon Sep 17 00:00:00 2001 From: Bryan Acosta Date: Fri, 14 Jun 2024 00:58:23 -0500 Subject: [PATCH 1/4] docs: add a single-line command to update the PowerShell profile --- docs/guides/quick-start.md | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/docs/guides/quick-start.md b/docs/guides/quick-start.md index df226931..0872a481 100644 --- a/docs/guides/quick-start.md +++ b/docs/guides/quick-start.md @@ -105,21 +105,11 @@ echo 'vfox activate fish | source' >> ~/.config/fish/config.fish ::: details Powershell -Open PowerShell Profile: - ```shell -New-Item -Type File -Path $PROFILE # Just ignore the 'file already exists' error. - -# If it prompts "Unable to find the path", then you need to forcefully create profile. Add the "-Force" option. -# New-Item -Type File -Path $PROFILE –Force - -Invoke-Item $PROFILE # open Profile -``` - -Add the following line to the end of your profile and save: +if (-not (Test-Path -Path $PROFILE)) { New-Item -Type File -Path $PROFILE -Force }; Add-Content -Path $PROFILE -Value 'Invoke-Expression "$(vfox activate pwsh)"' -```shell -Invoke-Expression "$(vfox activate pwsh)" +# Create profile if it does not exist: New-Item -Type File -Path $PROFILE -Force +# Add content to profile: Add-Content -Path $PROFILE -Value 'Invoke-Expression "$(vfox activate pwsh)"' ``` If Powershell prompts:`cannot be loaded because the execution of scripts is disabled on this system`.**Open PowerShell** with **Run as Administrator**.Then, run this command in PowerShell From 67c041fdad06141d49677dbdc1e5daf5cb3815b9 Mon Sep 17 00:00:00 2001 From: Bryan Acosta Date: Tue, 18 Jun 2024 23:49:57 -0500 Subject: [PATCH 2/4] docs: add chinese translation for PowerShell profile update command --- README.md | 6 +----- README_CN.md | 8 ++------ docs/guides/quick-start.md | 4 ++-- docs/zh-hans/guides/quick-start.md | 14 +++----------- 4 files changed, 8 insertions(+), 24 deletions(-) diff --git a/README.md b/README.md index dd8ba41e..96d5da43 100644 --- a/README.md +++ b/README.md @@ -48,11 +48,7 @@ echo 'eval "$(vfox activate zsh)"' >> ~/.zshrc echo 'vfox activate fish | source' >> ~/.config/fish/config.fish # For PowerShell: -# 1. Open PowerShell Profile: -New-Item -Type File -Path $PROFILE # Just ignore the 'file already exists' error. -Invoke-Item $PROFILE -# 2. Add the following line to the end of your $PROFILE and save: -Invoke-Expression "$(vfox activate pwsh)" +if (-not (Test-Path -Path $PROFILE)) { New-Item -Type File -Path $PROFILE -Force }; Add-Content -Path $PROFILE -Value 'Invoke-Expression "$(vfox activate pwsh)"' # For Clink: # 1. Install clink: https://github.com/chrisant996/clink/releases diff --git a/README_CN.md b/README_CN.md index 9b0fa0ac..bb4e28f4 100644 --- a/README_CN.md +++ b/README_CN.md @@ -43,12 +43,8 @@ echo 'eval "$(vfox activate bash)"' >> ~/.bashrc echo 'eval "$(vfox activate zsh)"' >> ~/.zshrc echo 'vfox activate fish | source' >> ~/.config/fish/config.fish -# PowerShell: -# 1. 打开 PowerShell 配置文件: -New-Item -Type File -Path $PROFILE # 无需在意 `文件已存在` 错误 -Invoke-Item $PROFILE -# 2. 将下面一行添加到你的 $PROFILE 文件末尾并保存: -Invoke-Expression "$(vfox activate pwsh)" +# 对于 PowerShell +if (-not (Test-Path -Path $PROFILE)) { New-Item -Type File -Path $PROFILE -Force }; Add-Content -Path $PROFILE -Value 'Invoke-Expression "$(vfox activate pwsh)"' # Clink: # 1. 安装 clink: https://github.com/chrisant996/clink/releases diff --git a/docs/guides/quick-start.md b/docs/guides/quick-start.md index 0872a481..dfacaf5a 100644 --- a/docs/guides/quick-start.md +++ b/docs/guides/quick-start.md @@ -108,8 +108,8 @@ echo 'vfox activate fish | source' >> ~/.config/fish/config.fish ```shell if (-not (Test-Path -Path $PROFILE)) { New-Item -Type File -Path $PROFILE -Force }; Add-Content -Path $PROFILE -Value 'Invoke-Expression "$(vfox activate pwsh)"' -# Create profile if it does not exist: New-Item -Type File -Path $PROFILE -Force -# Add content to profile: Add-Content -Path $PROFILE -Value 'Invoke-Expression "$(vfox activate pwsh)"' +# Create the profile file: New-Item -Type File -Path $PROFILE -Force +# Add content to profile file: Add-Content -Path $PROFILE -Value 'Invoke-Expression "$(vfox activate pwsh)"' ``` If Powershell prompts:`cannot be loaded because the execution of scripts is disabled on this system`.**Open PowerShell** with **Run as Administrator**.Then, run this command in PowerShell diff --git a/docs/zh-hans/guides/quick-start.md b/docs/zh-hans/guides/quick-start.md index 97069cc8..c08fdfc8 100644 --- a/docs/zh-hans/guides/quick-start.md +++ b/docs/zh-hans/guides/quick-start.md @@ -109,18 +109,10 @@ echo 'vfox activate fish | source' >> ~/.config/fish/config.fish 打开 PowerShell 配置文件: ```shell -New-Item -Type File -Path $PROFILE # 无需在意 `文件已存在` 错误 +if (-not (Test-Path -Path $PROFILE)) { New-Item -Type File -Path $PROFILE -Force }; Add-Content -Path $PROFILE -Value 'Invoke-Expression "$(vfox activate pwsh)"' -# 如果它提示未能找到路径,那么你需要强制创建profile。添加"-Force"选项。 -# New-Item -Type File -Path $PROFILE –Force - -Invoke-Item $PROFILE # 打开profile -``` - -将下面一行添加到你的 $PROFILE 文件末尾并保存: - -```shell -Invoke-Expression "$(vfox activate pwsh)" +# 创建配置文件: New-Item -Type File -Path $PROFILE -Force +# 向配置文件添加内容: Add-Content -Path $PROFILE -Value 'Invoke-Expression "$(vfox activate pwsh)"' ``` 如果powershell提示:`在此系统上禁止运行脚本`,那么请你**以管理员身份重新运行powershell**输入如下命令 From 13ab84476db6735e3e3f14df3fd1567f281e77d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=87=8E=E5=A3=B0?= Date: Thu, 20 Jun 2024 20:07:11 +0800 Subject: [PATCH 3/4] Update quick-start.md --- docs/zh-hans/guides/quick-start.md | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/docs/zh-hans/guides/quick-start.md b/docs/zh-hans/guides/quick-start.md index c08fdfc8..89b9cc61 100644 --- a/docs/zh-hans/guides/quick-start.md +++ b/docs/zh-hans/guides/quick-start.md @@ -104,22 +104,19 @@ echo 'vfox activate fish | source' >> ~/.config/fish/config.fish ::: -::: details Powershell +::: details PowerShell -打开 PowerShell 配置文件: +创建 PowerShell 配置: ```shell if (-not (Test-Path -Path $PROFILE)) { New-Item -Type File -Path $PROFILE -Force }; Add-Content -Path $PROFILE -Value 'Invoke-Expression "$(vfox activate pwsh)"' - -# 创建配置文件: New-Item -Type File -Path $PROFILE -Force -# 向配置文件添加内容: Add-Content -Path $PROFILE -Value 'Invoke-Expression "$(vfox activate pwsh)"' ``` -如果powershell提示:`在此系统上禁止运行脚本`,那么请你**以管理员身份重新运行powershell**输入如下命令 +如果 PowerShell 提示:`在此系统上禁止运行脚本`,那么请你**以管理员身份重新运行 PowerShell**输入如下命令 ```shell Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -# 之后输入Y,按回车 +# 之后输入 Y,按回车 y ``` From 5be66366bcd019bb1b3d500cdeb460c43e1edd11 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=87=8E=E5=A3=B0?= Date: Thu, 20 Jun 2024 20:08:02 +0800 Subject: [PATCH 4/4] Update quick-start.md --- docs/guides/quick-start.md | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/docs/guides/quick-start.md b/docs/guides/quick-start.md index dfacaf5a..71c6465a 100644 --- a/docs/guides/quick-start.md +++ b/docs/guides/quick-start.md @@ -103,16 +103,13 @@ echo 'vfox activate fish | source' >> ~/.config/fish/config.fish ::: -::: details Powershell +::: details PowerShell -```shell +```PowerShell if (-not (Test-Path -Path $PROFILE)) { New-Item -Type File -Path $PROFILE -Force }; Add-Content -Path $PROFILE -Value 'Invoke-Expression "$(vfox activate pwsh)"' - -# Create the profile file: New-Item -Type File -Path $PROFILE -Force -# Add content to profile file: Add-Content -Path $PROFILE -Value 'Invoke-Expression "$(vfox activate pwsh)"' ``` -If Powershell prompts:`cannot be loaded because the execution of scripts is disabled on this system`.**Open PowerShell** with **Run as Administrator**.Then, run this command in PowerShell +If PowerShell prompts: `cannot be loaded because the execution of scripts is disabled on this system`.**Open PowerShell** with **Run as Administrator**.Then, run this command in PowerShell ```shell Set-ExecutionPolicy -ExecutionPolicy RemoteSigned