From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-Status: No, score=-4.0 required=3.0 tests=ALL_TRUSTED,BAYES_00 shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id D35F71FC0B for ; Tue, 9 Feb 2021 08:09:38 +0000 (UTC) From: Eric Wong To: meta@public-inbox.org Subject: [PATCH 08/11] lei q: prefix --alert ops with ':' instead of '-' Date: Tue, 9 Feb 2021 07:09:34 -0100 Message-Id: <20210209080937.4678-9-e@80x24.org> In-Reply-To: <20210209080937.4678-1-e@80x24.org> References: <20210209080937.4678-1-e@80x24.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: Using dashed keywords confuses the option parser without "=" signs (and bash completion doesn't yet work with "="). So use ":" instead of "-" as the prefix for internal ops, since ":" is just as unlikely to be the first character of an executable file in a user's $PATH. --- lib/PublicInbox/LEI.pm | 8 ++++---- lib/PublicInbox/LeiOverview.pm | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/PublicInbox/LEI.pm b/lib/PublicInbox/LEI.pm index e2a945a4..e29b13c3 100644 --- a/lib/PublicInbox/LEI.pm +++ b/lib/PublicInbox/LEI.pm @@ -227,9 +227,9 @@ my %OPTDESC = ( 'show threads|t' => 'display entire thread a message belongs to', 'q threads|t' => 'return all messages in the same threads as the actual match(es)', -'alert=s@' => ['CMD,-WINCH,-bell,', +'alert=s@' => ['CMD,:WINCH,:bell,', 'run command(s) or perform ops when done writing to output ' . - '(default: "-WINCH,-bell" with --mua and Maildir/IMAP output, ' . + '(default: ":WINCH,:bell" with --mua and Maildir/IMAP output, ' . 'nothing otherwise)' ], 'augment|a' => 'augment --output destination instead of clobbering', @@ -758,14 +758,14 @@ sub poke_mua { # forces terminal MUAs to wake up and hopefully notice new mail my ($self) = @_; my $alerts = $self->{opt}->{alert} // return; while (my $op = shift(@$alerts)) { - if ($op eq '-WINCH') { + if ($op eq ':WINCH') { # hit the process group that started the MUA if ($self->{sock}) { send($self->{sock}, '-WINCH', MSG_EOR); } elsif ($self->{oneshot}) { kill('-WINCH', $$); } - } elsif ($op eq '-bell') { + } elsif ($op eq ':bell') { out($self, "\a"); } elsif ($op =~ /(?fail($@) if $@; if ($opt->{mua} && $lei->{l2m}->lock_free) { $lei->{early_mua} = 1; - $opt->{alert} //= [ '-WINCH,-bell' ] if -t $lei->{1}; + $opt->{alert} //= [ ':WINCH,:bell' ] if -t $lei->{1}; } } $self;