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

Provide support for PowerShell Desktop 5.x

Open andyfeller opened this issue 1 year ago • 1 comments

Overview

This is a follow up to #38 regarding extending the gh copilot alias support for PowerShell to include PowerShell Desktop. As explained by @xt0rted below, the current design of the ghcs function takes advantage of features not backwards compatible with PowerShell 5.x:

Could you elaborate on why you might need that?

@andyfeller by using the clean block the aliases require powershell core 7.3+. Any version older than that, including the original windows only version, will give an error about missing closing }.

At C:\Users\brian\OneDrive\Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1:89 char:15
+ function ghcs {
+               ~
Missing closing '}' in statement block or type definition.
At C:\Users\brian\OneDrive\Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1:145 char:1
+ }
+ ~
Unexpected token '}' in expression or statement.
At C:\Users\brian\OneDrive\Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1:147 char:15
+ function ghce {
+               ~
Missing closing '}' in statement block or type definition.
At C:\Users\brian\OneDrive\Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1:169 char:1
+ }

+ ~

Unexpected token '}' in expression or statement.

    + CategoryInfo          : ParserError: (:) [], ParseException

    + FullyQualifiedErrorId : MissingEndCurlyBrace

powershell.exe is the old version and is 5.1 on my machine, while pwsh.exe is the newer cross platform version.

Originally posted by @xt0rted in #38

andyfeller avatar Mar 23 '24 00:03 andyfeller

It may be helpful adding that this is only supported by powershell 7+, as by default terminal in windows 11 uses powershell 5.

Pokeylooted avatar Apr 20 '24 23:04 Pokeylooted