github / gh-copilot

Ask for assistance right in your terminal.
https://docs.github.com/en/copilot/github-copilot-in-the-cli
618 stars 21 forks source link

[BUG]: alias #68

Open lanceyliao opened 3 months ago

lanceyliao commented 3 months ago

Thanks for taking the time to fill out this out! :bow: By submitting this issue, you agree to follow our Code of Conduct.

What happened?

What did you do? What happened? What did you expect to happen?

$GH_COPILOT_PROFILE = Join-Path -Path $(Split-Path -Path $PROFILE -Parent) -ChildPath "gh-copilot.ps1"
gh copilot alias -- pwsh | Out-File ( New-Item -Path $GH_COPILOT_PROFILE -Force )
echo ". $GH_COPILOT_PROFILE" >> $PROFILE

At this point the alias doesn't take effect, and opening a new powershell window results in a bug

Versions

1.0.1

Relevant terminal output

Please copy and paste any relevant terminal output. Please check your output before submission to ensure sensitive information is redacted.

Windows PowerShell
版权所有 (C) Microsoft Corporation。保留所有权利。

尝试新的跨平台 PowerShell https://aka.ms/pscore6

所在位置 C:\Users\admin\Documents\WindowsPowerShell\gh-copilot.ps1:1 字符: 15
+ function ghcs {
+               ~
语句块或类型定义中缺少右“}”。
所在位置 C:\Users\admin\Documents\WindowsPowerShell\gh-copilot.ps1:57 字符: 1
+ }
+ ~
表达式或语句中包含意外的标记“}”。
所在位置 C:\Users\admin\Documents\WindowsPowerShell\gh-copilot.ps1:59 字符: 15
+ function ghce {
+               ~
语句块或类型定义中缺少右“}”。
所在位置 C:\Users\admin\Documents\WindowsPowerShell\gh-copilot.ps1:81 字符: 1
+ }
+ ~
表达式或语句中包含意外的标记“}”。
    + CategoryInfo          : ParserError: (:) [], ParseException
    + FullyQualifiedErrorId : MissingEndCurlyBrace

加载个人及系统配置文件用了 700 毫秒。
(base) PS C:\Windows\system32>
mxie commented 2 months ago

Thanks for your report! We've pushed an update to our docs for the PowerShell setup. Please try running the following instead:

$GH_COPILOT_PROFILE = Join-Path -Path $(Split-Path -Path $PROFILE -Parent) -ChildPath "gh-copilot.ps1"
gh copilot alias -- pwsh | Out-File ( New-Item -Path $GH_COPILOT_PROFILE -Force )
echo ". `"$GH_COPILOT_PROFILE`"" >> $PROFILE

Let me know if this fixes anything!

lanceyliao commented 2 months ago

Thanks for the reply, it didn't work.