| 
				
			 | 
			
			
				@@ -658,13 +658,25 @@ _pretty__warn() { 
			 | 
		
	
		
			
			| 
				658
			 | 
			
				658
			 | 
			
			
				 shellfu import pretty 
			 | 
		
	
		
			
			| 
				659
			 | 
			
				659
			 | 
			
			
				  
			 | 
		
	
		
			
			| 
				660
			 | 
			
				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
			 | 
			
				682
			 | 
			
			
				 mkcmd() { 
			 | 
		
	
	
		
			
			| 
				
			 | 
			
			
				@@ -691,8 +703,9 @@ main() { 
			 | 
		
	
		
			
			| 
				691
			 | 
			
				703
			 | 
			
			
				     local LogDir    # directory to store logs 
			 | 
		
	
		
			
			| 
				692
			 | 
			
				704
			 | 
			
			
				     local CdTo      # change dir to this before running imapfilter 
			 | 
		
	
		
			
			| 
				693
			 | 
			
				705
			 | 
			
			
				     CfgDir="$HOME/.imapdomo" 
			 | 
		
	
		
			
			| 
				694
			 | 
			
				
			 | 
			
			
				-    LogDir="$HOME/.cache/imapdomo/logs" 
			 | 
		
	
		
			
			| 
				
			 | 
			
				706
			 | 
			
			
				+    LogDir="$HOME/.local/share/imapdomo/logs" 
			 | 
		
	
		
			
			| 
				695
			 | 
			
				707
			 | 
			
			
				     Debug=false 
			 | 
		
	
		
			
			| 
				
			 | 
			
				708
			 | 
			
			
				+    #shellcheck disable=SC2034 
			 | 
		
	
		
			
			| 
				696
			 | 
			
				709
			 | 
			
			
				     while true; do case $1 in 
			 | 
		
	
		
			
			| 
				697
			 | 
			
				710
			 | 
			
			
				         -c) CdTo="$2"; shift 2 || usage ;; 
			 | 
		
	
		
			
			| 
				698
			 | 
			
				711
			 | 
			
			
				         -d) Debug=true; PRETTY_DEBUG=true; shift ;; 
			 | 
		
	
	
		
			
			| 
				
			 | 
			
			
				@@ -700,7 +713,7 @@ main() { 
			 | 
		
	
		
			
			| 
				700
			 | 
			
				713
			 | 
			
			
				         *)  break ;; 
			 | 
		
	
		
			
			| 
				701
			 | 
			
				714
			 | 
			
			
				     esac done 
			 | 
		
	
		
			
			| 
				702
			 | 
			
				715
			 | 
			
			
				     Action="$1"; shift 
			 | 
		
	
		
			
			| 
				703
			 | 
			
				
			 | 
			
			
				-    grep -qw "$Action" <<< "newmail|rewind|cleanup" || usage 
			 | 
		
	
		
			
			| 
				
			 | 
			
				716
			 | 
			
			
				+    grep -qw "$Action" <<< "newmail|rewind|cleanup|migrate" || usage 
			 | 
		
	
		
			
			| 
				704
			 | 
			
				717
			 | 
			
			
				     cmd=$(mkcmd) 
			 | 
		
	
		
			
			| 
				705
			 | 
			
				718
			 | 
			
			
				     debug -v cmd 
			 | 
		
	
		
			
			| 
				706
			 | 
			
				719
			 | 
			
			
				     bash -n <<<"$cmd" || die 
			 |