]> Sergey Matveev's repositories - public-inbox.git/blob - lib/PublicInbox/Config.pm
trivial config module for dumping config
[public-inbox.git] / lib / PublicInbox / Config.pm
1 # Copyright (C) 2014, Eric Wong <normalperson@yhbt.net> and all contributors
2 # License: AGPLv3 or later (https://www.gnu.org/licenses/agpl-3.0.txt)
3 package PublicInbox::Config;
4
5 # returns key-value pairs of config directives in a hash
6 sub dump {
7         my ($class, $file) = @_;
8
9         local $ENV{GIT_CONFIG} = $file;
10
11         my @cfg = `git config -l`;
12         $? == 0 or die "git config -l failed: $?\n";
13         chomp @cfg;
14         my %rv = map { split(/=/, $_, 2) } @cfg;
15         \%rv;
16 }
17
18 1;