From: Sergey Matveev Date: Sun, 4 May 2025 10:40:40 +0000 (+0300) Subject: Appropriate variable name X-Git-Url: http://www.git.stargrave.org/?a=commitdiff_plain;h=ed296a0781392e6dc9a18964048c4576d17b2c82;p=zk.git Appropriate variable name --- diff --git a/zk.zsh b/zk.zsh index bce348c..75abc13 100755 --- a/zk.zsh +++ b/zk.zsh @@ -23,7 +23,7 @@ EOF separator="------------------------ >8 ------------------------" setopt GLOB_STAR_SHORT zmodload -F zsh/stat b:zstat -typeset -A pages +typeset -A mtimes typeset -A sizes for p (**(.)) { [[ $p:t == "index" ]] && { @@ -32,7 +32,7 @@ for p (**(.)) { } zstat -A mtime -F "%F %T" +mtime $p zstat -A size +size $p - pages[$p]=${mtime[1]} + mtimes[$p]=${mtime[1]} sizes[$p]=${size[1]} } typeset -A cats @@ -44,7 +44,7 @@ typeset -A links typeset -A backs typeset -A cached typeset -aU ws -for p (${(k)pages}) { +for p (${(k)mtimes}) { [[ $ZK_CACHE ]] && { zstat -A inode +inode $p zstat -A ctime +ctime $p @@ -66,7 +66,7 @@ for p (${(k)pages}) { ws=($ws $w) continue } - [[ ${pages[$w]} ]] || { + [[ ${mtimes[$w]} ]] || { [[ $ZK_SHOW_MISSING ]] && print "missing $w" continue } @@ -138,7 +138,7 @@ $data" print "
Links:" fi @@ -147,7 +147,7 @@ $data" print "
Backlinks:" fi @@ -164,7 +164,7 @@ genIndex() { typeset -aU _cats=() local curdepth=${#${(s:/:)1}} (( curdepth = curdepth + 1 )) - for p (${(k)pages[(I)$1*]}) { + for p (${(k)mtimes[(I)$1*]}) { case ${#${(As:/:)p}} in ($curdepth) _links=($p $_links) ;; ( $(( $curdepth + 1 )) ) _cats=(${1}${${p#$1}%%/*} $_cats) ;; @@ -179,7 +179,7 @@ genIndex() { " if [[ $_cats ]]; then @@ -195,7 +195,7 @@ genIndex() { print "
Backlinks:" fi @@ -208,7 +208,7 @@ case $1 in (html) genHTML $2 ;; (html-index) genIndex $2 ;; (htmls) - for p (${(k)pages}) { + for p (${(k)mtimes}) { zf_mkdir -p $2/$p:h genHTML $p > $2/$p.html touch -r $p $2/$p.html