gh-copilot icon indicating copy to clipboard operation
gh-copilot copied to clipboard

[BUG]: alias

Open lanceyliao opened this issue 1 year ago • 3 comments

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>

lanceyliao avatar Apr 16 '24 03:04 lanceyliao

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!

mxie avatar Apr 30 '24 15:04 mxie

Thanks for the reply, it didn't work.

lanceyliao avatar May 01 '24 14:05 lanceyliao

@mxie I still get that issue. How to mitigate it?

At C:\Users\ErichJS\Documents\WindowsPowerShell\gh-copilot.ps1:1 char:15

  • function ghcs {
  •           ~
    

Missing closing '}' in statement block or type definition. At C:\Users\ErichJS\Documents\WindowsPowerShell\gh-copilot.ps1:63 char:1

  • }
  • ~ Unexpected token '}' in expression or statement. At C:\Users\ErichJS\Documents\WindowsPowerShell\gh-copilot.ps1:65 char:15
  • function ghce {
  •           ~
    

Missing closing '}' in statement block or type definition. At C:\Users\ErichJS\Documents\WindowsPowerShell\gh-copilot.ps1:94 char:1

  • }
  • ~ Unexpected token '}' in expression or statement.
    • CategoryInfo : ParserError: (:) [], ParseException
    • FullyQualifiedErrorId : MissingEndCurlyBrace

At C:\Users\ErichJS\Documents\WindowsPowerShell\gh-copilot.ps1:1 char:15

  • function ghcs {
  •           ~
    

Missing closing '}' in statement block or type definition. At C:\Users\ErichJS\Documents\WindowsPowerShell\gh-copilot.ps1:63 char:1

  • }
  • ~ Unexpected token '}' in expression or statement. At C:\Users\ErichJS\Documents\WindowsPowerShell\gh-copilot.ps1:65 char:15
  • function ghce {
  •           ~
    

Missing closing '}' in statement block or type definition. At C:\Users\ErichJS\Documents\WindowsPowerShell\gh-copilot.ps1:94 char:1

  • }
  • ~ Unexpected token '}' in expression or statement.
    • CategoryInfo : ParserError: (:) [], ParseException
    • FullyQualifiedErrorId : MissingEndCurlyBrace

ghost avatar Aug 19 '24 09:08 ghost

Image

clean -> end

lanceyliao avatar Jan 20 '25 07:01 lanceyliao