user/dev discussion of public-inbox itself
 help / color / mirror / code / Atom feed
Search results ordered by [date|relevance]  view[summary|nested|Atom feed]
thread overview below | download mbox.gz: |
* [PATCH 3/5] lei q: put keywords on one line in --pretty output
  2021-03-20 10:04  5% [PATCH 0/5] lei: preserve keywords across queries Eric Wong
@ 2021-03-20 10:04  7% ` Eric Wong
  0 siblings, 0 replies; 2+ results
From: Eric Wong @ 2021-03-20 10:04 UTC (permalink / raw)
  To: meta

Don't waste precious terminal space when there are only a small
number of possible keywords supported/reserved for JMAP.  In the
future, we may implement more sophisticated wrapping for labels,
but it we'll cross tha bridge when we come to it.
---
 lib/PublicInbox/LeiOverview.pm | 5 ++++-
 t/lei-q-kw.t                   | 7 +++++--
 2 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/lib/PublicInbox/LeiOverview.pm b/lib/PublicInbox/LeiOverview.pm
index 48237f8a..521bca50 100644
--- a/lib/PublicInbox/LeiOverview.pm
+++ b/lib/PublicInbox/LeiOverview.pm
@@ -176,7 +176,10 @@ sub _json_pretty {
 					$pair =~ s/(null|"),"/$1, "/g;
 					$pair;
 				} @$v) . ']';
-			} else { # references
+			} elsif ($k eq 'kw') { # keywords are short, one-line
+				$v = $json->encode($v);
+				$v =~ s/","/", "/g;
+			} else { # refs, labels, ...
 				$v = '[' . join($sep, map {
 					substr($json->encode([$_]), 1, -1);
 				} @$v) . ']';
diff --git a/t/lei-q-kw.t b/t/lei-q-kw.t
index e7e14221..de2c775a 100644
--- a/t/lei-q-kw.t
+++ b/t/lei-q-kw.t
@@ -144,7 +144,7 @@ lei_ok(qw(q -o), "mboxrd:$o", "m:$m", @inc);
 # emulate MUA marking mboxrd message as unread
 open my $fh, '<', $o or BAIL_OUT;
 my $s = do { local $/; <$fh> };
-$s =~ s/^Status: OR\n/Status: O\nX-Status: A\n/sm or
+$s =~ s/^Status: OR\n/Status: O\nX-Status: AF\n/sm or
 	fail "failed to clear R flag in $s";
 open $fh, '>', $o or BAIL_OUT;
 print $fh $s or BAIL_OUT;
@@ -156,7 +156,10 @@ lei_ok(qw(q -o), "mboxrd:$o", "m:$m", @inc);
 open $fh, '<', $o or BAIL_OUT;
 $s = do { local $/; <$fh> };
 like($s, qr/^Status: O\n/ms, 'seen keyword gone in mbox');
-like($s, qr/^X-Status: A\n/ms, 'answered flag set');
+like($s, qr/^X-Status: AF\n/ms, 'answered + flagged set');
 
+lei_ok(qw(q --pretty), "m:$m", @inc);
+like($lei_out, qr/^  "kw": \["answered", "flagged"\],\n/sm,
+	'--pretty JSON output shows kw: on one line');
 }); # test_lei
 done_testing;

^ permalink raw reply related	[relevance 7%]

* [PATCH 0/5] lei: preserve keywords across queries
@ 2021-03-20 10:04  5% Eric Wong
  2021-03-20 10:04  7% ` [PATCH 3/5] lei q: put keywords on one line in --pretty output Eric Wong
  0 siblings, 1 reply; 2+ results
From: Eric Wong @ 2021-03-20 10:04 UTC (permalink / raw)
  To: meta

2/5 is the major milestone to me, it took me a long while to
figure out and arrive at.

PATCH 1/5 made things click, and
<https://public-inbox.org/meta/20210320023800.1809-1-e@80x24.org/>
("lei_store: initialize IPC lock properly") was also needed :x

There'll still need to be some followup to support import,
and also to deal with public-inbox-edit/purge in externals.

Inotify + EVFILT_VNODE support should make things sweeter, too.

Eric Wong (5):
  lei: All Local Externals: bare git dir for alternates
  lei q: support vmd for external-only messages
  lei q: put keywords on one line in --pretty output
  lei_to_mail: match mutt order of status headers
  lei: tie ALE lifetime to config file

 MANIFEST                       |   1 +
 lib/PublicInbox/LEI.pm         |  15 +++++
 lib/PublicInbox/LeiALE.pm      | 111 +++++++++++++++++++++++++++++++++
 lib/PublicInbox/LeiOverview.pm |  12 +++-
 lib/PublicInbox/LeiQuery.pm    |   1 +
 lib/PublicInbox/LeiSearch.pm   |  37 +++++++----
 lib/PublicInbox/LeiStore.pm    |  82 ++++++++++++++----------
 lib/PublicInbox/LeiToMail.pm   |  38 ++++++-----
 lib/PublicInbox/LeiXSearch.pm  |  44 +++----------
 lib/PublicInbox/Lock.pm        |   2 +-
 lib/PublicInbox/Over.pm        |  22 ++++++-
 lib/PublicInbox/OverIdx.pm     |  10 ---
 lib/PublicInbox/SearchIdx.pm   |   3 +
 t/eml.t                        |   2 +
 t/lei-convert.t                |   3 +-
 t/lei-externals.t              |   3 +-
 t/lei-q-kw.t                   |  59 ++++++++++++++++--
 t/lei-q-remote-import.t        |   4 +-
 t/lei-q-thread.t               |   7 ++-
 t/lei_to_mail.t                |   2 +-
 t/lei_xsearch.t                |  22 ++++++-
 21 files changed, 355 insertions(+), 125 deletions(-)
 create mode 100644 lib/PublicInbox/LeiALE.pm


^ permalink raw reply	[relevance 5%]

Results 1-2 of 2 | reverse | options above
-- pct% links below jump to the message on this page, permalinks otherwise --
2021-03-20 10:04  5% [PATCH 0/5] lei: preserve keywords across queries Eric Wong
2021-03-20 10:04  7% ` [PATCH 3/5] lei q: put keywords on one line in --pretty output Eric Wong

Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).