Skip to content

Commit

Permalink
Merge pull request #291 from DUNE-DAQ/PawelPlesniak/ColorInExecutionR…
Browse files Browse the repository at this point in the history
…eports

Including colors in the execution summary
  • Loading branch information
plasorak authored Oct 28, 2024
2 parents 435be32 + cb3eb52 commit 1d339e4
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/drunc/controller/interface/shell_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ def validate_and_format_fsm_arguments(arguments:dict, command_arguments:list[Arg
return out_dict


def format_bool(b, format=['dark_green', 'bold white on red'], false_is_good = False):
def format_bool(b, format=['dark_green', 'red'], false_is_good = False):
index_true = 0 if not false_is_good else 1
index_false = 1 if not false_is_good else 0

Expand Down Expand Up @@ -299,13 +299,13 @@ def bool_to_success(flag_message, FSM):
flag = True
if not FSM and flag_message == ResponseFlag.EXECUTED_SUCCESSFULLY:
flag = True
return "success" if flag else "failed"
return "[dark_green]success[/]" if flag else "[red]failed[/]"

def add_to_table(table, response, prefix=''):
table.add_row(
prefix+response.name,
bool_to_success(response.flag, FSM=False),
bool_to_success(response.data.flag, FSM=True) if response.flag == FSMResponseFlag.FSM_EXECUTED_SUCCESSFULLY else "failed",
bool_to_success(response.data.flag, FSM=True) if response.flag == FSMResponseFlag.FSM_EXECUTED_SUCCESSFULLY else "[red]failed[/]",
)
for child_response in response.children:
add_to_table(table, child_response, " "+prefix)
Expand Down

0 comments on commit 1d339e4

Please sign in to comment.