summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordakkar <dakkar@thenautilus.net>2020-01-11 14:59:16 +0000
committerdakkar <dakkar@thenautilus.net>2020-01-11 14:59:16 +0000
commit82de046fe2813a016450b3568b2db7286cf5d57c (patch)
tree2efc1da0c4fbff494fac715ba269807f55424512
parentlock when reading, too (diff)
downloadMaildirIndexer-82de046fe2813a016450b3568b2db7286cf5d57c.tar.gz
MaildirIndexer-82de046fe2813a016450b3568b2db7286cf5d57c.tar.bz2
MaildirIndexer-82de046fe2813a016450b3568b2db7286cf5d57c.zip
allow multiple maildirs on cmdline
-rw-r--r--bin/maildir-indexer4
-rw-r--r--lib/MaildirIndexer/ScanDir.rakumod8
2 files changed, 6 insertions, 6 deletions
diff --git a/bin/maildir-indexer b/bin/maildir-indexer
index 2ee76f8..1bb1740 100644
--- a/bin/maildir-indexer
+++ b/bin/maildir-indexer
@@ -7,8 +7,8 @@ use MaildirIndexer::Server;
use MaildirIndexer::Index::ByRef;
use MaildirIndexer::Index::ByAddresses;
-sub MAIN($maildir,Int :$port = 9000) {
- my $file-channel = scan-dir($maildir).Channel;
+sub MAIN(*@maildirs, Int :$port = 9000) {
+ my $file-channel = scan-dir(@maildirs).Channel;
my $store = MaildirIndexer::Store.new(
:$file-channel,
indices => (
diff --git a/lib/MaildirIndexer/ScanDir.rakumod b/lib/MaildirIndexer/ScanDir.rakumod
index c45d787..e909d58 100644
--- a/lib/MaildirIndexer/ScanDir.rakumod
+++ b/lib/MaildirIndexer/ScanDir.rakumod
@@ -3,7 +3,7 @@ unit module MaildirIndexer::ScanDir;
class End {};
-sub scan-dir(IO() $path --> Supply) is export {
+sub scan-dir(@paths --> Supply) is export {
supply {
my %watched-dirs;
@@ -24,8 +24,8 @@ sub scan-dir(IO() $path --> Supply) is export {
}
}
- sub add-dir(IO::Path $dir) {
- my @todo = $dir;
+ sub add-dir(IO::Path @dirs) {
+ my (@todo) = @dirs;
while @todo {
my $next = @todo.shift;
@@ -46,7 +46,7 @@ sub scan-dir(IO() $path --> Supply) is export {
}
- add-dir($path);
+ add-dir(Array[IO::Path].new(@paths».IO));
emit End;
}
}