From 3eb02765bc66d6b140c63efa2c11cd10940e7547 Mon Sep 17 00:00:00 2001 From: Matthias Gatto Date: Thu, 14 Nov 2024 18:10:19 +0100 Subject: [PATCH] add some debug Signed-off-by: Matthias Gatto --- Makefile | 1 - cognac_gen.sh | 9 +++++++++ configure | 1 + 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 71c1c6e..d7f5405 100644 --- a/Makefile +++ b/Makefile @@ -55,7 +55,6 @@ config.sh: echo -e "debug()\n{" >> config.sh echo -e '\tif [[ "$$DEBUG_MODE" == "1" ]] ; then echo "$$@" >&2 ; fi\n}' >> config.sh echo export DEBUG_MODE=$(DEBUG_MODE) >> config.sh - echo 'debug "debug mode is on"' >> config.sh call_list: osc-api.json bin/funclist bin/funclist osc-api.json $(FUNCLIST_ARG) > call_list diff --git a/cognac_gen.sh b/cognac_gen.sh index b9f117c..71ea7e6 100755 --- a/cognac_gen.sh +++ b/cognac_gen.sh @@ -11,6 +11,8 @@ shopt -s expand_aliases source ./helper.sh +debug "debug mode is on" + dash_this_arg() { local cur="$1" @@ -210,8 +212,10 @@ replace_args() arg_check=$(bin/line_check ____args____ ____func_code____ ____functions_proto____ ____cli_parser____ ____complex_struct_func_parser____ ____complex_struct_to_string_func____ ____call_list_dec____ ____call_list_descriptions____ ____call_list_args_descriptions____ <<< "$line") if [ "$arg_check" == "____args____" ]; then + debug "____args____" ./mk_args.${lang}.sh elif [ "$arg_check" == "____call_list_descriptions____" ]; then + debug "____call_list_descriptions____" DELIMES=$(cut -d '(' -f 2 <<< $line | tr -d ')') D1=$(cut -d ';' -f 1 <<< $DELIMES | tr -d "'") D2=$(cut -d ';' -f 2 <<< $DELIMES | tr -d "'") @@ -228,6 +232,7 @@ replace_args() done echo -ne $D3 elif [ "$arg_check" == "____call_list_args_descriptions____" ]; then + debug "____call_list_args_descriptions____" DELIMES=$(cut -d '(' -f 2 <<< $line | tr -d ')') D1=$(cut -d ';' -f 1 <<< $DELIMES | tr -d "'") D2=$(cut -d ';' -f 2 <<< $DELIMES | tr -d "'") @@ -247,6 +252,7 @@ replace_args() done echo -ne $D3 elif [ "$arg_check" == "____call_list_dec____" ]; then + debug "____call_list_dec____" DELIMES=$(cut -d '(' -f 2 <<< $line | tr -d ')') D1=$(cut -d ';' -f 1 <<< $DELIMES | tr -d "'") D2=$(cut -d ';' -f 2 <<< $DELIMES | tr -d "'") @@ -349,6 +355,7 @@ EOF done elif [ "$arg_check" == "____cli_parser____" ] ; then + debug "____cli_parser____" for l in $CALL_LIST; do snake_l=$(to_snakecase <<< $l) arg_list=$(json-search ${l}Request < osc-api.json \ @@ -457,11 +464,13 @@ EOF EOF done elif [ "$arg_check" == "____functions_proto____" ] ; then + debug "____functions_proto____" for l in $CALL_LIST; do local snake_l=$(to_snakecase <<< $l) echo "int osc_${snake_l}(struct osc_env *e, struct osc_str *out, struct osc_${snake_l}_arg *args);" done elif [ "$arg_check" == "____func_code____" ]; then + debug "____func_code____" for x in $CALL_LIST; do local snake_x=$(to_snakecase <<< $x) local args=$(json-search ${x}Request < osc-api.json \ diff --git a/configure b/configure index 5478a23..3ebaf27 100755 --- a/configure +++ b/configure @@ -17,6 +17,7 @@ API_VERSION=master SDK_VERSION=0xC061AC CLI_NAME=oapi-cli API_SCRIPT='curl -s https://raw.githubusercontent.com/outscale/osc-api/$(API_VERSION)/outscale.yaml | yq $(YQ_ARG) > osc-api.json' +DEBUG_MODE=0 inc=1 for arg in $@; do