Add flag to save execution (dev)
This commit is contained in:
parent
85a9118d0f
commit
b874e9ef5a
|
@ -1,9 +1,10 @@
|
|||
import os.path
|
||||
import time
|
||||
|
||||
import click
|
||||
|
||||
from jeeves.cli.echo import info, error, title, success
|
||||
from jeeves.core.parsers import FlowParser
|
||||
from jeeves.core.parsers import FlowParser, ExecutionParser
|
||||
from jeeves.core.executor import Executor
|
||||
from jeeves.core.registry import ActionRegistry
|
||||
|
||||
|
@ -25,7 +26,8 @@ def main():
|
|||
help="Display output for flow",
|
||||
)
|
||||
@click.option("--argument", "-a", "defined_arguments", multiple=True, default=[])
|
||||
def execute(defintinion_file, print_output, defined_arguments=list):
|
||||
@click.option("--save-execution", is_flag=True, default=False, help="Store execution")
|
||||
def execute(defintinion_file, print_output, save_execution, defined_arguments=list):
|
||||
extension = os.path.splitext(defintinion_file.name)[1][1:]
|
||||
|
||||
if not hasattr(FlowParser, f"from_{extension}"):
|
||||
|
@ -61,3 +63,7 @@ def execute(defintinion_file, print_output, defined_arguments=list):
|
|||
|
||||
if print_output:
|
||||
click.echo(result.output)
|
||||
|
||||
if save_execution:
|
||||
with open(f"execution.{time.time_ns()}.json", "w") as handler:
|
||||
handler.write(ExecutionParser.to_json(executor._execution))
|
||||
|
|
Reference in New Issue