diff options
| author | 2026-04-21 01:23:28 +0100 | |
|---|---|---|
| committer | 2026-04-21 01:23:28 +0100 | |
| commit | 0287a4b0e256288c311bbfbc390de774d2f66d35 (patch) | |
| tree | 2666a46fef14b70d59a8ef4b909a099042afde4d | |
| parent | b76c61bc0eb1930d576c04226d9b61cbb23b0a60 (diff) | |
| download | dotfiles-0287a4b0e256288c311bbfbc390de774d2f66d35.tar.gz dotfiles-0287a4b0e256288c311bbfbc390de774d2f66d35.tar.bz2 dotfiles-0287a4b0e256288c311bbfbc390de774d2f66d35.zip | |
feat: 'just undeclared' now considers only active (≥50%) groups
A package only listed in unadopted groups (e.g. steam in gaming on a
non-gaming machine) now counts as undeclared.
Extracts a hidden _active-packages helper so pkg-drift and undeclared
share the same 'active list' logic.
| -rw-r--r-- | justfile | 34 |
1 files changed, 18 insertions, 16 deletions
@@ -50,20 +50,7 @@ status: pkg-drift dotfile-drift # Show package drift: missing packages in adopted groups + undeclared installed packages pkg-drift: #!/bin/sh - active_file=$(mktemp) - trap 'rm -f "$active_file"' EXIT - for file in meta/*.txt; do - pkgs=$(grep -v '^\s*#' "$file" | grep -v '^\s*$') - total=$(echo "$pkgs" | wc -l) - installed=0 - for pkg in $pkgs; do - pacman -Qi "$pkg" >/dev/null 2>&1 && installed=$((installed + 1)) - done - if [ $((installed * 2)) -ge "$total" ]; then - echo "$pkgs" >> "$active_file" - fi - done - active=$(sort -u "$active_file") + active=$(just _active-packages) echo "=== Package drift ===" echo "$active" | while read -r pkg; do [ -z "$pkg" ] && continue @@ -80,9 +67,9 @@ dotfile-drift: # Print undeclared packages one per line, unindented (pipe to 'paru -Rs -' to remove them) undeclared: #!/bin/sh - declared=$(cat meta/*.txt | grep -v '^\s*#' | grep -v '^\s*$' | sort -u) + active=$(just _active-packages) pacman -Qqe | while read -r pkg; do - echo "$declared" | grep -qxF "$pkg" || echo "$pkg" + echo "$active" | grep -qxF "$pkg" || echo "$pkg" done # Show dotfile diffs; pass a path to limit to a single file (e.g. just diff .config/nvim/init.lua) @@ -177,3 +164,18 @@ _chezmoi-init: _install-hooks: git config core.hooksPath .githooks + +# Print packages from groups that are ≥50% installed (adopted), one per line +_active-packages: + #!/bin/sh + for file in meta/*.txt; do + pkgs=$(grep -v '^\s*#' "$file" | grep -v '^\s*$') + total=$(echo "$pkgs" | wc -l) + installed=0 + for pkg in $pkgs; do + pacman -Qi "$pkg" >/dev/null 2>&1 && installed=$((installed + 1)) + done + if [ $((installed * 2)) -ge "$total" ]; then + echo "$pkgs" + fi + done | sort -u |
