diff options
author | Eric Wong <e@80x24.org> | 2019-11-15 09:50:34 +0000 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2019-11-16 11:05:23 +0000 |
commit | 321defd4c722ae897fc99e10ce8d05515a97e91f (patch) | |
tree | 35a0a6f985abaa46caf91c3eaf6f596be252f617 /script/public-inbox-edit | |
parent | 10fad7e1cf3eb0a4874afa1cb5ddb3d75afeec7d (diff) | |
download | public-inbox-321defd4c722ae897fc99e10ce8d05515a97e91f.tar.gz |
PublicInbox::Admin::config() just adds an extra layer of indirection which we barely rely on. So get rid of this global variable and make it easier to run tests in the future without relying on global state.
Diffstat (limited to 'script/public-inbox-edit')
-rwxr-xr-x | script/public-inbox-edit | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/script/public-inbox-edit b/script/public-inbox-edit index 0accd7c1..b437b3c0 100755 --- a/script/public-inbox-edit +++ b/script/public-inbox-edit @@ -22,12 +22,11 @@ my @opt = qw(mid|m=s file|F=s raw); GetOptions($opt, @PublicInbox::AdminEdit::OPT, @opt) or die "bad command-line args\n$usage\n"; +my $cfg = eval { PublicInbox::Config->new }; my $editor = $ENV{MAIL_EDITOR}; # e.g. "mutt -f" unless (defined $editor) { my $k = 'publicinbox.mailEditor'; - if (my $cfg = PublicInbox::Admin::config()) { - $editor = $cfg->{lc($k)}; - } + $editor = $cfg->{lc($k)} if $cfg; unless (defined $editor) { warn "\`$k' not configured, trying \`git var GIT_EDITOR'\n"; chomp($editor = `git var GIT_EDITOR`); @@ -41,7 +40,7 @@ if (defined $mid && defined $file) { die "the --mid and --file options are mutually exclusive\n"; } -my @ibxs = PublicInbox::Admin::resolve_inboxes(\@ARGV, $opt); +my @ibxs = PublicInbox::Admin::resolve_inboxes(\@ARGV, $opt, $cfg); PublicInbox::AdminEdit::check_editable(\@ibxs); my $found = {}; # cid => [ [ibx, smsg] [, [ibx, smsg] ] ] |