clink-completions
clink-completions copied to clipboard
Add completions for `gh` (GitHub.cli)
hub is a command-line wrapper for git that makes you better at GitHub. See https://hub.github.com for CLI examples
hub
is deprecated and replaced by gh
. I'll explore cost/feasibility of adding completions for gh
.
I came here hoping to find a gh
completion file for clink. I tried getting a lua specialised GPT to translate the zsh _gh file into lua, but it said that it was too complicated.
https://chat.openai.com/share/99a47c73-72bc-49a2-b1a2-9d86b9c60da1
I have a prototype script for gh
completions. I haven't had time to test it or fill in the gaps.
Would you like to mess around with testing it and filling in stuff, or at least filing issues for what's missing or wrong?
I can make a topic branch for working on the gh
completions, if you'd like.
Would you like to mess around with testing it and filling in stuff, or at least filing issues for what's missing or wrong?
Sure. I'll start using it and see if I come across any problems.
@eggbean How have the gh
completions been working for you? Any feedback, things to fix or improve?
Yes, it's been working well for me, thanks. I have not encountered any bugs or problems.
I haven't tried every subcommand extensively, but I have been using a few subcommands that I had never used before, as I didn't know they even existed until using these completions.
(I still haven't been able to combine these completion suggestions with the repeated tab cycling, in a similar way that is possible in zsh, though)
(I still haven't been able to combine these completion suggestions with the repeated tab cycling, in a similar way that is possible in zsh, though)
@eggbean Can you give an example?
(I still haven't been able to combine these completion suggestions with the repeated tab cycling, in a similar way that is possible in zsh, though)
@eggbean I don't understand what is meant by that. Can you give an example? I can probably explain or show how.
Everything I've tried has worked great.
Sorry, I'll get back to you soon once I figure out what I meant.
(I still haven't been able to combine these completion suggestions with the repeated tab cycling, in a similar way that is possible in zsh, though)
@eggbean Maybe you meant one of these?
- Do you want the dark gray "auto suggestion" text to only show suggestions from available completions and never from history?
clink set autosuggest.strategy completion
(that would be pretty non-useful though; it might be better to just turn off autosuggest entirely in that case). - Do you want Tab to cycle through completions? Either set Clink to use Windows key bindings instead of Bash key bindings (
clink set clink.default_bindings windows
) or set up bindings in your.inputrc
file such as:"\C-I": old-menu-complete "\e[Z": old-menu-complete-backward
@eggbean Oh, I think what you're looking for ("in a similar way that is possible in zsh") might be bash's show-all-if-ambiguous
config variable.
In the .inputrc file:
# Show matches if there's more than one (in complete, menu-complete, old-menu-complete).
set show-all-if-ambiguous on
# Bind TAB to either menu-complete or old-menu-complete, depending on your preference.
"\C-I": menu-complete
"\e[Z": menu-complete-backward
But trying to figure out what you're referring to led me to find that in Clink the menu-complete
commands weren't updated to respect the completion-auto-query-items
config variable. So a fix for that is coming in v1.6.14 (probably in a week or two).
@eggbean I think that the outstanding issue about "combine these completion suggestions with the repeated tab cycling, in a similar way that is possible in zsh" is not about the gh
argmatcher, and is instead about how to configure the tab completion command(s) to behave similarly to zsh
for all completion in general.
I'm going to go ahead and publish a new release for the clink-completions repo.
Completions for gh
were added in commit 651b979b4b07f3c4ecb104fdb0209f8a3b39d807.