Bladeren bron

Update shellfu-embedded version

Alois Mahdal 7 jaren geleden
bovenliggende
commit
394665beea
1 gewijzigde bestanden met toevoegingen van 22 en 9 verwijderingen
  1. 22
    9
      dotfiles/imapdomo/utils/imapdomo-cron

+ 22
- 9
dotfiles/imapdomo/utils/imapdomo-cron Bestand weergeven

658
 shellfu import pretty
658
 shellfu import pretty
659
 
659
 
660
 usage() {
660
 usage() {
661
-    mkusage "newmail" \
662
-            "rewind" \
663
-            "cleanup" \
664
-         -- "newmail - check for and file new mail" \
665
-            "rewind - re-add messages from FILTER_FAIL back" \
666
-            "       to FILTER_QUEUE" \
667
-            "cleanup - delete or archive old messages"
661
+    mkusage "[options] ACTION" \
662
+        -o                                                                    \
663
+            "-c DIR      change to DIR before doing anything"                 \
664
+            "-d          turn on debugging mode"                              \
665
+       --                                                                     \
666
+       "imapdomo will try to read .imapdomo/host/HOSTNAME/init.lua and"       \
667
+       ".imapdomo/host/HOSTNAME/handlers/ACTION.lua, where HOSTNAME is your"  \
668
+       "short hostname (eg. 'foo' in 'foo.example.com')."                     \
669
+       ""                                                                     \
670
+       "four valid actions are understood; since you must write handler for"  \
671
+       "each action you want to use, the meanings below are purely a guide:"  \
672
+       ""                                                                     \
673
+       "    newmail - check for and file new mail"                            \
674
+       "    rewind  - re-add messages from FILTER_FAIL back to FILTER_QUEUE"  \
675
+       "    cleanup - delete or archive old messages"                         \
676
+       "    migrate - move mail between mailboxes"                            \
677
+       ""                                                                     \
678
+       "See imapfilter_config(5)) for guide and API reference.  Few functions"\
679
+       "are also available in .imapdomo/common.lua"
668
 }
680
 }
669
 
681
 
670
 mkcmd() {
682
 mkcmd() {
691
     local LogDir    # directory to store logs
703
     local LogDir    # directory to store logs
692
     local CdTo      # change dir to this before running imapfilter
704
     local CdTo      # change dir to this before running imapfilter
693
     CfgDir="$HOME/.imapdomo"
705
     CfgDir="$HOME/.imapdomo"
694
-    LogDir="$HOME/.cache/imapdomo/logs"
706
+    LogDir="$HOME/.local/share/imapdomo/logs"
695
     Debug=false
707
     Debug=false
708
+    #shellcheck disable=SC2034
696
     while true; do case $1 in
709
     while true; do case $1 in
697
         -c) CdTo="$2"; shift 2 || usage ;;
710
         -c) CdTo="$2"; shift 2 || usage ;;
698
         -d) Debug=true; PRETTY_DEBUG=true; shift ;;
711
         -d) Debug=true; PRETTY_DEBUG=true; shift ;;
700
         *)  break ;;
713
         *)  break ;;
701
     esac done
714
     esac done
702
     Action="$1"; shift
715
     Action="$1"; shift
703
-    grep -qw "$Action" <<< "newmail|rewind|cleanup" || usage
716
+    grep -qw "$Action" <<< "newmail|rewind|cleanup|migrate" || usage
704
     cmd=$(mkcmd)
717
     cmd=$(mkcmd)
705
     debug -v cmd
718
     debug -v cmd
706
     bash -n <<<"$cmd" || die
719
     bash -n <<<"$cmd" || die