Expand description
kaishin is a universal self-update library for Rust CLIs, extracted from rvpm and renri.
It provides utilities to:
- Fetch the latest release information from GitHub.
- Detect how the current executable was installed (e.g., via
cargo install). - Perform a self-update by replacing the current binary.
- Manage background update check intervals to avoid frequent API calls via
Checker. - Silently auto-update in the background — check, download, and replace the
binary without prompting via
Checker::auto_update/Checker::spawn_auto_update. The running process keeps the old binary; the new version takes effect on the next launch.
Structs§
- Checker
- A high-level handler for managing background update checks.
- Kaishin
Options - Configuration options for
kaishin. - Latest
Release - Information about the latest release fetched from the GitHub API.
- Update
Check State - Persistent state for background update checks, used for throttling.
- Update
Options - Options for the self-update process.
Enums§
- Install
Method - The method by which the current executable was installed.
Functions§
- check_
latest_ release - Fetches the latest release information for the repository specified in
optsfrom GitHub. - default_
interval - Returns the default interval between background update checks (24 hours).
- default_
state_ path - Returns the default path for the state file under the system’s data directory.
- detect_
install_ method - Detects the installation method of the executable at the given path.
- format_
update_ banner - Formats a banner message intended for display when an update is available.
- is_
update_ available - Compares the current version with a latest tag and returns
trueif an update is available. - load_
check_ state - Loads the persistent update check state from the given path.
- parse_
interval - Parses a duration string (e.g., “24h”, “1d”, “30m”) into a
Duration. - run_
self_ update - Executes the self-update flow.
- save_
check_ state - Saves the persistent update check state to the given path.
- should_
auto_ check - Determines whether an automatic update check should be performed based on the interval.