]> Sergey Matveev's repositories - feeder.git/commitdiff
Trivial style fixes master
authorSergey Matveev <stargrave@stargrave.org>
Sun, 18 Feb 2024 19:27:17 +0000 (22:27 +0300)
committerSergey Matveev <stargrave@stargrave.org>
Sun, 18 Feb 2024 19:27:17 +0000 (22:27 +0300)
cmd/clear
cmd/do-in-parallel
cmd/encs
cmd/warcs
contrib/feeds-oldenize.zsh
feeds-clear
feeds-news
urls2feeds

index 63eb946ae77264db7cc7b6b0675be3720db2acb7..7cf8ad3a4b4db6652c1a86f3a7818f6201b6b59a 100755 (executable)
--- a/cmd/clear
+++ b/cmd/clear
@@ -1,8 +1,7 @@
 #!/usr/bin/env zsh
-set -e
+setopt ERR_EXIT EXTENDED_GLOB
 cmds=$0:h:a
 . $cmds/env.rc
-setopt EXTENDED_GLOB
 [[ -s $1/max ]] && max=`cat $1/max` || max=$FEEDER_MAX_ITEMS
 (( max++ ))
 [[ $max -eq 1 ]] || rm -fv $1/cur/*(Nom[$max,-1])
index 3221422247bcde95b71887a5bc8c901b385c5f96..dc14114e487bb8398321438828ac255c6965f43d 100755 (executable)
@@ -1,5 +1,5 @@
 #!/usr/bin/env zsh
-set -e
+setopt ERR_EXIT
 cmds=$0:h:a
 . $cmds/env.rc
 log=$1.log
index a3642668ce45c1d31b6a09aeb1b3b33fe8b0b498..d16ab5efdbc9cfca0ca2ed9125842491ebcea969 100755 (executable)
--- a/cmd/encs
+++ b/cmd/encs
@@ -1,22 +1,21 @@
 #!/usr/bin/env zsh
-set -e
+setopt ERR_EXIT EXTENDED_GLOB
 cmds=$0:h:a
 . $cmds/env.rc
 fpath=($cmds/functions.zsh $fpath)
 dst=$2:a
 cd $1
-[[ -n "$dst" ]] || { dst=encs ; dst=$dst:a }
+[[ -n $dst ]] || { dst=encs ; dst=$dst:a }
 mkdir -p $dst
 autoload url-to-filename
 zmodload -F zsh/datetime b:strftime
-setopt EXTENDED_GLOB
 for new (new/*(N)) {
     while read line ; do
-        [[ "$line" != "" ]] || break
+        [[ -n $line ]] || break
         cols=(${(s: :)line})
         [[ $cols[1] = "X-Enclosure:" ]] || continue
         url=$cols[2]
-        [[ -n "$url" ]]
+        [[ -n $url ]]
         fn=$(strftime %Y%m%d-%H%M%S)-$(url-to-filename $url)
         ${=WGET} --user-agent=$FEEDER_USER_AGENT \
             --output-document=$dst/$fn $url 2>&2 2>encs.log
index 2f662abe2df420a7534a9bd2ff5137db8f6c3ca5..7934b63c2182230168870bedaf17f01ae4d127cb 100755 (executable)
--- a/cmd/warcs
+++ b/cmd/warcs
@@ -1,15 +1,14 @@
 #!/usr/bin/env zsh
-set -e
+setopt ERR_EXIT EXTENDED_GLOB
 cmds=$0:h:a
 . $cmds/env.rc
 fpath=($cmds/functions.zsh $fpath)
 dst=$2:a
 cd $1
-[[ -n "$dst" ]] || { dst=warcs ; dst=$dst:a }
+[[ -n $dst ]] || { dst=warcs ; dst=$dst:a }
 mkdir -p $dst
 autoload url-to-filename
 zmodload -F zsh/datetime b:strftime
-setopt EXTENDED_GLOB
 wget_opts=(
     --user-agent="$FEEDER_USER_AGENT"
     --page-requisites
@@ -20,7 +19,7 @@ wget_opts=(
 )
 for new (new/*(N)) {
     while read line ; do
-        [[ "$line" != "" ]] || break
+        [[ -n $line ]] || break
         cols=(${(s: :)line})
         [[ $cols[1] = "X-URL:" ]] || continue
         url=$cols[2]
index 0cc7f69fced62007459f1d660dc23262dc9f8b35..33b358683f9fad31b126c4525c0c753138fa6648 100755 (executable)
@@ -1,6 +1,5 @@
 #!/usr/bin/env zsh
-set -e
-setopt EXTENDED_GLOB
+setopt ERR_EXIT EXTENDED_GLOB
 for i (**/new) {
     pushd $i
     for m (*(N)) mv -v $m ../cur/"$m":2,S
index 62e73f2bdaba97fca28b12ba06be738f20a683ee..9329d672a4e4e976d0fd70bffa7af0af7e0293bb 100755 (executable)
@@ -1,4 +1,4 @@
 #!/usr/bin/env zsh
-set -e
+setopt ERR_EXIT
 cmds=$0:h:a/cmd
 for f (feeds/*) $cmds/clear $f
index 3d452023a2d563100d431fe7088e1c0be8f797ea..0f49d3fac6a5b6c92d5e07ea3f380c2caec75097 100755 (executable)
@@ -1,6 +1,5 @@
 #!/usr/bin/env zsh
-set -e
-setopt EXTENDED_GLOB
+setopt ERR_EXIT EXTENDED_GLOB
 for f (feeds/*(/on)) {
     news=($f/new/*(N))
     [[ $#news -eq 0 ]] || print "$f:t": $#news
index 486ba8217e06f48b83f8aea2781b230c1d20b33f..90b1341ad3202daae66583c74f91cec151262444 100755 (executable)
@@ -1,5 +1,5 @@
 #!/usr/bin/env zsh
-set -e
+setopt ERR_EXIT
 fpath=($0:h:a/cmd/functions.zsh $fpath)
 autoload url-to-filename
 typeset -A seen
@@ -10,7 +10,7 @@ while read url ; do
     seen[$dir]=1
     [[ -e $dir ]] && continue || :
     mkdir -p $dir/{cur,new,tmp} # make it maildir
-    echo "$url" > $dir/url
+    print -- "$url" > $dir/url
     print $dir
 done
 for dir (feeds/*) [[ $seen[$dir] -eq 1 ]] || print disappeared: $dir