https://github.com/araxeus/tiny-update-notifier
Tiny update notifier utility for rust cli programs
https://github.com/araxeus/tiny-update-notifier
rust update-checker update-notifier
Last synced: 9 months ago
JSON representation
Tiny update notifier utility for rust cli programs
- Host: GitHub
- URL: https://github.com/araxeus/tiny-update-notifier
- Owner: Araxeus
- License: mit
- Created: 2022-12-31T17:44:00.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2023-12-13T15:51:35.000Z (over 2 years ago)
- Last Synced: 2025-08-24T20:49:27.827Z (10 months ago)
- Topics: rust, update-checker, update-notifier
- Language: Rust
- Homepage: https://crates.io/crates/tiny_update_notifier
- Size: 114 KB
- Stars: 2
- Watchers: 1
- Forks: 1
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
🔔 Tiny Update Notifier 🔔
Tiny update notifier utility for rust cli programs
---
Checks for update if **more than 24h have passed** since the last check (Customizable),
Then pops up a notification if a new version was found 📢
> supports crates.io and github releases

## Installation
Install tiny_update_notifier using Cargo
```bash
cargo add tiny_update_notifier
```
## Usage
##### Multi-threaded / Non-blocking :
```rust
// check on crates.io
tiny_update_notifier::check_cratesIO(pkg_version, pkg_name);
// check on github releases
tiny_update_notifier::check_github(pkg_version, pkg_name, pkg_repo_url);
```
##### Single-threaded / Blocking
```rust
tiny_update_notifier::Notifier::new(
tiny_update_notifier::Source,
pkg_version,
pkg_name,
pkg_repo_url
)
.interval(Duration) //Optional, default is 24h
.run();
```
## Examples
```rust
// Spawns a thread to check for updates on Crates.io and notify user if there is a new version available.
use tiny_update_notifier::check_cratesIO;
fn main() {
check_cratesIO(
env!("CARGO_PKG_VERSION"),
env!("CARGO_PKG_NAME"),
);
}
```
```rust
// Spawns a thread to check for updates on GitHub Releases and notify user if there is a new version available.
use tiny_update_notifier::check_github;
fn main() {
check_github(
env!("CARGO_PKG_VERSION"),
env!("CARGO_PKG_NAME"),
env!("CARGO_PKG_REPOSITORY"),
);
}
```
```rust
// Equivalent to check_github, except the interval is changed to 1 week
use std::{thread, time::Duration};
use tiny_update_notifier::{Notifier, Source};
fn main() {
thread::spawn(|| {
Notifier::new(
Source::GitHub,
env!("CARGO_PKG_VERSION"),
env!("CARGO_PKG_NAME"),
env!("CARGO_PKG_REPOSITORY"),
)
.interval(Duration::from_secs(60 * 60 * 24 * 7))
.run();
});
}
```
----
> Used by https://github.com/Araxeus/ls-interactive/