blob: f246404efbc54c78a8f926c6c8faf03c98e6a97d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
# This is an example on how to create your own custom formatter
from __future__ import annotations
import robusta_krr
from robusta_krr.api import formatters
from robusta_krr.api.models import Result
# This is a custom formatter
# It will be available to the CLI as `my_formatter`
# Rich console will be enabled in this case, so the output will be colored and formatted
@formatters.register(rich_console=True)
def my_formatter(result: Result) -> str:
# Return custom formatter
return "Custom formatter"
# Running this file will register the formatter and make it available to the CLI
# Run it as `python ./custom_formatter.py simple --formater my_formatter`
if __name__ == "__main__":
robusta_krr.run()
|