-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Closed
Labels
C-feature-requestCategory: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted`Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted`S-acceptedStatus: Issue or feature is accepted, and has a team member available to help mentor or reviewStatus: Issue or feature is accepted, and has a team member available to help mentor or reviewZ-scriptNightly: cargo scriptNightly: cargo script
Description
Problem
ref #12207 (comment)
For now, if you try to use cargo pkgid
against to a cargo script file. It will generate an error:
cargo pkgid sql2.rs
error: could not find `Cargo.toml` in `/Users/rustin/code/rs-scripts` or any parent directory
Proposed Solution
We need to support cargo pkgid
for cargo-script.
For instance, for itself, it would look like:
$pwd
/Users/rustin/code/rs-scripts
$ls
sql.rs sql1.rs sql2.rs sql3.rs sql4.rs sql5.rs sql6.rs sql7.rs sql8.rs sql9.rs
$cargo pkgid sql2.rs
path+file:///Users/rustin/code/rs-scripts/sql2.rs#embedded
For its dependencies, it would look like:
cargo pkgid sql2.rs -p clap
https://github.com/rust-lang/crates.io-index#clap:4.5.21
Notes
Not sure specifying the rust file as an argument is a good idea. Because cargo pkgid
itself already takes the SPEC
as the argument. So it might be a very confusing syntax.
Metadata
Metadata
Assignees
Labels
C-feature-requestCategory: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted`Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted`S-acceptedStatus: Issue or feature is accepted, and has a team member available to help mentor or reviewStatus: Issue or feature is accepted, and has a team member available to help mentor or reviewZ-scriptNightly: cargo scriptNightly: cargo script