-
Notifications
You must be signed in to change notification settings - Fork 6.5k
Clarify how to use the PowerShell completions #695
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I got the following to work: gh completion --shell powershell |Out-File -FilePath gh.completion.ps1 -Encoding utf8
./gh.completion.ps1 or gh completion --shell powershell |Out-String |Invoke-Expression |
@dougbu I tried running |
@JanPokorny the completions themselves are seemingly incomplete. If I type W.r.t. your profile, I found the command didn't work because profiles aren't sourced. Needed the following in my profile: New-Item function::global:Complete-gh -value { gh completion --shell powershell | Out-String | Invoke-Expression } >$null I then execute |
in my
and I get the expected result in a new powershell window. Agreed, though, I expected |
Ah, great. Thanks @bc3tech❕ (The lack of completion after |
Gotta agree, found it very odd |
I can confirm that in git bash, |
Well that would not be coming from the Powershell completion, which is the topic of this issue, since you are explicitely using BASH. I am able to get a second level of tab expansion (as they're called in Powershell, as opposed to tab completion in bash), but not a first level. For example (note: I am not a PS expert), creating the tab completion file:
then sourcing it in my
leads me to have this work: Any suggestions? |
@jasonsyoung Take a look in #1775 for a current workaround |
I can't get any of the suggested solutions to work. I tried in PowerShell Core and Windows Powershell, in all cases I only have the usual file completion, no command completion. It would be nice to have an answer from the team... |
As of 6/12/2021, with version 1.11.0, command and subcommand autocompletion are present. I used @bc3tech 's command in my PowerShell $PROFILE, and everything seems to be working as expected. I get command autocompletion, then file autocompletion when typing after a subcommand. |
Describe the feature or problem you’d like to solve
The page https://cli.github.com/manual/gh_completion explains to use the completions by adding
eval "$(gh completion)"
to a profile file.For PowerShell, the equivalent command is
gh completion -s powershell | iex
, which produces the following error:Proposed solution
Explain how to use the PowerShell completions
The text was updated successfully, but these errors were encountered: