diff options
| author | Danilo M. <danix@danix.xyz> | 2026-09-25 11:10:47 +0200 |
|---|---|---|
| committer | Danilo M. <danix@danix.xyz> | 2026-09-25 11:10:47 +0200 |
| commit | daa73c48a7282c9b21757626b4eb141e47bdbd5c (patch) | |
| tree | 660b8e3f2bf4e37de1e13aa86d0e2f211f6c211b | |
| parent | 41b241053b139bf3f0648868adec16613d4ce8cc (diff) | |
| download | danix-nvchecker-daa73c48a7282c9b21757626b4eb141e47bdbd5c.tar.gz danix-nvchecker-daa73c48a7282c9b21757626b4eb141e47bdbd5c.zip | |
nvtable: one-line [repo] pkg installed -> repo layout
Rows now read '[label] name installed -> repo <markers> [upstream]'.
Repo tags map to labels (personal, my-sbo, pentesting); packages in none
of my repos are labelled [SBo]. Upstream is appended only when the repo
column does not already show it.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
| -rw-r--r-- | README.md | 18 | ||||
| -rwxr-xr-x | nvtable | 59 |
2 files changed, 47 insertions, 30 deletions
@@ -11,15 +11,21 @@ two columns that matter in practice, the version installed on this machine and the version shipped by the SlackBuild repo that packages it. ``` - package upstream installed repo - ๐ด discord 1.0.152 1.0.151 my 1.0.152 - ๐ด๐ก nuclei 3.11.1 3.11.0 sbo 3.11.0 - ๐ด signal-desktop 8.22.0 8.20.0 -- - ๐ข qarma 1.1.1 1.1.1 my 1.1.1 + [personal] discord 1.0.151 -> 1.0.152 ๐ด + [my-sbo] nuclei 3.11.0 -> 3.11.0 ๐ด ๐ก 3.11.1 + [SBo] signal-desktop 8.20.0 -> -- ๐ด 8.22.0 + [personal] qarma 1.1.1 -> 1.1.1 ๐ข 26 to upgrade ยท 2 repos to bump ยท 32 current ยท 13 not installed ``` +Each row reads `[repo] package installed -> repo`, then the markers. The +upstream version is appended only when the repo column does not already show +it: the repo is behind, or the package is not in any of my repos (`[SBo]`, +built straight from SlackBuilds.org). Repo labels: `personal` = +my-slackbuilds, `my-sbo` = sbo-slackbuilds, `pentesting` = +Slackware-Pentesting-Suite. + | marker | meaning | |--------|---------| | ๐ด | installed version is behind upstream | @@ -27,7 +33,7 @@ the version shipped by the SlackBuild repo that packages it. | ๐ข | installed and packaged versions both match upstream | | โช | not installed on this host (tracked only) | -A row can carry two markers: ๐ด๐ก means upstream moved and neither the system +A row can carry two markers: ๐ด ๐ก means upstream moved and neither the system nor the SlackBuild has caught up. ## Contents @@ -27,6 +27,9 @@ NEWVER="${NVTABLE_NEWVER:-$HOME/.config/nvchecker/new_ver.json}" AI_STATE="${XDG_STATE_HOME:-$HOME/.local/state}/appimage-updater/installed.json" LOCK="${TMPDIR:-/tmp}/nvtable-$UID.lock" +# Repo tag -> label shown in the [brackets] column. +declare -A REPO_LABEL=([sbo]=my-sbo [my]=personal [sps]=pentesting) + SUPER="$HOME/Programming/GIT/slackbuilds-superrepo" REPOS=( "sbo:$SUPER/sbo-slackbuilds" @@ -222,36 +225,44 @@ done < <(jq -r '.data|to_entries[]|"\(.key)\t\(.value.version // .value)"' "$NEW # --- output ----------------------------------------------------------------- if ((${#rows[@]})); then - # Widen the name column to the longest actual name, so a long stanza does not - # shunt every later column out of alignment. - w=22 - for r in "${rows[@]}"; do n=${r%%|*}; (( ${#n} > w )) && w=${#n}; done - printf '%s %-*s %-14s %-14s %s%s\n' "$DIM" "$w" "package" "upstream" "installed" "repo" "$R" + # Pad every column to its widest value before adding color (printf would + # count the escape bytes as width). Upstream is appended only when the repo + # column does not already show it: repo behind, or nothing packaged. + wl=0 wn=0 wi=0 wr=0 + for i in "${!rows[@]}"; do + IFS='|' read -r name uver iver rver rwhich si sr <<<"${rows[i]}" + lbl= + for t in ${rwhich//,/ }; do lbl+=${lbl:+,}${REPO_LABEL[$t]:-$t}; done + lbl="[${lbl:-SBo}]" # not in my repos: built straight from SBo + rows[i]="${rows[i]}|$lbl" + (( ${#lbl} > wl )) && wl=${#lbl} + (( ${#name} > wn )) && wn=${#name} + (( ${#iver} > wi )) && wi=${#iver} + (( ${#rver} > wr )) && wr=${#rver} + done + (( wi < 2 )) && wi=2; (( wr < 2 )) && wr=2 for r in "${rows[@]}"; do - IFS='|' read -r name uver iver rver rwhich si sr <<<"$r" - if [[ -z $iver ]]; then ic="$DIM"; ishow="--" - elif (( si )); then ic="$GRN"; ishow=$iver - else ic="$RED"; ishow=$iver + IFS='|' read -r name uver iver rver rwhich si sr lbl <<<"$r" + if [[ -z $iver ]]; then ic="$DIM"; iver="--" + elif (( si )); then ic="$GRN" + else ic="$RED" + fi + if [[ -z $rver ]]; then rc="$DIM"; rver="--" + elif (( sr )); then rc="$GRN" + else rc="$YEL" fi # Installed-behind and repo-behind are independent, and a row can be both # (upstream moved, and neither the system nor the .info has caught up), so # the marker shows each dimension rather than collapsing to the worst one. - if [[ -z $iver ]]; then mark="$E_NA" - elif (( si )); then mark="$E_OK" - else mark="$E_UP" - fi - (( sr )) || mark+="$E_REPO" - if [[ -z $rver ]]; then rc="$DIM"; rtxt="--" - elif (( sr )); then rc="$GRN"; rtxt="$rwhich $rver" - else rc="$YEL"; rtxt="$rwhich $rver" - fi - # Pad the marker cell to a fixed width: rows carrying both markers must not - # push the name column right relative to rows carrying one. - if (( NO_EMOJI )); then mcell=$(printf '%-5s' "$mark") - else mcell=$mark; (( ${#mark} > 1 )) || mcell="$mark " + if [[ $iver == -- ]]; then mark="$E_NA" + elif (( si )); then mark="$E_OK" + else mark="$E_UP" fi - printf ' %s %s%-*s%s %-14s %s%-14s%s %s%s%s\n' \ - "$mcell" "$WHT" "$w" "$name" "$R" "$uver" "$ic" "$ishow" "$R" "$rc" "$rtxt" "$R" + (( sr )) || mark+=" $E_REPO" + utxt=; [[ $rver == -- ]] || (( ! sr )) && utxt=" $CYA$uver$R" + printf ' %s%-*s%s %s%-*s%s %s%*s%s -> %s%-*s%s %s%s\n' \ + "$DIM" "$wl" "$lbl" "$R" "$WHT" "$wn" "$name" "$R" \ + "$ic" "$wi" "$iver" "$R" "$rc" "$wr" "$rver" "$R" "$mark" "$utxt" done echo fi |
