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

having the completions with cargo make and zsh #590

Open
woss opened this issue Sep 14, 2021 · 7 comments
Open

having the completions with cargo make and zsh #590

woss opened this issue Sep 14, 2021 · 7 comments

Comments

@woss
Copy link

woss commented Sep 14, 2021

I started to move my scripts to the Makefile.toml and it seems to me that I will have many tasks. I would like my coworkers don't have to search and find the task names instead of having them as completions. The current sourcing only works with makers and on bash, we are using zsh and to be specific https://github.com/romkatv/zsh4humans

It is an incredibly good setup with awesome completions which you can find here.

I am not any good in zsh programming and i believe that the cargo make ...completion would be a great addition and excellent UX with this project.

@sagiegurari
Copy link
Owner

Thanks, i'll follow up on this one soon. I already have done it for bash, so i'm hoping to do it for zsh would be simple (no idea).

@woss
Copy link
Author

woss commented Sep 14, 2021

i hope this helps https://github.com/zsh-users/zsh-completions/blob/master/zsh-completions-howto.org

I tried to do it but it is beyond me :)

@sagiegurari
Copy link
Owner

@woss i never used zsh and their auto completion scripts looks like a nightmare.
however, they do support bash auto complete scripts and i already have one.
so i wrote short doc (3 line script) which you can run to enable it.
i tested it and seems to work well.

see doc:
https://github.com/sagiegurari/cargo-make/tree/0.35.1#usage-shell-completion-zsh

script:

autoload -U +X compinit && compinit
autoload -U +X bashcompinit && bashcompinit

# make sure to update the path based on your file system location
source ./extra/shell/makers-completion.bash

would love your feedback

@woss
Copy link
Author

woss commented Sep 22, 2021

sure, i'll let you know as soon as possible

@woss
Copy link
Author

woss commented Sep 22, 2021

ZSH doesn't work for me, could be the zsh4humans that is messing things up.

Look at this example below, this is out of the box cargo completions with interactive arrows. It says nicely what is what and you can select it by pressing enter. This is what i had in mind when i submitted this feature.
image

This is what i see in bash.
image
image

Now, when thinking about things, it's really confusing to have the cargo make and makers command. i intuitively went for the completions using the cargo make, TBH completely forgot the makers cli.

wouldn't it be simpler to pick one and tick with it?

@sagiegurari
Copy link
Owner

so thats how auto complete looks like in zsh :) ya i never used it but now i understand why they have built the auto complete api the way they did.
the bash way is doing tabs and auto complete based on what you wrote, so you do makers bu you will have build and other relevant things as options.

anyhow, it means that whatever i provided doesn't really give you the best solution.
since i'm not a zsh user (and not planning to be one), i'm going to keep this issue open with the help label, so others more capable with zsh could help.

as for why makers and not cargo make. i'm not sure about zsh, but for bash, the auto complete file is based on the first command. so if i want to support cargo make auto complete, it means i'm taking over the cargo auto complete. that is an issue. might be wrong here, but not sure i can solve that one.

@sagiegurari sagiegurari removed this from the 0.35.1 milestone Sep 23, 2021
@woss
Copy link
Author

woss commented Sep 23, 2021

good idea to keep it open.

I'm not giving up on learning the zsh completion, which is truly hard to learn. :)

as for why makers and not cargo make. i'm not sure about zsh, but for bash, the autocomplete file is based on the first command.

this is how the zsh completes the cargo build. could be that it works differently than the bash in that regard.

image

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

No branches or pull requests

2 participants