1
0
mirror of https://github.com/kellyjonbrazil/jc.git synced 2025-06-17 00:07:37 +02:00

only show magic command fields if magic as used

This commit is contained in:
Kelly Brazil
2022-08-21 13:52:39 -07:00
parent 4f21c7b7b4
commit 13bba1f4b8

View File

@ -458,16 +458,15 @@ def add_metadata_to(list_or_dict,
""" """
run_timestamp = runtime.timestamp() run_timestamp = runtime.timestamp()
if not run_command:
magic_exit_code = None
meta_obj = { meta_obj = {
'parser': parser_name, 'parser': parser_name,
'magic_command': run_command,
'magic_command_exit': magic_exit_code,
'timestamp': run_timestamp 'timestamp': run_timestamp
} }
if run_command:
meta_obj['magic_command'] = run_command
meta_obj['magic_command_exit'] = magic_exit_code
if isinstance(list_or_dict, dict): if isinstance(list_or_dict, dict):
if '_jc_meta' not in list_or_dict: if '_jc_meta' not in list_or_dict:
list_or_dict['_jc_meta'] = {} list_or_dict['_jc_meta'] = {}