From b8694107731a779b2e2ebd307577c8f1f6dc7c91 Mon Sep 17 00:00:00 2001 From: Sean Whitton Date: Sat, 23 Jan 2021 18:29:14 -0700 Subject: gmi2email: add --no-send Signed-off-by: Sean Whitton --- gmi2email | 9 +++++---- gmi2email.1.pod | 6 ++++++ 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/gmi2email b/gmi2email index 75816e6..67f9562 100755 --- a/gmi2email +++ b/gmi2email @@ -33,12 +33,13 @@ use Email::Date::Format "email_date"; use Time::Local; use Mail::Field::AddrList; -my ($from, $to, $do_subs, $inline_images); +my ($from, $to, $do_subs, $inline_images, $no_mail); GetOptions "from=s" => \$from, "to=s" => \$to, "subscriptions!" => \$do_subs, - "inline-images!" => \$inline_images; + "inline-images!" => \$inline_images, + "no-send!" => \$no_mail; my $conf_r = $ENV{XDG_CONFIG_HOME} || catfile $ENV{HOME}, ".config"; my $conf_f = catfile $conf_r, "mailscripts", "gmi2email.config"; @@ -74,7 +75,7 @@ for (@ARGV) { ($type, $data) = gemini_fetch($_, abs_links => 1); $type =~ m{^text/gemini} or die "$_ is not gemtext"; } - gemtext_to_mail($data, %to_mail_opts)->send; + $no_mail or gemtext_to_mail($data, %to_mail_opts)->send; } exit unless $do_subs; @@ -133,7 +134,7 @@ foreach my $sub (<$subs_fh>) { }; #>>> $dbh->do("INSERT INTO seen VALUES (\"$uri\")"); - $mail or next; + $mail and !$no_mail or next; if ($type =~ m{^text/gemini}) { gemtext_to_mail( $data, %to_mail_opts, diff --git a/gmi2email.1.pod b/gmi2email.1.pod index 5fa6d20..d4e656c 100644 --- a/gmi2email.1.pod +++ b/gmi2email.1.pod @@ -36,6 +36,12 @@ B<~/.config/mailscripts/gmi2email.subscriptions>. Download and inline any images included in the post. +=item B<--no-send> + +Don't actually send any mail. Intended when you just added some new +subscriptions and want to avoid receiving all the old posts you've already +read. + =item B<--from=>I
Set the From: address, overriding the configuration file. -- cgit v1.2.3