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

Improving completion of subcommands #25

Merged
merged 3 commits into from
Aug 24, 2020

Conversation

NightMachinery
Copy link
Contributor

The service variable gets used by, e.g., git. Not setting it will break those completions.

The service variable gets used by, e.g., `git`. Not setting it will break those completions.
@AdrieanKhisbe AdrieanKhisbe added Enhancement 🍭 Something existing, but better ;) Scope: completion ✍️ Related to completion feature labels Aug 23, 2020
@AdrieanKhisbe AdrieanKhisbe self-assigned this Aug 23, 2020
Copy link
Owner

@AdrieanKhisbe AdrieanKhisbe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @NightMachinary, seems legit,

service was already mentioned in the OMZ issue I mentioned just below the line you injected it.

@AdrieanKhisbe
Copy link
Owner

@NightMachinary Two questions in order to have it land:

  • would you mind I push to your branch to add tests
  • if you have some link/docs that you saw to fix your issue for future reference

:)

@NightMachinery
Copy link
Contributor Author

@AdrieanKhisbe commented on Aug 23, 2020, 11:57 PM GMT+4:30:

@NightMachinary Two questions in order to have it land:

  • would you mind I push to your branch to add tests
  • if you have some link/docs that you saw to fix your issue for future reference

:)

I don't mind at all. Should I do sth for this to be possible? (Should I add you as a contributor to my fork?)

I figured this out by examining the completion function _git, so no docs. I have been using it since then, it's pretty good. which works with this, but it didn't work before. I also saw it in man zshall when I was looking for a more robust way to find completion functions (using _name is quite unoptimal. I myself used that convention for my helper functions, and the completion used, e.g., my _mv (which actually moves files and has nothing to do with completions) when trying to complete mv. I got rid of those in my own code, but I guess the problem still exists in the wild. You might want to add a warning to the readme.):

Each name may also be of the form `cmd=service'.  When completing the command cmd, the function typ-
              ically  behaves  as  if  the command (or special context) service was being completed instead.  This
              provides a way of altering the behaviour of functions that can perform many  different  completions.
              It  is  implemented  by  setting  the parameter $service when calling the function; the function may
              choose to interpret this how it wishes, and simpler functions will probably ignore it.

@AdrieanKhisbe
Copy link
Owner

About the branch, normally no intervention need, (discovered it by myself few months ago by accident).

Thanks for the details,I found the warning you just suggested in the zsh completion doc

Will try to take care of it tomorrow or tuesday.
(if you have no news by wednesday, feel free to ping me here)

@AdrieanKhisbe AdrieanKhisbe changed the title Update __diraction-dispatch Improving completion of subcommands Aug 24, 2020
@AdrieanKhisbe
Copy link
Owner

@NightMachinary I think I as something see gh actions,
and it's a good thing I added test: I spotted that we need another $service injection to have both mybookmark git something (whitelisted command) and mybookmark - git something (any command).

Would you mind to have a look before I merge this?

@NightMachinery
Copy link
Contributor Author

@AdrieanKhisbe commented on Aug 24, 2020, 4:16 PM GMT+4:30:

@NightMachinary I think I as something see gh actions,
and it's a good thing I added test: I spotted that we need another $service injection to have both mybookmark git something (whitelisted command) and mybookmark - git something (any command).

Would you mind to have a look before I merge this?

I took a look. Indeed, your tests were a good idea! I am using my own minimal clone of diractions, which has alternative design choices, so I did not catch that in my usage.

@AdrieanKhisbe AdrieanKhisbe merged commit f9ecea9 into AdrieanKhisbe:master Aug 24, 2020
@AdrieanKhisbe
Copy link
Owner

@NightMachinary et voilà, it's merged.

Thanks for your contribution 🙂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement 🍭 Something existing, but better ;) Scope: completion ✍️ Related to completion feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants