From da958b56acfc4d53623bf767fd4de309aece238d Mon Sep 17 00:00:00 2001 From: Sergey Matveev Date: Tue, 15 Mar 2022 20:54:36 +0300 Subject: [PATCH] Sizes in indices --- zk.zsh | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/zk.zsh b/zk.zsh index 9f9c716..7d5f556 100755 --- a/zk.zsh +++ b/zk.zsh @@ -22,9 +22,12 @@ EOF setopt GLOB_STAR_SHORT zmodload -F zsh/stat b:zstat typeset -A pages +typeset -A sizes for p (**(.)) { - zstat -A reply -F "%F %T" +mtime $p - pages[$p]=${reply[1]} + zstat -A mtime -F "%F %T" +mtime $p + zstat -A size +size $p + pages[$p]=${mtime[1]} + sizes[$p]=${size[1]} } typeset -a cats for p (**(/)) cats=($p $cats) @@ -126,7 +129,8 @@ genIndex() { (*) continue ;; esac } - for p (${(oi)_links}) entries=($entries "[$p] (${pages[$p]})") + for p (${(oi)_links}) \ + entries=($entries "[$p] (${pages[$p]}) (${sizes[$p]} bytes)") if [[ $cats ]]; then entries=($entries "\nSubdirectories:\n") for p (${(oi)cats}) { -- 2.44.0