Filter chain

From Mailutils
Revision as of 12:06, 9 November 2016 by Gray (talk | contribs) (Created page with "A chain of filters applies each filter in turn. Its syntax is: <source lang="bnf"> <filter-chain> ::= <filter> | <filter-chain> "+" <filter> <filter> ::= <filter-spec> <ARG>*...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

A chain of filters applies each filter in turn. Its syntax is:

 <filter-chain> ::= <filter> | <filter-chain> "+" <filter>
 <filter> ::= <filter-spec> <ARG>* 
 <filter-spec> ::= <WORD> | "~" <WORD>

The <filter-spec> is the name of any existing mailutils filter. The plus character plays the same role as pipe in shell, i.e. redirects output from the filter on its left side to the input of the one on its right side. This character was selected to facilitate the use of filter chains in the command line[1]. The ~ character in front of filter name reverses the default mode. That means that if the default mode is encode the following chain:

 ~crlf + base64

will first convert every occurrence of CR LF characters to a single LF (decode mode of the crlf filter) and then encode the resulting data into BASE64.

Notes

  1. A dubious choice. Traditional pipe character would be more in place here. The same goes for tilde instead of the ! sign. Perhaps this will change in future, but even so I'll have to preserve the backward compatibility.