Skip to content
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

Link custom git commands to autogenerated suggestions #4358

Closed
stefanmaric opened this issue Aug 28, 2017 · 0 comments
Closed

Link custom git commands to autogenerated suggestions #4358

stefanmaric opened this issue Aug 28, 2017 · 0 comments

Comments

@stefanmaric
Copy link
Contributor

$ fish --version
fish, version 2.6.0-560-g874a675e

$ uname -a
Linux sam-xps-ubuntu 4.12.8-041208-generic #201708161815 SMP Wed Aug 16 22:17:30 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux

$ echo $TERM
xterm-256color

I have git-extras installed, which puts a bunch of git- commands available in the PATH and Fish is doing two very good things:

  1. Suggests custom git commands when appropriated (source for it here and here):

image

  1. Generates completions for these custom commands using the man pages provided by git-extras, so fish can suggest options when you type the custom commands as such git-<custom_command>...:

image

The problem is, that these completions won't work if you type the custom commands as git <custom_command> (only --help is suggested):

asciicast

I have tried a few things to get around this, without success.

First, using -w, --wraps option of complete:

for custom_command in (__fish_git_custom_commands)
  complete -c git -n "__fish_git_using_command $custom_command" -w "git-$custom_command"
end

That gives very weird and convoluted completion results. I presume because using -w makes command actually ignore the -n, extending plain git with all the options of each custom command:

image

I also tried some expansion combinations with command -CSTRING but it won't show completions for things like complete -CSTRING"git-authors -".

Also don't know any way to alias/abbr multi-word strings to single-word commands (in order to tell fish that git authors is the same as git-authors).

Any suggestions? I would love to open a PR if this is actually possible to achieve.

@faho faho added this to the fish 3.2.0 milestone Feb 2, 2021
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 1, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants