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, URIBL_BLOCKED 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 1F0AA1FA18 for ; Tue, 1 Sep 2020 01:15:09 +0000 (UTC) From: Eric Wong To: meta@public-inbox.org Subject: [PATCH 08/10] watch: add --help/-h support Date: Tue, 1 Sep 2020 01:15:05 +0000 Message-Id: <20200901011507.1643-9-e@80x24.org> In-Reply-To: <20200901011507.1643-1-e@80x24.org> References: <20200901011507.1643-1-e@80x24.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: And avoid unnecessary POD markup in the man page. --- Documentation/public-inbox-watch.pod | 2 +- script/public-inbox-watch | 18 ++++++++++++++---- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/Documentation/public-inbox-watch.pod b/Documentation/public-inbox-watch.pod index f3e622b0..73340ec4 100644 --- a/Documentation/public-inbox-watch.pod +++ b/Documentation/public-inbox-watch.pod @@ -4,7 +4,7 @@ public-inbox-watch - mailbox watcher for public-inbox =head1 SYNOPSIS -B + public-inbox-watch In ~/.public-inbox/config: diff --git a/script/public-inbox-watch b/script/public-inbox-watch index b6c6b202..1d164aa3 100755 --- a/script/public-inbox-watch +++ b/script/public-inbox-watch @@ -1,13 +1,24 @@ #!/usr/bin/perl -w # Copyright (C) 2016-2020 all contributors # License: AGPL-3.0+ +my $help = <autoflush use PublicInbox::Watch; use PublicInbox::Config; use PublicInbox::DS; use PublicInbox::Sigfd; use PublicInbox::Syscall qw($SFD_NONBLOCK); +my $do_scan = 1; +GetOptions('scan!' => \$do_scan, # undocumented, testing only + 'help|h' => \(my $show_help)) or do { print STDERR $help; exit 1 }; +if ($show_help) { print $help; exit 0 }; my $oldset = PublicInbox::Sigfd::block_signals(); STDOUT->autoflush(1); STDERR->autoflush(1); @@ -44,9 +55,8 @@ if ($watch) { $sig->{QUIT} = $sig->{TERM} = $sig->{INT} = $quit; # --no-scan is only intended for testing atm, undocumented. - unless (grep(/\A--no-scan\z/, @ARGV)) { - PublicInbox::DS::requeue($scan); - } + PublicInbox::DS::requeue($scan) if $do_scan; + my $sigfd = PublicInbox::Sigfd->new($sig, $SFD_NONBLOCK); local %SIG = (%SIG, %$sig) if !$sigfd; if (!$sigfd) {