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

Mention that aliases are recursive #10935

Merged
merged 1 commit into from
Aug 4, 2022
Merged

Mention that aliases are recursive #10935

merged 1 commit into from
Aug 4, 2022

Conversation

har7an
Copy link
Contributor

@har7an har7an commented Aug 3, 2022

Instead of duplicating portions of commands that are used identically across many aliases, the user can instead reuse any previously defined aliases.

What does this PR try to resolve?

Today I started working with xtask, which is a build system based on a simple cargo alias:

[alias]
xtask = "run --package xtask --"

Since the word "xtask" is rather difficult to type in my opinion (at least my left hand struggles quite a bit) I wanted to add another alias, x as a shorthand (similar to what build, run, etc. have by default). Thereby I discovered that I needn't replicate the whole alias, because aliases are recursive. I consulted the docs and couldn't find a mention of this, hence I'm adding it as part of this PR so other users can discover it.

How should we test and review this PR?

I don't think this requires a separate test, it's a minor change to the documentation only.

Additional information

@rust-highfive
Copy link

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @ehuss (or someone else) soon.

Please see the contribution instructions for more information.

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Aug 3, 2022
Instead of duplicating portions of commands that are used identically
across many aliases, the user can instead reuse any previously defined
aliases.
@har7an
Copy link
Contributor Author

har7an commented Aug 4, 2022

@epage I changed the example a bit:

[alias]
rr = "run --release"
recursive_example = "rr --example recursions"

And modified the config.toml further up on that page from this:

rr = "run --release"
space_example = ["run", "--release", "--", "\"command list\""]

to that:

rr = "run --release"
recursive_example = "rr --example recursions"
space_example = ["run", "--release", "--", "\"command list\""]

I preferred adding it as new example so we don't lose the one with the array notation. I also decided not to do the recursion in the array example so people don't get confused when skimming it. Is that alright?

@epage
Copy link
Contributor

epage commented Aug 4, 2022

@bors r+

@bors
Copy link
Collaborator

bors commented Aug 4, 2022

📌 Commit e8cd6f4 has been approved by epage

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Aug 4, 2022
@bors
Copy link
Collaborator

bors commented Aug 4, 2022

⌛ Testing commit e8cd6f4 with merge 5ac9be2...

@bors
Copy link
Collaborator

bors commented Aug 4, 2022

☀️ Test successful - checks-actions
Approved by: epage
Pushing 5ac9be2 to master...

@bors bors merged commit 5ac9be2 into rust-lang:master Aug 4, 2022
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Aug 10, 2022
Update cargo

7 commits in 4fd148c47e733770c537efac5220744945d572ef..ce40690a5e4e315d3dab0aae1eae69d0252c52ac
2022-08-03 15:03:52 +0000 to 2022-08-09 22:32:17 +0000
- Make the `rust-version` error recommend `cargo update --precise -p crate@ver` (rust-lang/cargo#10891)
- resolver docs: link to version requirements syntax full explanation (rust-lang/cargo#10946)
- Bump os_info to 3.5.0 (rust-lang/cargo#10943)
- Mark --timings=html unstable in the document (rust-lang/cargo#10941)
- Mention that aliases are recursive (rust-lang/cargo#10935)
- Test if reserved filenames are allowed in Windows (rust-lang/cargo#10322)
- improve error message for `no such subcommand` (rust-lang/cargo#10924)
@ehuss ehuss added this to the 1.65.0 milestone Mar 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants