-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Complete custom "git-foo" commands from "git foo" commandlines #7652
Complete custom "git-foo" commands from "git foo" commandlines #7652
Conversation
aadc5e6
to
80fb8d7
Compare
This seems like a good idea, particularly because it matches git's semantics - any command named "git-thing" is available as "git thing", but that means it can also be called as "git-thing". So a "git-thing.fish" should have |
80fb8d7
to
7c8ccb0
Compare
7c8ccb0
to
dd10634
Compare
I too reckon this is a good addition to make custom About the complete -c git -n '__fish_git_using_command foo' ... pattern, they are used in projects such as For those sort of patterns, I think the new patch would add a completion that forwards |
The redundant completion command would cause fish to use file completions on |
I see that make sense, it didn't occured to me that Are there any simple way to check for the existence of completion command other than a guard that looks like this? complete | string match -qr -- '\s-c git-foo' |
I see! I was just testing the changes on my local machine to notice those old syntax errors, thanks for the clarification |
dd10634
to
37451de
Compare
Since fish-shell#7075, git-foo.fish files are sourced when Git completions are loaded. However, at least Cobra (CLI framework for Go) provides completions like complete git-foo ... This means that completions are only offered when typing "git-foo <TAB>" and not on "git foo <TAB>". Fix this by forwarding the completion requests. Take care to only forward if there are actually completions for "git-foo", to avoid adding filename completions.
37451de
to
a89fa58
Compare
Some third party Git tools provide a man page, which we can at least use for completing options. The old logic excluded all generated completions for Git subcommands. Instead, try to load completions for all available external subcommands. We can use $PATH/git-* because /bin/git-add and friends were removed in Git 1.6.0 in 2008. Closes #4358 (the "git-foo" wrapping was added in #7652)
Since #7075, git-foo.fish files are sourced when Git completions are loaded.
However, at least Cobra (CLI framework for Go) provides completions like
This means that completions are only offered when typing "git-foo "
and not on "git foo ". Fix this by forwarding the completion requests.
This patch breaks git-foo.fish files that directly add competions to "git" using
Since we forward to "git-foo" which has no custom completions, "git foo"
would get default file completions. I don't know if this pattern is used
already. Since #7075 is not released yet, it is probably not common.
cc @soraxas
TODOs: