summary refs log tree commit diff
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2021-02-16 21:08:41 -0500
committerJune McEnroe <june@causal.agency>2021-02-16 21:08:41 -0500
commit8e18f2d58b66c8a6895e45ae06eb9eab9e432038 (patch)
tree16f3b2b082a7e0b5d16422466fd4476c545c80f2
parentAdd -M to move messages after export (diff)
downloadimbox-8e18f2d58b66c8a6895e45ae06eb9eab9e432038.tar.gz
imbox-8e18f2d58b66c8a6895e45ae06eb9eab9e432038.zip
Add --idle to git-fetch-email
Ok I said this didn't make sense but I want to use it for something,
in which git-fetch-email is just an authentication wrapper around
imbox, rather than specifically for fetching patches.
Diffstat (limited to '')
-rw-r--r--git-fetch-email.16
-rw-r--r--git-fetch-email.sh6
2 files changed, 10 insertions, 2 deletions
diff --git a/git-fetch-email.1 b/git-fetch-email.1
index de61874..7ffca89 100644
--- a/git-fetch-email.1
+++ b/git-fetch-email.1
@@ -9,7 +9,7 @@
 .Sh SYNOPSIS
 .Nm git
 .Cm fetch-email
-.Op Fl av
+.Op Fl aiv
 .Op Fl C Ar cc
 .Op Fl F Ar from
 .Op Fl M Ar mailbox
@@ -100,6 +100,10 @@ The default is the value of
 or as inferred by
 .Xr imbox 1 .
 .
+.It Fl i , Fl \-idle
+Wait for matching patches
+using IMAP IDLE.
+.
 .It Fl m Ar mailbox , Fl \-mailbox Ns = Ns Ar mailbox
 Fetch patches from
 .Ar mailbox .
diff --git a/git-fetch-email.sh b/git-fetch-email.sh
index 6109091..485f19d 100644
--- a/git-fetch-email.sh
+++ b/git-fetch-email.sh
@@ -16,6 +16,7 @@
 
 set -u
 
+idle=
 apply=
 verbose=
 host=$(git config fetchemail.imapServer)
@@ -39,6 +40,7 @@ S,subject= fetch patches with matching Subject headers
 T,to= fetch patches with matching To headers
 a,apply apply patches with git-am
 h,host=! connect to IMAP on host
+i,idle wait for matching patches
 m,mailbox=! fetch patches from mailbox
 p,port=! connect to IMAP on port
 u,user=! log in to IMAP as user
@@ -57,6 +59,7 @@ while [ $# -gt 0 ]; do
 		(-T) to=$1; shift;;
 		(-a) apply=yes;;
 		(-h) host=$1; shift;;
+		(-i) idle=yes;;
 		(-m) mailbox=$1; shift;;
 		(-p) port=$1; shift;;
 		(-u) user=$1; shift;;
@@ -64,6 +67,7 @@ while [ $# -gt 0 ]; do
 		(--no-apply) apply=;;
 		(--no-cc) cc=;;
 		(--no-from) from=;;
+		(--no-idle) idle=;;
 		(--no-move-to) move=;;
 		(--no-subject) subject=;;
 		(--no-to) to=;;
@@ -92,7 +96,7 @@ fi
 
 fetch() {
 	echo "${pass}" | imbox -w \
-		${verbose:+-v} \
+		${verbose:+-v} ${idle:+-i} \
 		${host:+-h "${host}"} \
 		${port:+-p "${port}"} \
 		${mailbox:+-m "${mailbox}"} \