File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -48,8 +48,10 @@ message and message store based on the actions returned.
4848COMMAND LINE
4949============
5050
51+ The output of the command line tool can be parsed as json.
52+
5153 $ sifter tests/evaluation_1.rules tests/evaluation_1.msg
52- [( 'redirect', 'acm@example.com') ]
54+ [[ 'redirect', 'acm@example.com'] ]
5355
5456
5557WARNINGS
Original file line number Diff line number Diff line change @@ -48,10 +48,12 @@ actions returned.
4848COMMAND LINE
4949------------
5050
51+ The output of the command line tool can be parsed as json.
52+
5153.. code-block :: bash
5254
5355 $ sifter tests/evaluation_1.rules tests/evaluation_1.msg
54- [( ' redirect' , ' acm@example.com' ) ]
56+ [[ ' redirect' , ' acm@example.com' ] ]
5557
5658
5759 WARNINGS
Original file line number Diff line number Diff line change 33import os
44import logging
55import sys
6+ import json
67
78import sifter .parser
89
@@ -24,4 +25,4 @@ def main() -> None:
2425 rules = sifter .parser .parse_file (open (args .rulefile ))
2526 msg = email .message_from_file (open (args .messagefile ))
2627 msg_actions = rules .evaluate (msg )
27- print (msg_actions )
28+ print (json . dumps ( msg_actions , indent = 4 ) )
You can’t perform that action at this time.
0 commit comments