fornwall / rust-script

Run Rust files and expressions as scripts without any setup or compilation step.
https://rust-script.org
Apache License 2.0
1.21k stars 41 forks source link

Is it possible to run command (e.g. `cargo tree`) in rust-script script project directory ? #60

Closed gwpl closed 1 year ago

gwpl commented 1 year ago

Is it possible to run command (e.g. cargo tree) in rust-script script project directory ? Otherwise, could support for it be added?

(sometimes running commands inside project directory is very helpful, e.g. for debugging, and having convenient way to run them, or to jump there => e.g. rust-script to print directory path, so one could do cd "$(rust-script --project-dir script.ers) could be very handy!

fornwall commented 1 year ago

Version 0.23.0 has just been released.

There the -p/--project parameter can be used to generate the package and print the package path, without doing any build step.

This allows things such as cargo tree --manifest-path $(rust-script -p test.rs)/Cargo.toml or cd "$(rust-script --package script.ers).

Let me know how it works!