]> Sergey Matveev's repositories - public-inbox.git/commitdiff
lei q: prefix --alert ops with ':' instead of '-'
authorEric Wong <e@80x24.org>
Tue, 9 Feb 2021 08:09:34 +0000 (07:09 -0100)
committerEric Wong <e@80x24.org>
Wed, 10 Feb 2021 06:59:08 +0000 (06:59 +0000)
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
lib/PublicInbox/LeiOverview.pm

index e2a945a4c3e88b2e102087f8941689da10de7052..e29b13c3a798abf11a793eb29f7075e32579bf45 100644 (file)
@@ -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,<any command>',
+'alert=s@' => ['CMD,:WINCH,:bell,<any command>',
        '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 =~ /(?<!\\),/) { # bare ',' (not ',,')
                        push @$alerts, split(/(?<!\\),/, $op);
index 98c89d12d197e0829fe39a68c510478eba71b128..c820f0d7c5262edea2619a54a8ba74715eac9b1c 100644 (file)
@@ -100,7 +100,7 @@ sub new {
                return $lei->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;