8000 Link custom git commands to autogenerated suggestions · Issue #4358 · fish-shell/fish-shell · GitHub
[go: up one dir, main page]

Skip to content

Link custom git commands to autogenerated suggestions #4358

@stefanmaric

Description

@stefanmaric
$ 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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0