- Shell 100%
| Filename | Latest commit message | Latest commit date |
|---|---|---|
| LICENSE | ||
| README.md | ||
| uc | ||
uc
A tiny update checker. Point it at an items file, it tells you what's current and what's outdated.
Usage
./uc [OPTION]... <items-file>...
-t, --title show the file header even for a single file
-h, --help display this help and exit
-V, --version output version information and exit
Multiple items files can be given at once, each printed under its own header.
Items file
An items file sets $dir and $items, then defines two variables per item: the local version and the latest version. .uc is the conventional extension (e.g. isos.uc), though uc doesn't require it.
set dir "/path/to/check"
set items debian ubuntu_lts
set debian (ff Debian -f 'netinst' | rg -o "debian-(.*)-amd64" -r '$1')
set debian_latest (curl -s https://ftp.debian.org/debian/dists/stable/Release | rg -o "Version: (.*)" -r '$1')".0"
set ubuntu_lts (ff Ubuntu | rg -o "ubuntu-(.*)-desktop" -r '$1')
set ubuntu_lts_latest (curl -s https://releases.ubuntu.com/ | rg "p-list__item" | head -1 | rg -o "Ubuntu (.*) LTS" -r '$1')
Each item's local value is compared to its _latest value: green if they match, yellow with an arrow if they don't, red if the local one wasn't found.
Title (optional)
Set $title to override the header shown for that file. Falls back to the filename if not set.
set title "Linux ISOs"
Display names (optional)
Set $<item>_name to override how an item's name is printed. Falls back to the raw item name if not set.
set ubuntu_lts_name "Ubuntu LTS"
ff
A helper for finding files, included in uc itself. Used inside items files to grab the local version off disk.
ff NAME # find a file in $dir/NAME
ff -d PATH # find a file in PATH instead
ff NAME -f PATTERN # filter results with ripgrep first
ff NAME -p "CMD" # pipe results through CMD before picking one
ff's own -f filter uses rg (ripgrep) by default. This is set once at the top of uc as $filter_cmd, so swapping it for grep or anything else that takes a pattern is a one-line change.