Skip to content

Commit 16bab45

Browse files
cli returns a json compatible string
1 parent 90d9837 commit 16bab45

File tree

3 files changed

+8
-3
lines changed

3 files changed

+8
-3
lines changed

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,10 @@ message and message store based on the actions returned.
4848
COMMAND 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', '[email protected]')]
54+
[['redirect', '[email protected]']]
5355

5456

5557
WARNINGS

docs/index.rst

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,12 @@ actions returned.
4848
COMMAND 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', '[email protected]')]
56+
[['redirect', '[email protected]']]
5557
5658
5759
WARNINGS

sifter/cli.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import os
44
import logging
55
import sys
6+
import json
67

78
import 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))

0 commit comments

Comments
 (0)