diff --git a/binarycpython/utils/functions.py b/binarycpython/utils/functions.py index 91700951b2d84d76247f1d56b51702d7a913a709..cb3f41249be10561474abee2d13dedfb736f538c 100644 --- a/binarycpython/utils/functions.py +++ b/binarycpython/utils/functions.py @@ -8,50 +8,56 @@ from binarycpython.utils.custom_logging_functions import ( ) -def get_help_super(print_help=False, return_dict=True): +def get_help_super(print_help=False, return_dict=True, fail_silently=True): """ Function that first runs get_help_all, and then per argument also run the help function to get as much information as possible. """ + # Get help_all information help_all_dict = get_help_all(print_help=False, return_dict=True) - # print(help_all_dict) - - # print(json.dumps(help_all_dict, indent=4)) - help_all_super_dict = help_all_dict.copy() + # Loop over all sections and stuff for section_name in help_all_dict.keys(): section = help_all_dict[section_name] - # print(section) for parameter_name in section["parameters"].keys(): parameter = section["parameters"][parameter_name] + # Get detailed help info detailed_help = get_help( - parameter_name, print_help=False, return_dict=True, fail_silently=True + parameter_name, print_help=False, return_dict=True, fail_silently=fail_silently ) - parameter["detailed_help"] = detailed_help + if detailed_help: + # check whether the descriptions of help_all and detailed help are the same + if not fail_silently: + if ( + not parameter["description"] + == detailed_help["description"] + ): + print(json.dumps(parameter, indent=4)) + + ## put values into help all super dict + # input type + parameter["parameter_value_input_type"] = detailed_help["parameter_value_input_type"] - if parameter["detailed_help"]: - if ( - not parameter["description"] - == parameter["detailed_help"]["description"] - ): - print(json.dumps(parameter, indent=4)) + # default + parameter["default"] = detailed_help["default"] - # print(parameter['description']==parameter['detailed_help']['description']) + # macros + if 'macros' in detailed_help.keys(): + parameter["macros"] = detailed_help["macros"] - # print(parameter.keys()) if print_help: + # TODO: make a pretty print print(json.dumps(help_all_super_dict, indent=4)) - pass if return_dict: - return + return help_all_super_dict def get_help_all(print_help=True, return_dict=False): @@ -496,7 +502,4 @@ def load_logfile(logfile): rel_r2_list.append(split_line[8]) event_list.append(" ".join(split_line[9:])) - print(event_list) - - -# load_logfile() + print(event_list) \ No newline at end of file