| Crates.io | rspawn |
| lib.rs | rspawn |
| version | 0.0.3 |
| created_at | 2024-12-13 01:03:14.272532+00 |
| updated_at | 2024-12-15 18:57:52.222651+00 |
| description | A crate to fetch latest from crates.io and update your binary |
| homepage | |
| repository | https://github.com/jgabaut/rspawn |
| max_upload_size | |
| id | 1481801 |
| size | 95,339 |
A crate to fetch latest version from crates.io and update your binary.
Similar crates do similar things, but none had the specific mix I needed.
Run example with cargo run --example usage.
See examples/usage.rs:
use rspawn::relaunch_program;
use std::io;
fn main() {
let custom_confirm = |version: &str| {
println!("A new version {} is available. Would you like to install it? (yes/n): ", version);
let mut response = String::new();
io::stdin().read_line(&mut response).unwrap();
response.trim().to_lowercase() == "yes"
};
#[allow(non_snake_case)]
let check_if_executed_from_PATH = true; // Only ask for update when called from PATH
if let Err(e) = relaunch_program(None, Some(custom_confirm), check_if_executed_from_PATH) {
eprintln!("Error: {}", e);
}
}