-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
cargo add
: Handle paths automatically without requiring --path
#14134
Comments
If we are going to do this, should we consider other commands accepting ( |
Didn't What happens when a subdirectory and a package name look the same? Its common to reference a directory as |
@epage I don't remember if I'm not proposing to eliminate the I appreciate the possibility that once people are used to the idea that they can run At a minimum, I think there's value in augmenting the error message to tell people they need the |
I'm all for improving the error message. This again gets into my concern with "if you knew what I wanted to do..." as it creates a sloppiness that makes behavior difficult to predict. This would allow me to do I think it's a useful to keep in mind but its not a principle to make top priority. |
@epage I would argue that the case of doing |
Hmm, looks like we do auto-check the name against workspace members cargo/src/cargo/ops/cargo_add/mod.rs Lines 388 to 398 in a2d45dc
|
Problem
Ideally, when given an argument containing a path separator (which is never valid in a crate name),
cargo add
could automatically assume--path
if the specified path exists as a directory.If there's a compatibility reason why we can't do that, then at a minimum
cargo add
could suggest--path
. But I think we could reasonably infer that and proceed.Proposed Solution
When
cargo add
receives an argument containing a path separator, rather than erroring,cargo add
should infer--path
and proceed.Notes
No response
The text was updated successfully, but these errors were encountered: