Expand description
Update notice and self-update for the family’s command-line tools, from GitHub releases.
Each tool’s CLI used to carry its own copy of this, and the copies had drifted apart. What they share:
- The notice is cheap, and it can be turned off. A command may ask GitHub for the
latest release at most once a day. The answer is cached, so the other runs of the day
make no network request and wait for nothing. No check is made when the user turns it off
(
UpdateCheck::start’sdisabled, wired to a--no-update-checkflag, or the<TOOL>_NO_UPDATE_CHECK/UNPARSER_NO_UPDATE_CHECKenvironment variables), in CI (CIis set), or when stderr, where the notice is printed, is not a terminal. - The update installs the tool’s own archive. A release carries the CLI archive
<bin>-<os>-<arch>-v<version>.<ext>and the C library archivelib<bin>-…, whose name contains the CLI’s. Asset names are therefore compared for equality, never by substring.
Structs§
- Tool
- The tool an update is for.
- Update
Check - A run’s update check: started when the command starts, finished when it ends.
Enums§
- Skip
- Why no check is made, if one is not.
Constants§
- FAMILY_
OPT_ OUT_ VARIABLE - The variable that turns the notice off for every tool of the family.
Functions§
- run_
update - The
updatecommand: report the latest release and, unlesscheck_only, replace the running executable with it.forcereinstalls even when up to date. Acargo installis pointed atcargo installinstead. - skip_
reason - Whether a run should look for an update, given its environment.
envreads a variable,stderr_is_terminalsays where the notice would go.