Many blog show that they can use GitHub Copilot with ?? .... However, according to the official docs, you can only use it with gh copilot explain ... or gh copilot suggest ....
I have found that their difference is the way of installation:
npm install -g @githubnext/github-copilot-cligh extension install github/gh-copilotI have tried to install with npm, but when I tried to auth it with my GitHub account, it told me that I'm not on the waitlist and refused. However, the waitlist doesn't exist now because this tool is in beta stage.
PS: I'm a college student, so my copilot plan is free version (included in the student pack). I'm not sure whether this matters.
If you are looking to get the ?? functionality, you need to add a function to Powershell. It is essentially a shortcut, so instead of typing
gh copilot explain use powershell to list all txt files in temp folder
, you would use
?? list all txt files in temp folder.
To do so
go to powershell and type
notepad $profile
add this function
function ?? {
$TmpFile = New-TemporaryFile
gh copilot explain ('use 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
}
}
}
copied and modified shamelessly from Scott Hanselman's blog [https://www.hanselman.com/blog/github-copilot-for-cli-for-powershell][1]
Restart powershell and you should be able to type
?? list all txt files in temp folder
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With