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

Fish completions aren't showing the flags of the subcommands correctly #371

Open
1 of 7 tasks
cjappl opened this issue Mar 20, 2024 · 4 comments
Open
1 of 7 tasks
Assignees

Comments

@cjappl
Copy link
Collaborator

cjappl commented Mar 20, 2024

Environment info

  • OS
    • Linux
    • Mac OS X
    • Windows
    • Others:
  • Shell
    • bash
    • zsh
    • fish

Problem / Steps to reproduce

Full fish completions are relatively new, but some of them are behaving strangely.

Ideally, when you do something like

gbl --<TAB>

You get all the flags available to pass into git blame:

> git blame --help
--contents  (Instead of working tree, use the contents of the named file)  --line-porcelain                     (Show the porcelain format)  --show-email  (Show the author email instead of author name)
--date                        (Specifies the format used to output dates)  --porcelain  (Show in a format designed for machine consumption)  --show-name       (Show the filename in the original commit)
--help                                  (Display manual of a Git command)  --reverse             (Walk history forward instead of backward)  --show-number  (Show the line number in the original commit)
--incremental                             (Show the result incrementally)  --root                 (Do not treat root commits as boundaries)  --show-stats                 (Include additional statistics)

Instead you get:

> git-forgit blame --

Nothing.

It seems like we are completing the files correctly, but not wrapping the flags. Filing this for the future

@cjappl
Copy link
Collaborator Author

cjappl commented Mar 20, 2024

@folliehiyuki just pinging you here as you wrote the original version. I'm going to dig in more at some point, but perhaps in your expertise you see the problem right away :)

@cjappl cjappl self-assigned this Mar 20, 2024
@folliehiyuki
Copy link
Contributor

folliehiyuki commented Mar 25, 2024

Completion in fish shell is explicit. Since no completion for blame subcommand is defined in the current completion file, it behaves correctly in this case (providing nothing).

It seems like we're trying to pass completion items of git blame to git-forgit blame, which is kind of tricky. fish's complete function has -w|--wraps flag to deal with alias completion, but it doesn't work with other complete's flags apparently.

What I've tried:

# This copies all the completion arguments of `git blame` to `git-forgit`, ignoring the
# blame subcommand requirement
complete -c git-forgit -n '__fish_seen_subcommand_from blame' -w 'git blame'

# This pass all the completion items of `git` to `git-forgit`, with redundant completion
# items, which is not what we desire
complete -c git-forgit -w git

Can you try filling an issue upstream? Maybe they will add support for our use case. Also, it might already be possible but my fish-fu is not good enough to let me figure it out.

@cjappl
Copy link
Collaborator Author

cjappl commented Mar 26, 2024

Good investigation. I'll see if I can dive in at some point and figure out if there is a workaround or we need to file a ticket. Thanks for spending some time!!

@cjappl
Copy link
Collaborator Author

cjappl commented Mar 30, 2024

This has been merged, our monthly release goes out in a few days. I'll check it then (because we have a big refactor going through with that release I don't want to push it early)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants