]> Sergey Matveev's repositories - zk.zsh.git/commitdiff
Less variable names
authorSergey Matveev <stargrave@stargrave.org>
Tue, 15 Mar 2022 10:17:27 +0000 (13:17 +0300)
committerSergey Matveev <stargrave@stargrave.org>
Tue, 15 Mar 2022 10:17:27 +0000 (13:17 +0300)
zk.zsh

diff --git a/zk.zsh b/zk.zsh
index 25a3036ec1fbfb53ba4964a81726b8d8ccc15cd9..d45194d78a663d699cec2976d6c85b82268bcc75 100755 (executable)
--- a/zk.zsh
+++ b/zk.zsh
@@ -8,9 +8,9 @@ usage() {
     cat >&2 <<EOF
 Usage:
   \$ $0:t links PAGE
-    Print the PAGE's links
+    Print PAGE's links
   \$ $0:t backs PAGE
-    Print who backlinks to the PAGE
+    Print PAGE's backlinks
   \$ $0:t htmls DIR
     Generate HTMLs in DIR
 EOF
@@ -32,9 +32,9 @@ for p (**(/)) cats=($p $cats)
 zmodload zsh/mapfile
 typeset -A links
 typeset -A backs
-typeset -aU words
+typeset -aU ws
 for p (${(k)pages}) {
-    words=()
+    ws=()
     for w (${=mapfile[$p]}) {
         [[ $w =~ "\[([^] ]+)\]" ]] || continue
         w=${match[1]}
@@ -42,10 +42,11 @@ for p (${(k)pages}) {
             [[ $ZK_SHOW_MISSING ]] && print "missing $w"
             continue
         }
-        words=($words $w)
+        ws=($ws $w)
     }
-    [[ $words ]] && links[$p]=${(j: :)words}
+    [[ $ws ]] && links[$p]=${(j: :)ws}
 }
+unset ws
 for p ws (${(kv)links}) {
     for w (${=ws}) backs[$w]="$p ${backs[$w]}"
 }