From: Eric Wong Date: Sat, 9 Aug 2025 01:02:11 +0000 (+0000) Subject: lei: input: warn on `L:' and `t:' use consistently X-Git-Url: http://git.ipfire.org/gitweb/gitweb.cgi?a=commitdiff_plain;p=thirdparty%2Fpublic-inbox.git lei: input: warn on `L:' and `t:' use consistently When using `--in-format/-F', we need to bail out on the /\A(?:L|kw):/ check as early as possible before checking for `$urlish_scheme:' vs. `--in-format' conflicts. Otherwise, we'd get a confusing error message such as: --in-format=mboxrd and `l:' conflict --- diff --git a/lib/PublicInbox/LeiInput.pm b/lib/PublicInbox/LeiInput.pm index f9d0d1e56..cc7e7aa0d 100644 --- a/lib/PublicInbox/LeiInput.pm +++ b/lib/PublicInbox/LeiInput.pm @@ -353,6 +353,9 @@ sub prepare_inputs { # returns undef on error # TODO: how would we detect r/w JMAP? push @{$sync->{no}}, $input if $sync; prepare_http_input($self, $lei, $input_path) or return; + } elsif ($input =~ /\A(?:L|kw):/) { + return $lei->fail("Unable to handle `$input', ". + "did you mean `+$input' ?"); } elsif ($input_path =~ s/\A([a-z0-9]+)://is) { my $ifmt = lc $1; if (($in_fmt // $ifmt) ne $ifmt) { @@ -380,10 +383,7 @@ sub prepare_inputs { # returns undef on error $may_sync and $input = "$ifmt:". $lei->abs_path($input_path); } else { - my $m = "Unable to handle $input"; - $input =~ /\A(?:L|kw):/ and - $m .= ", did you mean +$input?"; - return $lei->fail($m); + return $lei->fail("Unable to handle $input"); } } elsif ($input =~ /\.(?:eml|patch)\z/i && -f $input) { lc($in_fmt//'eml') eq 'eml' or return $lei->fail(<<"");