Home Software Development GitHub Copilot for CLI for PowerShell

GitHub Copilot for CLI for PowerShell

0
GitHub Copilot for CLI for PowerShell

[ad_1]


GitHub Subsequent has this cool venture that’s mainly Copilot for the CLI (command line interface). You’ll be able to join their waitlist on the Copilot for CLI website.

Copilot for CLI gives three shell instructions: ??, git? and gh?

That is cool and all, however I take advantage of PowerShell. Seems these ?? instructions are simply router instructions to a bigger EXE known as github-copilot-cli. So for those who go “?? one thing” you are actually going “github-copilot-cli what-the-shell one thing.”

So this implies I ought to be capable to to do the identical/related aliases for my PowerShell immediate AND change the injected immediate (have a look at me I am a immediate engineer) so as to add ‘use powershell to.’

Now it is not excellent, however hopefully it would make the purpose to the Copilot CLI crew that PowerShell wants love additionally.

Listed below are my aliases. Be happy to recommend if these suck. Notice the addition of “consumer powershell to” for the ?? one. I’ll make a ?? and a p? the place one does bash and one does PowerShell. I may even have it use wsl.exe and shell out to bash. A lot of prospects.

operate ?? { 
$TmpFile = New-TemporaryFile
github-copilot-cli what-the-shell ('use powershell to ' + $args) --shellout $TmpFile
if ([System.IO.File]::Exists($TmpFile)) {
$TmpFileContents = Get-Content material $TmpFile
if ($TmpFileContents -ne $nill) {
Invoke-Expression $TmpFileContents
Take away-Merchandise $TmpFile
}
}
}

operate git? {
$TmpFile = New-TemporaryFile
github-copilot-cli git-assist $args --shellout $TmpFile
if ([System.IO.File]::Exists($TmpFile)) {
$TmpFileContents = Get-Content material $TmpFile
if ($TmpFileContents -ne $nill) {
Invoke-Expression $TmpFileContents
Take away-Merchandise $TmpFile
}
}
}
operate gh? {
$TmpFile = New-TemporaryFile
github-copilot-cli gh-assist $args --shellout $TmpFile
if ([System.IO.File]::Exists($TmpFile)) {
$TmpFileContents = Get-Content material $TmpFile
if ($TmpFileContents -ne $nill) {
Invoke-Expression $TmpFileContents
Take away-Merchandise $TmpFile
}
}
}

It additionally then provides to run the command. Very clean.

image

Hope you prefer it. A lot of enjoyable stuff occurring on this area.




About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, guide, father, diabetic, and Microsoft worker. He’s a failed stand-up comedian, a cornrower, and a ebook creator.

facebook
twitter
subscribe
About   E-newsletter

Internet hosting By
Hosted in an Azure App Service










[ad_2]

LEAVE A REPLY

Please enter your comment!
Please enter your name here