mblaze, a Maildir-focused command line mail client
 help / color / mirror / code / 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	[thread overview]
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	other threads:[~2020-05-16 13:00 UTC|newest]

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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mblaze/

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 NNTP newsgroup(s).