Add imapsync calls and everything

This commit is contained in:
Thelonius Kort
2026-01-15 22:36:59 +01:00
parent 7c6b61e3d6
commit 673d5408f4
2 changed files with 52 additions and 10 deletions

View File

@ -1,15 +1,15 @@
--- ---
- server1: mail.exampleserver1.de - host1: mail.examplehost1.de
user1: exampleuser1 user1: exampleuser1
pass1: examplepass1 password1: examplepassword1
server2: mail.exampleserver2.de host2: mail.examplehost2.de
user2: exampleuser2 user2: exampleuser2
pass2: examplepass2 password2: examplepassword2
- server1: mail.exampleserver1.de - host1: mail.examplehost1.de
user1: anotherexampleuser1 user1: anotherexampleuser1
pass1: anotherexamplepass1 password1: anotherexamplepassword1
server2: mail.exampleserver2.de host2: mail.examplehost2.de
user2: anotherexampleuser2 user2: anotherexampleuser2
pass2: anotherexamplepass2 password2: anotherexamplepassword2

View File

@ -1,8 +1,50 @@
#!/bin/env nu #!/bin/env nu
def main [conffile] { def main [] {
print "Usage: imapsync.nu [show_data|test_creds|synchronize] example.yaml"
}
open $conffile | each {|u| print $"server1: ($u.server1), user1: ($u.user1), \n server2: ($u.server2), user2: ($u.user2)" } def "main show_data" [conffile] {
(open $conffile |
each {|u|
print $"host1: ($u.host1), user1: ($u.user1),"
print $"host2: ($u.host2), user2: ($u.user2)\n"
}
)
""
}
def "main test_creds" [conffile] {
(open $conffile |
each {|u|
print "Testing credentials for:"
print $"host1: ($u.host1), user1: ($u.user1),"
print $"host2: ($u.host2), user2: ($u.user2)\n"
imapsync --justlogin --host1 $u.host1 --user1 $u.user1 --password1 $u.password1 --host2 $u.host2 --user2 $u.user2 --password2 $u.password2 | print
}
)
""
}
def "main synchronize" [conffile] {
(open $conffile |
each {|u|
print "Synchronizing:"
print $"host1: ($u.host1), user1: ($u.user1),"
print $"host2: ($u.host2), user2: ($u.user2)\n"
imapsync --syncinternaldates --host1 $u.host1 --user1 $u.user1 --password1 $u.password1 --host2 $u.host2 --user2 $u.user2 --password2 $u.password2 | print
}
)
"" ""
} }