user/dev discussion of public-inbox itself
 help / color / mirror / Atom feed
* [PATCH] admin: preserve config ordering of `--all' switch
@ 2020-10-13  1:34 Eric Wong
  2020-10-13  7:19 ` Eric Wong
  0 siblings, 1 reply; 2+ messages in thread
From: Eric Wong @ 2020-10-13  1:34 UTC (permalink / raw)
  To: meta

When `--all' is passed to -index and similar commands, process
them in the same order as what is given in the config file.
---
 lib/PublicInbox/Admin.pm | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/lib/PublicInbox/Admin.pm b/lib/PublicInbox/Admin.pm
index fb88e621..9d48e5eb 100644
--- a/lib/PublicInbox/Admin.pm
+++ b/lib/PublicInbox/Admin.pm
@@ -97,12 +97,14 @@ sub resolve_inboxes ($;$$) {
 	my $min_ver = $opt->{-min_inbox_version} || 0;
 	my (@old, @ibxs);
 	my %dir2ibx;
+	my $all = $opt->{all} ? [] : undef;
 	if ($cfg) {
 		$cfg->each_inbox(sub {
 			my ($ibx) = @_;
 			my $path = abs_path($ibx->{inboxdir});
 			if (defined($path)) {
 				$dir2ibx{$path} = $ibx;
+				push @$all, $ibx if $all;
 			} else {
 				warn <<EOF;
 W: $ibx->{name} $ibx->{inboxdir}: $!
@@ -110,10 +112,9 @@ EOF
 			}
 		});
 	}
-	if ($opt->{all}) {
-		my @all = values %dir2ibx;
-		@all = grep { $_->version >= $min_ver } @all;
-		push @ibxs, @all;
+	if ($all) {
+		@$all = grep { $_->version >= $min_ver } @$all;
+		@ibxs = @$all;
 	} else { # directories specified on the command-line
 		my $i = 0;
 		my @dirs = @$argv;

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-10-13  7:19 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-13  1:34 [PATCH] admin: preserve config ordering of `--all' switch Eric Wong
2020-10-13  7:19 ` Eric Wong

user/dev discussion of public-inbox itself

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://public-inbox.org/meta
	git clone --mirror http://czquwvybam4bgbro.onion/meta
	git clone --mirror http://hjrcffqmbrq6wope.onion/meta
	git clone --mirror http://ou63pmih66umazou.onion/meta

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V1 meta meta/ https://public-inbox.org/meta \
		meta@public-inbox.org
	public-inbox-index meta

Example config snippet for mirrors.
Newsgroups are available over NNTP:
	nntp://news.public-inbox.org/inbox.comp.mail.public-inbox.meta
	nntp://ou63pmih66umazou.onion/inbox.comp.mail.public-inbox.meta
	nntp://czquwvybam4bgbro.onion/inbox.comp.mail.public-inbox.meta
	nntp://hjrcffqmbrq6wope.onion/inbox.comp.mail.public-inbox.meta
	nntp://news.gmane.io/gmane.mail.public-inbox.general
 note: .onion URLs require Tor: https://www.torproject.org/

code repositories for the project(s) associated with this inbox:

	https://80x24.org/public-inbox.git

AGPL code for this site: git clone https://public-inbox.org/public-inbox.git