mblaze, a Maildir-focused command line mail client
 help / color / Atom feed
From: "Duncan Overbruck" <mail@duncano.de>
To: Leah Neukirchen <leah@vuxu.org>
Cc: mblaze@googlegroups.com
Subject: Re: [ANN] mblaze 0.7, a Maildir-focused command line mail client
Date: Sat, 16 May 2020 14:59:56 +0200
Message-ID: <2MOZWQEK1UKMR.3BJG24O93LE6X@tux.localdomain> (raw)
In-Reply-To: <87a729gmqq.fsf@vuxu.org>


Here are some of the new features of mpick(1):

mpick can now also act as interpreter to for mpick script files
instead of only allowing to supply expression through arguments.

Another new feature is redirecting mail paths matching expressions
to files or processes, similar to redirects work in awk.

The following example script moves matching mails into another maildir
by piping their path into mrefile(1).

By using mrefiles -v flag and using `? skip : print` the output
of this mpick script will be either the updated path of matching mails
or the original path of mails that did not match the expressions.
This would also work with other tools like mflag(1).

    #!/usr/bin/mpick
	("list-id".addr ~~ "*.project1.com" |"mrefile -v ~/mail/project1" ||
	 "list-id".addr ~~ "*.project2.com" |"mrefile -v ~/mail/project2")
	? skip : print

Another new feature is assigning expressions to variables,
to make it a bit easier to maintain large filter scripts.

    #!/usr/bin/mpick
	let project1 = "list-id".addr == "project1.com" |"mrefile -v ~/mail/project1"
	let project2 = "list-id".addr == "project2.com" |"mrefile -v ~/mail/project2"
	  in (project1 || project2) ? skip : print

Another example (with a second expression for project1) would be:

    #!/usr/bin/mpick
	let project1 =
	  "list-id".addr == "project1.com" ||
	  "to".addr      == "me@project1.com"
	let project2 = "list-id".addr == "project2.com"
	let move =
	  project1 |"mrefile -v ~/mail/project1" ||
	  project2 |"mrefile -v ~/mail/project2"
	in 
	  move ? skip : print

The pipe (|"prog") can be replaced with >"newfile" or >>"append"
to write or append matching mails to files.

Cheers,
Duncan

-- 
You received this message because you are subscribed to the Google Groups "mblaze" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mblaze+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/mblaze/2MOZWQEK1UKMR.3BJG24O93LE6X%40tux.localdomain.

      reply index

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-15 16:57 Leah Neukirchen
2020-05-16 12:59 ` Duncan Overbruck [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2MOZWQEK1UKMR.3BJG24O93LE6X@tux.localdomain \
    --to=mail@duncano.de \
    --cc=leah@vuxu.org \
    --cc=mblaze@googlegroups.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

mblaze, a Maildir-focused command line mail client

Archives are clonable: git clone --mirror http://inbox.vuxu.org/mblaze

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://inbox.vuxu.org/vuxu.devel.mblaze


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