about summary refs log tree commit homepage
path: root/lib/PublicInbox/LeiLsLabel.pm
diff options
context:
space:
mode:
Diffstat (limited to 'lib/PublicInbox/LeiLsLabel.pm')
-rw-r--r--lib/PublicInbox/LeiLsLabel.pm17
1 files changed, 17 insertions, 0 deletions
diff --git a/lib/PublicInbox/LeiLsLabel.pm b/lib/PublicInbox/LeiLsLabel.pm
new file mode 100644
index 00000000..474224d4
--- /dev/null
+++ b/lib/PublicInbox/LeiLsLabel.pm
@@ -0,0 +1,17 @@
+# Copyright (C) 2021 all contributors <meta@public-inbox.org>
+# License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
+
+# "lei ls-label" command
+package PublicInbox::LeiLsLabel;
+use strict;
+use v5.10.1;
+
+sub lei_ls_label { # the "lei ls-label" method
+        my ($lei, @argv) = @_;
+        # TODO: document stats/counts (expensive)
+        my @L = eval { $lei->_lei_store->search->all_terms('L') };
+        my $ORS = $lei->{opt}->{z} ? "\0" : "\n";
+        $lei->out(map { $_.$ORS } @L);
+}
+
+1;