Tiny update notifier utility for rust cli programs
Checks for update on program launch if more than 24h have passed since the last check, then pops up a notification if a new version was found 📢
supports crates.io and github releases
Install tinyupdatenotifier using Cargo
bash
cargo add tiny_update_notifier
```rust // check on crates.io tinyupdatenotifier::checkcratesIO(pkgversion, pkg_name);
// check on github releases tinyupdatenotifier::checkgithub(pkgversion, pkgname, pkgrepo_url); ```
rust
tiny_update_notifier::Notifier::new().run(
tiny_update_notifier::Source,
pkg_version,
pkg_name,
pkg_repo_url
);
```rust // Spawns a thread to check for updates on Crates.io and notify user if there is a new version available. use tinyupdatenotifier::check_cratesIO;
fn main() {
checkcratesIO(
env!("CARGOPKGVERSION"),
env!("CARGOPKGNAME"),
);
}
rust
// Spawns a thread to check for updates on GitHub Releases and notify user if there is a new version available.
use tinyupdatenotifier::checkgithub;
fn main() { checkgithub( env!("CARGOPKGVERSION"), env!("CARGOPKGNAME"), env!("CARGOPKG_REPOSITORY"), ); } ```
```rust // equivalent to the code above use std::thread; use tinyupdatenotifier::{Notifier, Source};
fn main() { thread::spawn(|| { Notifier::new( Source::Github, env!("CARGOPKGVERSION"), env!("CARGOPKGNAME"), env!("CARGOPKGREPOSITORY"), ) .run(); }); }
Used by https://github.com/Araxeus/ls-interactive/