diff options
| -rw-r--r-- | CLAUDE.md | 6 | ||||
| -rw-r--r-- | README.md | 11 | ||||
| -rw-r--r-- | nvchecker.toml | 7 | ||||
| -rwxr-xr-x | nvtable | 14 |
4 files changed, 31 insertions, 7 deletions
@@ -72,8 +72,10 @@ the rest, and they are separate because the mappings differ per direction: SlackBuild directory (`kitty` → `kitty-bin`). Adding one map for both breaks the other direction. -**Installed version** resolves through three sources in order: -`/var/log/packages`, then the appimage-updater state file, then `flatpak list`. +**Installed version** resolves through four sources in order: the `OPT_JSON` +map (apps unpacked under `/opt` that are none of the below, currently Typora, +declared as `<path>:<jq filter>`), `/var/log/packages`, the appimage-updater +state file, then `flatpak list`. **Repo version** is the `VERSION=` line from `<repo>/<category>/<pkg>/<pkg>.info`. Note the category level: `.info` files sit @@ -88,12 +88,15 @@ automatically when output is not a terminal. anything itself, so it is fast enough to run on every login; refreshing that file is nvchecker's job. -**installed** is resolved from three sources, in order: +**installed** is resolved from four sources, in order: -1. `/var/log/packages` for Slackware packages -2. `~/.local/state/appimage-updater/installed.json` for AppImages managed by +1. the `OPT_JSON` map, for apps unpacked under `/opt` that are none of the + below and carry their version in a JSON file (Electron apps such as Typora). + Each entry is a stanza name mapped to `<path>:<jq filter>`. +2. `/var/log/packages` for Slackware packages +3. `~/.local/state/appimage-updater/installed.json` for AppImages managed by [appimage-updater](https://git.danix.xyz/appimage-updater/) -3. `flatpak list` for flatpak apps +4. `flatpak list` for flatpak apps **repo** is the `VERSION=` line of `<repo>/<category>/<pkg>/<pkg>.info` across the configured SlackBuild repositories. diff --git a/nvchecker.toml b/nvchecker.toml index 5a3c990..0c0569e 100644 --- a/nvchecker.toml +++ b/nvchecker.toml @@ -390,6 +390,13 @@ github = "SoftFever/OrcaSlicer" use_latest_release = true prefix = "v" +# Proprietary, no git repo. The Linux changelog is the only per-platform feed: +# dev_update.xml carries the macOS dev channel and reports a different version. +[Typora] +source = "regex" +url = "https://typora.io/releases/linux" +regex = "<h2>([0-9]+\\.[0-9]+\\.[0-9]+)</h2>" + [cherrytree] source = "github" github = "giuspen/cherrytree" @@ -49,6 +49,13 @@ declare -A REPO_ALIAS=( [metasploit-framework]="metasploit-framework-bin" ) +# Stanza name -> JSON file carrying the installed version, for apps unpacked +# under /opt that are neither a package, an AppImage, nor a flatpak. Value is +# "<path>:<jq filter>". +declare -A OPT_JSON=( + [Typora]="/opt/Typora-linux-x64/resources/package.json:.version" +) + SHOW_ALL=0; NO_TAKE=0; NO_COLOR=0; NO_EMOJI=0 for a in "$@"; do case "$a" in @@ -140,7 +147,12 @@ if command -v flatpak >/dev/null 2>&1; then fi installed_of() { # echoes "version" or "" ; handles alias + case-insensitive - local n=$1 cand v + local n=$1 cand v spec f + if [[ -n ${OPT_JSON[$n]:-} ]]; then + spec=${OPT_JSON[$n]}; f=${spec%%:*} + [[ -r $f ]] && v=$(jq -r "${spec#*:} // empty" "$f" 2>/dev/null) \ + && [[ -n $v ]] && { echo "$v"; return; } + fi for cand in ${ALIAS[$n]:-$n}; do # Anchored lookup first: correct even when VERSION contains a dash. v=$(pkg_version "$cand") && { echo "$v"; return; } |
