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

Shell completions #565

Closed
simlay opened this issue Jun 16, 2021 · 12 comments
Closed

Shell completions #565

simlay opened this issue Jun 16, 2021 · 12 comments
Assignees
Milestone

Comments

@simlay
Copy link

simlay commented Jun 16, 2021

Feature Description

Hi there! Love this project!

Been using this project for a while and the only thing I wish it had is shell completions. I have no idea how hard this feature would be to implement. I'm partially writing this task because it's not been written so others can see that it was at least talked about and maybe someone (or me) would do the work if you're interested in the PR(s).

Describe The Solution You'd Like

I'd put something like source <(cargo make completions bash) (I know this may not be the right way to do it) in my bash profile and then have tab completions.

This should also work with act the same for things like zsh or other shells.

@sagiegurari
Copy link
Owner

awesome suggestion.
i already have a cli command to list all tasks that are found/relevant.
so i could use it to build the completion script.

I'll probably take a look on building this for bash, and let others use it as reference to build it to other shells (which I don't use)

the only thing I'm not sure about, is that i could probably make it work for the makers executable, but not cargo make (they are the same) since its a sub command of another executable.
but, I'm not an expert on that and might be wrong.

@sagiegurari
Copy link
Owner

by the way, if you want to take a shot at it and submit a PR, that would be even better. just tell me.
i can guide you if needed.

@sagiegurari
Copy link
Owner

@simlay I've implemented a bash auto complete for makers in 0.34.1 branch.
you will have to install the new cargo-make for it (contains simplified output for list tasks command) + source the new file in the extra/shell folder.
it would take a bit to run it as it calls cargo make to pull all task names that are actually available for you to use.

any feedback and suggestions are welcome.

@sagiegurari sagiegurari added this to the 0.34.1 milestone Jun 26, 2021
@sagiegurari sagiegurari modified the milestones: 0.34.1, 0.35.0 Jul 7, 2021
@sagiegurari
Copy link
Owner

@simlay did you have a chance to look at it?

@sagiegurari
Copy link
Owner

released in official version

@sassman
Copy link

sassman commented Sep 22, 2022

In the docs it is written to

source ./extra/shell/makers-completion.bash

However it seems that the extra folder is not packaged as part of the crate, so it would not appear at ~/.cargo e.g. under ~/.cargo/registry/src/github.com-1ecc6299db9ec823/cargo-make-0.36.0/

The most simplest fix for this would be to include the extra folder in the Cargo.toml in the include section.

@sagiegurari
Copy link
Owner

didnt think someone would search it there....
in my mind people would do clone, source the file and delete

@sassman
Copy link

sassman commented Sep 22, 2022

didnt think someone would search it there....
in my mind people would do clone, source the file and delete

That's also an option. But since the code is already locally available after a cargo install it would be way more convenient to not have to clone the repo and rather reuse the local available crate code, specifically also the shell completion script.

@sagiegurari
Copy link
Owner

cool. feel free to PR this if you want, or open a new issue so i can track and do it

@sagiegurari
Copy link
Owner

@sassman i've added it. currently not published, only in dev branch.

@sassman
Copy link

sassman commented Sep 23, 2022

Thanks, I was about to create the PR but thanks for the very fast help.

Maybe it's worth to mentioning the approach in the docs? Then I could prepare this PR, if you don't mind.

@sagiegurari
Copy link
Owner

you can PR the documentation, since i already pushed the cargo.toml change.
if you do, the doc is in the content.md that is the source of the readme.md

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

3 participants