#!perl -w
# Copyright (C) all contributors
# License: AGPL-3.0+
# Wrapper to git fetch remote public-inboxes
use strict;
use v5.10.1;
use Getopt::Long qw(:config gnu_getopt no_ignore_case auto_abbrev);
my $opt = {};
my $help = <{help}) { print $help; exit };
require PublicInbox::Fetch; # loads Admin
PublicInbox::Admin::do_chdir(delete $opt->{C});
PublicInbox::Admin::setup_signals();
$SIG{PIPE} = 'IGNORE';
my $lei = bless {
env => \%ENV, opt => $opt, cmd => 'public-inbox-fetch',
0 => *STDIN{GLOB}, 1 => *STDOUT{GLOB}, 2 => *STDERR{GLOB},
}, 'PublicInbox::LEI';
PublicInbox::Fetch->do_fetch($lei, '.');
exit(($lei->{child_error} // 0) >> 8);