]> Sergey Matveev's repositories - zk.zsh.git/commitdiff
Sizes in indices
authorSergey Matveev <stargrave@stargrave.org>
Tue, 15 Mar 2022 17:54:36 +0000 (20:54 +0300)
committerSergey Matveev <stargrave@stargrave.org>
Tue, 15 Mar 2022 17:54:36 +0000 (20:54 +0300)
zk.zsh

diff --git a/zk.zsh b/zk.zsh
index 9f9c71643f17dc8296a703b9a3ed96235edfdfd2..7d5f556236057922836232c478666b97ef469435 100755 (executable)
--- 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}) {