2 # Copyright (C) all contributors <meta@public-inbox.org>
3 # License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
4 # Wrapper to git fetch remote public-inboxes
7 use Getopt::Long qw(:config gnu_getopt no_ignore_case auto_abbrev);
9 my $help = <<EOF; # the following should fit w/o scrolling in 80x24 term:
10 usage: public-inbox-fetch -C DESTINATION
12 fetch remote public-inboxes
16 --torsocks VAL whether or not to wrap git and curl commands with
17 torsocks (default: `auto')
18 Must be one of: `auto', `no' or `yes'
19 --verbose | -v increase verbosity (may be repeated)
20 --quiet | -q increase verbosity (may be repeated)
21 -C DIR chdir to specified directory
23 GetOptions($opt, qw(help|h quiet|q verbose|v+ C=s@ c=s@
24 no-torsocks torsocks=s)) or die $help;
25 if ($opt->{help}) { print $help; exit };
26 require PublicInbox::Fetch; # loads Admin
27 PublicInbox::Admin::do_chdir(delete $opt->{C});
28 PublicInbox::Admin::setup_signals();
29 $SIG{PIPE} = 'IGNORE';
32 env => \%ENV, opt => $opt, cmd => 'public-inbox-fetch',
33 0 => *STDIN{GLOB}, 1 => *STDOUT{GLOB}, 2 => *STDERR{GLOB},
34 }, 'PublicInbox::LEI';
35 PublicInbox::Fetch->do_fetch($lei, '.');