ssoma: add --since option for time-limiting imports
[ssoma-mda.git] / ssoma
diff --git a/ssoma b/ssoma
index b6332fd0ff3000b91f47b8fbf995cfd13706a823..dabd511d9c9bd2ecc456a8e3eebb0dc2b53bc6df 100755 (executable)
--- a/ssoma
+++ b/ssoma
@@ -35,7 +35,11 @@ our %cmd = (
        "sync" => {
                doc => "sync target(s) for existing LISTNAME",
                arg => "[LISTNAME] [TARGET]",
-               opt => { "cron" => \$opts{cron} }
+               opt => {
+                       cron => \$opts{cron},
+                       'since=s' => \$opts{since},
+                       'after=s' => \$opts{since},
+               }
        },
        "cat" => {
                doc => "show a message by Message-ID",
@@ -226,6 +230,7 @@ sub do_sync {
        my ($dir, $targets) = @_;
        my $git = Ssoma::Git->new($dir);
        my $ex = Ssoma::Extractor->new($git);
+       my $since = $opts{since};
 
        # no targets? sync all of them
        if (scalar(@$targets) == 0) {
@@ -247,7 +252,7 @@ sub do_sync {
        });
 
        foreach my $target (@$targets) {
-               $ex->extract($target);
+               $ex->extract($target, $since);
        }
 }