Skip to content

Commit

Permalink
add some debug
Browse files Browse the repository at this point in the history
Signed-off-by: Matthias Gatto <[email protected]>
  • Loading branch information
outscale-mgo committed Dec 24, 2024
1 parent 635c08d commit 3eb0276
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
1 change: 0 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
9 changes: 9 additions & 0 deletions cognac_gen.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ shopt -s expand_aliases

source ./helper.sh

debug "debug mode is on"

dash_this_arg()
{
local cur="$1"
Expand Down Expand Up @@ -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 "'")
Expand All @@ -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 "'")
Expand All @@ -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 "'")
Expand Down Expand Up @@ -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 \
Expand Down Expand Up @@ -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 \
Expand Down
1 change: 1 addition & 0 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 3eb0276

Please sign in to comment.