feat: update runrs
This commit is contained in:
12
src/main.rs
12
src/main.rs
@@ -31,10 +31,7 @@ fn main() {
|
|||||||
env!("CARGO_PKG_VERSION"),
|
env!("CARGO_PKG_VERSION"),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
let first_argument = match args.get(0) {
|
let first_argument = args.get(0).unwrap_or_else(|| failure_and_exit!("Must assign file name"));
|
||||||
None => failure_and_exit!("Must assign file name"),
|
|
||||||
Some(f) => f,
|
|
||||||
};
|
|
||||||
|
|
||||||
if first_argument == "--help" {
|
if first_argument == "--help" {
|
||||||
println!(r##"{} v{} - {}
|
println!(r##"{} v{} - {}
|
||||||
@@ -53,10 +50,9 @@ runrs <script.rs> [arguments]
|
|||||||
}
|
}
|
||||||
|
|
||||||
let script_file = first_argument;
|
let script_file = first_argument;
|
||||||
let script_content = match fs::read_to_string(script_file) {
|
let script_content = fs::read_to_string(script_file).unwrap_or_else(|e|
|
||||||
Err(e) => failure_and_exit!("Read file: {}, failed: {}", script_file, e),
|
failure_and_exit!("Read file: {}, failed: {}", script_file, e)
|
||||||
Ok(c) => c,
|
);
|
||||||
};
|
|
||||||
let script_sha256 = sha256::digest(script_content);
|
let script_sha256 = sha256::digest(script_content);
|
||||||
debugging!("File {} -> sha256: {}", script_file, script_sha256);
|
debugging!("File {} -> sha256: {}", script_file, script_sha256);
|
||||||
let cache_script_bin_name = format!("{}/Library/Caches/rust-script/binaries/release/{}",
|
let cache_script_bin_name = format!("{}/Library/Caches/rust-script/binaries/release/{}",
|
||||||
|
|||||||
Reference in New Issue
Block a user