Allow config-relative paths in command aliases
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 15.5k
- Forks
- 3k
- Avg merge
- 23h 30m
- Merged PRs (30d)
- 51
Description
Problem
When using nested-workspaces it's not possible to use the normal xtask pattern as the xtask package does not exist in the inner workspace. It would be useful if in the alias we can explicitly specify that it uses this workspace's manifest even if the current-directory is within another one.
Proposed Solution
One idea I had was something similar to how [env] lets you specify relative = true, if that were supported for components of the alias then it could be something like:
[alias]
xtask = [
"run",
"--manifest-path",
{ path = "Cargo.toml", relative = true },
"--package=xtask",
"--bin=xtask",
"--"
]
Notes
This is sort of related to https://github.com/rust-lang/cargo/issues/9123, but that cli flag doesn't work for this usecase for two reasons:
- It will still be using the inner-workspace to detect what the "root" is, not the outer one that defines the
.cargo/config.toml. - It will change the current-working-directory for the command being run, the
xtaskstill wants to be able to resolve its own arguments relative to where it's being run from, we just want to change the path used to find the binary to run.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing Cargo command-alias configuration and the existing [env] handling for relative = true; the issue does not name specific files or tests. Check how aliases resolve paths in nested workspaces, and consider the work done when a config-relative alias can locate the outer workspace's manifest without changing the command's working directory.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- cli
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100