@@ -368,7 +368,7 @@ def list_workflows(ctx, domain: str, status: str, started_since: int):
368368@click .argument ("workflow_id" )
369369@click .argument ("run_id" , required = False )
370370@click .option (
371- "--format " , required = False , type = click .Choice (["rawest" , "raw" , "cooked" ]), default = "raw" , help = "Output format."
371+ "--mode " , required = False , type = click .Choice (["rawest" , "raw" , "cooked" ]), default = "raw" , help = "Output format."
372372)
373373@click .option ("--reverse-order" , required = False , type = bool , default = False , help = "Reverse order." )
374374@click .pass_context
@@ -377,27 +377,27 @@ def workflow_history(
377377 domain : str ,
378378 workflow_id : str ,
379379 run_id : str | None ,
380- format : str ,
380+ mode : str ,
381381 reverse_order : bool = False ,
382382) -> None :
383383 from simpleflow .swf .mapper .models .history .base import History as BaseHistory
384384
385- if ctx .format != "json" or not ctx .header :
385+ if ctx .parent . params [ " format" ] != "json" or not ctx .parent . params [ " header" ] :
386386 raise NotImplementedError ("Only pretty JSON mode is implemented" )
387387
388388 ex = helpers .get_workflow_execution (domain , workflow_id , run_id )
389389 events = ex .history_events (
390390 callback = get_progression_callback ("events" ),
391391 reverse_order = reverse_order ,
392392 )
393- if format == "rawest" :
393+ if mode == "rawest" :
394394 pass
395395 else :
396396 raw_history = BaseHistory .from_event_list (events )
397397 history = History (raw_history )
398- if format == "raw" :
398+ if mode == "raw" :
399399 events = []
400- for event in history .events [: 10 ] :
400+ for event in history .events :
401401 e = {}
402402 for k in ["id" , "type" , "state" , "timestamp" , "input" , "control" , * event .__dict__ ]:
403403 if k .startswith ("_" ) or k == "raw" :
@@ -407,7 +407,7 @@ def workflow_history(
407407 continue
408408 e [k ] = v
409409 events .append (e )
410- elif format == "cooked" :
410+ elif mode == "cooked" :
411411 history .parse ()
412412 events = {
413413 "activities" : history .activities ,
0 commit comments