feat: Legend and terminal-wide descriptions in list
- list: legend with one status per line (symbol, meaning, count) - list: description column sized to the terminal width (20 to 60 characters), 50 when the output is not a terminal - welcome: drop the status emojis, now explained by the legend - demo: tour re-recorded (taller window for the legend) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018inUJksoKAfKRWoSo1tvv6
This commit is contained in:
1 parent
80533c18c4
commit
1253ecd07b
5 files changed
+312
-296
No files matched your search
+17
-3
@@ -13,8 +13,17 @@ while IFS=$'\t' read -r n u d; do
|
||||
lxd_desc[$n]=$d
|
||||
done < <(yq -r '.[] | [.name, (.used_by | length), (.description // "")] | @tsv' <<<"$installed")
|
||||
|
||||
# Description tronquée pour tenir dans sa colonne.
|
||||
index=$(repo_index)
|
||||
|
||||
# Description tronquée pour tenir dans sa colonne : dans un terminal, la largeur
|
||||
# restante une fois les autres colonnes placées (entre 20 et 60), sinon 50.
|
||||
DESC_WIDTH=50
|
||||
if [ -t 1 ] && cols=$(tput cols 2>/dev/null); then
|
||||
file_width=$(awk -F'\t' '{ if (length($2) > m) m = length($2) } END { print m + 0 }' <<<"$index")
|
||||
# 39 = marge, icône, nom (24), « utilisé » (7) et espaces entre colonnes
|
||||
DESC_WIDTH=$((cols - 39 - file_width))
|
||||
DESC_WIDTH=$((DESC_WIDTH < 20 ? 20 : DESC_WIDTH > 60 ? 60 : DESC_WIDTH))
|
||||
fi
|
||||
short() {
|
||||
local d="${1//$'\n'/ }"
|
||||
if [ "${#d}" -gt "$DESC_WIDTH" ]; then d="${d:0:$((DESC_WIDTH - 1))}…"; fi
|
||||
@@ -47,7 +56,7 @@ while IFS=$'\t' read -r name file; do
|
||||
row "📝" "$YELLOW" "$name" "$desc" "${used[$name]}" "$file" "$extra"
|
||||
changed=$((changed + 1))
|
||||
fi
|
||||
done < <(repo_index)
|
||||
done <<<"$index"
|
||||
|
||||
others=()
|
||||
for n in "${!used[@]}"; do [ -n "${seen[$n]:-}" ] || others+=("$n"); done
|
||||
@@ -59,4 +68,9 @@ if [ "${usage_all:-false}" = "true" ] && [ "${#others[@]}" -gt 0 ]; then
|
||||
fi
|
||||
|
||||
echo
|
||||
echo " ✅ ${same} à jour 📝 ${changed} différent(s) ${D}(mise run diff)${R} ⬜ ${absent} non installé(s) 🔹 ${#others[@]} hors dépôt${D}$([ "${usage_all:-false}" = "true" ] || echo ' (--all)')${R}"
|
||||
hint_all=""; [ "${usage_all:-false}" = "true" ] || hint_all=" ${D}(--all)${R}"
|
||||
echo " ${B}Légende :${R}"
|
||||
echo " • ✅ à jour (${same})"
|
||||
echo " • 📝 installé, différent du dépôt (${changed}) ${D}→ mise run diff${R}"
|
||||
echo " • ⬜ non installé (${absent})"
|
||||
echo " • 🔹 installé, absent du dépôt (${#others[@]})${hint_all}"
|
||||
Reference in new issue
Block a user