diff options
author | Eric Wong <e@80x24.org> | 2020-09-01 01:15:02 +0000 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2020-09-02 08:53:56 +0000 |
commit | a48e37f10fd5de2a28d9fca95425603f4fa42e6d (patch) | |
tree | 779f8b20cde247074cccea81632769a2ba8f016a /lib | |
parent | 16870b42ac68a8704467989cb20c2c571e4749ab (diff) | |
download | public-inbox-a48e37f10fd5de2a28d9fca95425603f4fa42e6d.tar.gz |
For consistency with other commands, though the protocol-specific options should refer users to the manpage.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/PublicInbox/Daemon.pm | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/lib/PublicInbox/Daemon.pm b/lib/PublicInbox/Daemon.pm index 000ba169..e5798a4b 100644 --- a/lib/PublicInbox/Daemon.pm +++ b/lib/PublicInbox/Daemon.pm @@ -77,7 +77,20 @@ sub daemon_prepare ($) { my $listener_names = {}; # sockname => IO::Handle my $oldset = PublicInbox::Sigfd::block_signals(); @CMD = ($0, @ARGV); - my %opts = ( + my ($prog) = ($CMD[0] =~ m!([^/]+)\z!g); + my $help = <<EOF; +usage: $prog [-l ADDRESS] [--cert=FILE] [--key=FILE] + +options: + + -l ADDRESS address to listen on (default: $default_listen) + --cert=FILE default SSL/TLS certificate + --key=FILE default SSL/TLS certificate + -W WORKERS number of worker processes to spawn (default: 1) + +See public-inbox-daemon(8) and $prog(1) man pages for more. +EOF + my %opt = ( 'l|listen=s' => \@cfg_listen, '1|stdout=s' => \$stdout, '2|stderr=s' => \$stderr, @@ -88,8 +101,10 @@ sub daemon_prepare ($) { 'D|daemonize' => \$daemonize, 'cert=s' => \$default_cert, 'key=s' => \$default_key, + 'help|h' => \(my $show_help), ); - GetOptions(%opts) or die "bad command-line args\n"; + GetOptions(%opt) or die $help; + if ($show_help) { print $help; exit 0 }; if (defined $pid_file && $pid_file =~ /\.oldbin\z/) { die "--pid-file cannot end with '.oldbin'\n"; |