about summary refs log tree commit homepage
path: root/lib/PublicInbox/LeiMark.pm
DateCommit message (Collapse)
2021-03-30lei tag: rename from "lei mark"
I've decided "tag" is a better verb since it seems more widely-used term for associating metadata with data. Not only is it analogous to the "notmuch tag" command, but also makes sense when compared to tooling for manipulating metadata for non-mail data (e.g. audio metadata tags). There's even a Wikipedia entry for it: https://en.wikipedia.org/wiki/Tag_(metadata) whereas "mark" is used in the description, but has no entry of its own with regards to metadata.
2021-03-29lei_input: avoid special case sub for --stdin
We can consistently open /dev/stdin correctly nowadays, so drop the input_stdin and just use the normal ->path_to_fd code path.
2021-03-28lei: simplify PktOp callers
Provide a consistent ->op_wait_event method instead of forcing callers to loop (or not) at each callsite. This also avoid a leak possibility by avoiding circular references.
2021-03-28lei mark: relax label requirements
It seems safe to use ALLCAPS labels like "INBOX" with Xapian. We'll also allow single-character labels.
2021-03-26lei mark: disallow '!' in labels
'!' could wreak havoc if exposed to a shell like bash. It seems like a rare character for use in file/directory/mailbox names.
2021-03-26lei: add some labels support
"lei q" now displays labels in JSON output, "lei mark" can add or remove labels for any messages. "lei ls-label" is supported, too. Unfortunately, "lei q" won't hande "kw:" or "L:" for external messages, they must be imported, first.
2021-03-24lei: improve management around short-lived workers
Instead of creating a short-lived circular reference, ensure they don't exist in the first place. Note the following changes to hold an extra ref to $sto: - $self->_lei_store(1)->write_prepare($self); + my $sto = $self->_lei_store(1); + $sto->write_prepare($self); I'm not a perlguts expert, but I actually wanted to switch to the one-line version for LeiImport, but xt/lei-auth-fail.t was getting stuck for some reason. It seems the extra ref to the LeiStore ($sto) object is necessary.
2021-03-24lei_input: more common code between <mark|convert|import>
"lei convert" is actually a bit of the odd one, since it uses lei2mail for auth, unlike the others.
2021-03-24lei mark: add support for (bash) completion
Only lightly tested, this seems to suffer from the same problem as external completions for network URLs with colons in them. In any case, its usable enough for me. The core LEI module now supports completions for lazy-loaded commands, too, so we'll be able to do completions for other commands more easily.
2021-03-24lei mark: command for (un)setting keywords and labels
Only tested for keywords and labels with file inputs, so far; but it seems to do what it needs to do. There's a bit more redundant code than I'd like, and more opportunities for code sharing in the future "lei import" will be expanded to support +kw:$KEYWORD and +L:$LABEL in the future.