]> Sergey Matveev's repositories - public-inbox.git/blobdiff - lib/PublicInbox/LeiInput.pm
lei rm-watch: new command to support removing watches
[public-inbox.git] / lib / PublicInbox / LeiInput.pm
index 38d3d36df27248b94bd05ebe307498dc73f01ae9..88889f45cbd1ca964c0a1bc6da45db1125530617 100644 (file)
@@ -270,6 +270,10 @@ sub prepare_inputs { # returns undef on error
                                $sync and $input = 'maildir:'.
                                                $lei->abs_path($input_path);
                                push @md, $input;
+                       } elsif ($self->{missing_ok} && !-e _) {
+                               # for "lei rm-watch" on missing Maildir
+                               $sync and $input = 'maildir:'.
+                                               $lei->abs_path($input_path);
                        } else {
                                return $lei->fail("Unable to handle $input");
                        }
@@ -300,10 +304,15 @@ $input is `eml', not --in-format=$in_fmt
                                push @f, $input;
                        } elsif (-d "$input/new" && -d "$input/cur") {
                                if ($sync) {
-                                       $input = $lei->abs_path($input);
+                                       $input = 'maildir:'.
+                                               $lei->abs_path($input);
                                        push @{$sync->{ok}}, $input;
                                }
                                push @md, $input;
+                       } elsif ($self->{missing_ok} && !-e $input) {
+                               # for lei rm-watch
+                               $sync and $input = 'maildir:'.
+                                               $lei->abs_path($input);
                        } else {
                                return $lei->fail("Unable to handle $input")
                        }
@@ -371,6 +380,7 @@ sub input_only_net_merge_all_done {
 
 # like Getopt::Long, but for +kw:FOO and -kw:FOO to prepare
 # for update_xvmd -> update_vmd
+# returns something like { "+L" => [ @Labels ], ... }
 sub vmd_mod_extract {
        my $argv = $_[-1];
        my $vmd_mod = {};