Crate papyrus[−][src]
A rust script running tool.
See the docs. Look at progress and contribute on github.
Install papyrus
.
cargo install papyrus
Add right click context menu. (May need admin rights)
papyrus rc-add
Remove right click context menu. (May need admin rights)
papyrus rc-remove
Run papyrus from command line.
papyrus run path_to_src_file.rs
papyrus run path_to_script_file.rscript
Implementation Notes
- Right click on a
.rs
or.rscript
file and chooseRun with Papyrus
to compile and run code! - Papyrus will take the contents of the source code and construct a directory to be used with
cargo
. For now the directory is created under a.papyrus
directory in the users home directory. - The compiled binary will be executed with the current directory the one that houses the file. So
env::current_dir()
will return the directory of the.rs
or.rscript
file.
Example - .rs
File hello.rs
.
extern crate some_crate;
fn main() {
println!("Hello, world!");
}
Use papyrus to execute code.
papyrus run hello.rs
The src/main.rs
will be populated with the same contents as hello.rs
. A Cargo.toml
file will be created, where some_crate
will be added as a dependency some-crate = "*"
.
Example - .rscript
File hello.rscript
.
extern crate some_crate;
println!("Hello, world!");
Use papyrus to execute code.
papyrus run hello.rscript
The src/main.rs
will be populated with a main function encapsulating the code, and crate references placed above it. A similar Cargo.toml
will be created as before.
Structs
Output |
Current output of a process run. Future work to include collected io streams. |
Script |
A persistent structure of the script to run. |
Enums
SourceFileType |
The type of source file, .rs or .rscript. |
Functions
add_right_click_menu |
Adds a right click context menu entry for |
remove_right_click_menu |
Removes the right click context menu entry for |
run_from_src_file |
Compile and run the specified source file.
Equivalent to calling |