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

Inherit aliases from .cargo/config.toml #484

Closed
sffc opened this issue Nov 3, 2020 · 6 comments
Closed

Inherit aliases from .cargo/config.toml #484

sffc opened this issue Nov 3, 2020 · 6 comments
Assignees
Milestone

Comments

@sffc
Copy link

sffc commented Nov 3, 2020

Feature Description

I have a number of aliases defined in my .cargo/config.toml file, like this:

[alias]
quiz = "test --all-targets --all-features"
exam = "test --all-features"
clip = "clippy --all-targets --all-features"

There should be a way in cargo-make to run those aliases without the boilerplate of re-defining them in Makefile.toml.

Describe The Solution You'd Like

If I run cargo make quiz, cargo-make should first look for a "quiz" target, and if it fails to find one, it should behave as if the following target were present:

[tasks.quiz]
command = "cargo"
args = ["quiz"]
@sffc
Copy link
Author

sffc commented Nov 3, 2020

I realized that I can invert this structure: define the helper commands in Makefile.toml and write aliases to them in .cargo/config.toml. This requires that the user have cargo-make installed.

@sagiegurari
Copy link
Owner

sagiegurari commented Nov 3, 2020

that's a really interesting idea.
you can invert as you said, and ya it means users need cargo-make installed, but usually it also means your build needs it anyway.

regardless, defining tasks from those aliases is a really neat idea.
let me take a look at what i can do

sagiegurari added a commit that referenced this issue Nov 5, 2020
@sagiegurari
Copy link
Owner

@sffc just push this support to the development branch.
Basically to enable cargo aliases to be automatically loaded as tasks as well, you have to enable it in the makefile config section as follows:

[config]
cargo_load_aliases = true

@sagiegurari
Copy link
Owner

@sffc this feature is now published. thanks a lot

@sffc
Copy link
Author

sffc commented Nov 5, 2020

That's awesome; thanks!!

Note: I see the option is called load_cargo_aliases, not cargo_load_aliases as in your post above.

@sagiegurari
Copy link
Owner

right, my mixup. that's what you get when you don't copy paste :)

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