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.27k stars 43 forks source link

use original path used to call the script as arg0 #114

Closed ChristianS99 closed 1 year ago

ChristianS99 commented 1 year ago

see #113 Please don't merge yet. It's working for the normal case, but I'm unsure about the wrapper case main.rs:360 What is this and how should this be handled? Can you give me example of a "wrapper" and how to use it?

fornwall commented 1 year ago

Hi @ChristianS99 and sorry for the slow response!

What is this and how should this be handled? Can you give me example of a "wrapper" and how to use it?

Wrappers comes from the --wrapper <wrapper> command-line argument. Can be used to inject something before the script, as in rust-script --wrapper rust-lldb myscript.rs.

In the case of a wrapper, I think we need to accept a "strange" arg0, since it would be up to the wrapper to set it, and we can't assume anything about the wrapper. But --wrapper is more of a advanced use case anyway, so that should be ok.

I'm merging this and doing a release, thanks a lot!