GitHub Copilot for CLI for PowerShell

.
.

GitHub Next has this cool task that is essentially Copilot for the CLI (command line user interface). You can register for their waitlist at the Copilot for CLI website

Copilot for CLI supplies 3 shell commands: ??, git? and gh?

This is cool and all, however I utilize PowerShell. Ends up these?? commands are simply router commands to a bigger EXE called github-copilot-cli. So if you go “?? something” you’re actually going “github-copilot-cli what-the-shell something.”

So this suggests I must have the ability to to do the same/similar aliases for my PowerShell timely AND alter the injected timely (take a look at me I’m a timely engineer) to include ‘utilize powershell to.’

Now it’s not best, however ideally it will make the indicate the Copilot CLI group that PowerShell requires love likewise.

Here are my aliases. Do not hesitate to recommend if these suck. Keep in mind the addition of “user powershell to” for the?? one. I may make a?? and a p? where one does slam and one does PowerShell. I might likewise have it utilize wsl.exe and spend to slam. Great deals of possibilities.

 function?? {
$ TmpFile = New-TemporaryFile
github-copilot-cli what-the-shell (' usage powershell to' + $args)-- shellout $TmpFile
if ([System.IO.File]:: Exists($ TmpFile)) {
$ TmpFileContents = Get-Content $TmpFile
if ($ TmpFileContents -ne $nill) {
Invoke-Expression $TmpFileContents
Remove-Item $TmpFile
}
}
}

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

It likewise then uses to run the command. Really smooth.

image

Hope you like it. Great deals of enjoyable things taking place in this area.

.
.
. .

About Scott

Scott Hanselman is a previous teacher, previous Chief Designer in financing, now speaker, specialist, daddy, diabetic, and Microsoft staff member. He is an unsuccessful comic, a cornrower, and a book author.

facebook
twitter
subscribe
About Newsletter

Hosting By
Hosted in an Azure App Service

.
.
.
.
.
. . .



.

Like this post? Please share to your friends:
Leave a Reply

;-) :| :x :twisted: :smile: :shock: :sad: :roll: :razz: :oops: :o :mrgreen: :lol: :idea: :grin: :evil: :cry: :cool: :arrow: :???: :?: :!: