From 97df1796d1099a8bbe40de26c76d4888a24a065e Mon Sep 17 00:00:00 2001 From: David Hendriks <davidhendriks93@gmail.com> Date: Wed, 11 Dec 2019 16:37:56 +0000 Subject: [PATCH] cleaned up the function and added the header info --- binarycpython/utils/functions.py | 18 ++++++++++-------- include/binary_c_python.h | 11 +++++++++-- 2 files changed, 19 insertions(+), 10 deletions(-) diff --git a/binarycpython/utils/functions.py b/binarycpython/utils/functions.py index e94845dae..699e8a9cd 100644 --- a/binarycpython/utils/functions.py +++ b/binarycpython/utils/functions.py @@ -53,11 +53,16 @@ def get_help(param_name, return_dict): - available macros This function reads out that structure and catches the different components of this output - Presenting it in + + Will print a dict + + return_dict: wether to return the help info dictionary """ - if param_name in get_arg_keys(): + available_arg_keys = get_arg_keys() + + if param_name in available_arg_keys: help_info = binary_c_python_api.return_help(param_name) cleaned = [el for el in help_info.split('\n') if not el==''] @@ -104,12 +109,9 @@ def get_help(param_name, return_dict): if return_dict: return help_info_dict - - -get_help('RLOF_method', return_dict=True) - - - + else: + print("{} is not a valid parameter name. Please choose from the following parameters:\n\t{}".format(param_name, list(available_arg_keys))) + return None def run_system(**kwargs): """ diff --git a/include/binary_c_python.h b/include/binary_c_python.h index 29979236e..e2a48e16f 100644 --- a/include/binary_c_python.h +++ b/include/binary_c_python.h @@ -9,12 +9,12 @@ #include "binary_c_API_prototypes.h" /* Binary_c's python API prototypes */ -int run_binary (char * argstring, +int run_binary(char * argstring, char ** const outstring, char ** const errorstring, size_t * const nbytes); -int run_binary_with_logfile (char * argstring, +int run_binary_with_logfile(char * argstring, char ** const outstring, char ** const errorstring, size_t * const nbytes); @@ -29,6 +29,13 @@ int return_arglines(char ** const outstring, char ** const errorstring, size_t * const nbytes); +int return_help_info(char * argstring, + char ** const outstring, + char ** const errorstring, + size_t * const nbytes); + + + /* C macros */ #define BINARY_C_APITEST_VERSION 0.1 #define APIprint(...) APIprintf(__VA_ARGS__); -- GitLab