Expand description
Self-update support for yui, using the shared kaishin library.
Thin sync facade around kaishin’s async API so the rest of yui
can stay synchronous. Same shape as renri’s src/updater.rs;
the only yui-specific bit is the hardcoded (owner, repo, bin)
triple — yui’s crate name is yui-cli (because crates.io’s
yui is taken by an unrelated abandoned crate), but the repo
and binary are both yui, so going through env!("CARGO_PKG_NAME")
the way renri does would produce the wrong GitHub Release URL.
The module exposes two layers:
run_self_update— drives theyui self-updatesubcommand (interactive /--yes/--check).Checker+maybe_spawn_auto_update_check/finalize_auto_update_check— the daily background banner shown after every other subcommand, the wayrvpm/renrido it.[ui] auto_update_check = falseinconfig.tomlopts out, and[ui] update_check_interval = "..."overrides the default 24h cadence.
Structs§
- Checker
- Blocking facade over
kaishin::Checker— yui’s main loop is synchronous, so the asynccheck_and_savecall goes through a freshcurrent_threadruntime each time. Same shape as renri.
Enums§
- Auto
Update Handle - Handle for an ongoing or cached background update check.
Mirrors renri’s
AutoUpdateHandle.
Functions§
- default_
interval - Default interval between background update checks (24 hours).
- finalize_
auto_ update_ check - Print the update banner (if any) before the binary exits. Waits up to one second for an in-flight background check to finish; on timeout, falls back to the previously-cached release so the user still gets the nudge. Skips the leading newline when the banner would be empty (e.g. kaishin returning a release that doesn’t actually outrank the running version). (PR #76 review by gemini-code-assist.)
- maybe_
spawn_ auto_ update_ check - Spawn a background check on
std::thread::spawnif the user hasn’t opted out and the cache is older than the configured interval. The returned handle is consumed byfinalize_auto_update_checkat shutdown. - run_
self_ update - Run
yui self-update. Flags map directly onto kaishin’sUpdateOptions: