Update-informer
Update informer for CLI applications written in Rust
Usage
Add to Cargo.toml
:
[dependencies]
update-notifier = "0.1.0"
To check the version on crates.io:
use update_informer::registry::Crates;
match update_informer::check_version(Crates, env!("CARGO_PKG_NAME"), env!("CARGO_PKG_VERSION"))? {
Some(version) => {
println!("New version is available: {}", version);
}
None => {
println!("No new version");
}
}
To check the version on GitHub:
use update_informer::registry::GitHub;
// Format: {owner}/{repo}
let pkg_name = format!("{}/{}", env!("CARGO_PKG_NAME"), env!("CARGO_PKG_NAME"));
match update_informer::check_version(GitHub, &pkg_name, env!("CARGO_PKG_VERSION"))? {
Some(version) => {
println!("New version is available: {}", version);
}
None => {
println!("No new version");
}
};