Open woss opened 3 years ago
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).
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 :)
@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
sure, i'll let you know as soon as possible
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.
This is what i see in bash.
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?
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.
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.
Hi there! I was wondering if this is still wanted.
Also to be sure that I understand what you @woss were requesting,
were you trying to get autocompletion on the list of tasks from your Makefile.toml?
like this?
cargo make \
if this is what was requested I do not mind preparing a PR
that would be great. it needs to support both tasks and commands/options i guess just like the bash auto complete
This is it https://github.com/sagiegurari/cargo-make/pull/1182 it only handles tasks on Zsh based on the Makefile.toml from the readme but it has potential for expansion.
Hi guys,
In the past few years, I didn't do much rust or used cargo-make. I'm glad to see a new PR that introduces this feature. When I get back to rust I will use cargo-make for sure :)
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/zsh4humansIt 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.