From d912ffb18952dd53d39e189e9259d4b4748e1f9f Mon Sep 17 00:00:00 2001 From: "Danilo M." Date: Sat, 8 Aug 2026 21:55:43 +0200 Subject: Track Typora as a real package, drop OPT_JSON Typora now ships as the typora-bin Slackware package from my-slackbuilds, so its installed version comes from /var/log/packages like everything else. The OPT_JSON map existed solely to read /opt/Typora-linux-x64/resources/package.json and is removed along with its branch in installed_of(). Typora joins through both alias maps instead: ALIAS for the installed package name and REPO_ALIAS for the SlackBuild directory, both typora-bin. The stanza is marked # repo=my. Co-Authored-By: Claude Opus 5 --- nvtable | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) (limited to 'nvtable') diff --git a/nvtable b/nvtable index 4955f92..9d02c67 100755 --- a/nvtable +++ b/nvtable @@ -38,6 +38,7 @@ REPOS=( declare -A ALIAS=( [kvantum]="kvantum-qt5 kvantum-qt6" [metasploit-framework]="metasploit-framework-bin" + [Typora]="typora-bin" ) # Stanza name -> SlackBuild directory name, where the repo dir differs from the @@ -47,13 +48,7 @@ declare -A REPO_ALIAS=( [claude-code]="claude-code-bin" [kvantum]="kvantum-qt6" [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 -# ":". -declare -A OPT_JSON=( - [Typora]="/opt/Typora-linux-x64/resources/package.json:.version" + [Typora]="typora-bin" ) SHOW_ALL=0; NO_TAKE=0; NO_COLOR=0; NO_EMOJI=0 @@ -147,12 +142,7 @@ if command -v flatpak >/dev/null 2>&1; then fi installed_of() { # echoes "version" or "" ; handles alias + case-insensitive - 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 + local n=$1 cand v for cand in ${ALIAS[$n]:-$n}; do # Anchored lookup first: correct even when VERSION contains a dash. v=$(pkg_version "$cand") && { echo "$v"; return; } -- cgit v1.2.3