GitHub Copilot for CLI for PowerShell

GitHub Copilot for CLI for PowerShell



GitHub Subsequent has this cool undertaking that’s mainly Copilot for the CLI (command line interface). You may join their waitlist on the Copilot for CLI website.

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

That is cool and all, however I exploit PowerShell. Seems these ?? instructions are simply router instructions to a bigger EXE referred to as github-copilot-cli. So in the event you go “?? one thing” you are actually going “github-copilot-cli what-the-shell one thing.”

So this implies I ought to be capable of 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 isn’t excellent, however hopefully it’ll make the purpose to the Copilot CLI crew that PowerShell wants love additionally.

Listed here are my aliases. Be happy to counsel if these suck. Be aware the addition of “person 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 potentialities.

perform ?? { 
$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
}
}
}

perform 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
}
}
}
perform 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 gives to run the command. Very clean.

image

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




About Scott

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

facebook
bluesky
subscribe
About   E-newsletter

Internet hosting By
Hosted on Linux using .NET in an Azure App Service








author avatar
roosho Senior Engineer (Technical Services)
I am Rakib Raihan RooSho, Jack of all IT Trades. You got it right. Good for nothing. I try a lot of things and fail more than that. That's how I learn. Whenever I succeed, I note that in my cookbook. Eventually, that became my blog. 
rooshohttps://www.roosho.com
I am Rakib Raihan RooSho, Jack of all IT Trades. You got it right. Good for nothing. I try a lot of things and fail more than that. That's how I learn. Whenever I succeed, I note that in my cookbook. Eventually, that became my blog. 

Related Articles

LEAVE A REPLY

Please enter your comment!
Please enter your name here


Latest Articles

author avatar
roosho Senior Engineer (Technical Services)
I am Rakib Raihan RooSho, Jack of all IT Trades. You got it right. Good for nothing. I try a lot of things and fail more than that. That's how I learn. Whenever I succeed, I note that in my cookbook. Eventually, that became my blog.