diff --git a/utils.sh b/utils.sh index dd62a9b3c71d8dfadff96834d5a013872ddefb7b..c07404bf6bb0e33b2ad2f76114476dad3614cded 100755 --- a/utils.sh +++ b/utils.sh @@ -493,6 +493,92 @@ function display_text_colors () { echo "" } + +### + # Prints out all current flags, args, and kwargs, as determined by handle_args_kwargs() function. + # If function has been called multiple times, then will also print out global values. + ## +function display_args_kwargs () { + echo "" + echo -e "${text_blue}Displaying processed flags, args, and kwargs.${text_reset}" + echo "" + + # Display for flags. + if [[ ${#flags[@]} > 0: ]] + then + echo -e " ${text_purple}Flags${text_reset} (${#flags[@]} Total):" + echo " ${flags[@]}" + else + echo " No Flags Set." + fi + + # Display for args. + if [[ ${#args[@]} > 0 ]] + then + echo -e " ${text_purple}Args${text_reset} (${#args[@]} Total):" + for index in ${!args[@]} + do + echo " ${index}: ${args[${index}]}" + done + else + echo " No Args Set." + fi + + # Display for kwargs. + if [[ ${#kwargs[@]} > 0 ]] + then + echo -e " ${text_purple}Kwargs${text_reset} (${#kwargs[@]} Total):" + for key in ${!kwargs[@]} + do + echo " ${key}: ${kwargs[${key}]}" + done + else + echo " No Kwargs Set." + fi + + # Only display if global values are different. + if [[ ${flags[@]} != ${global_flags[@]} || ${args[@]} != ${global_args[@]} || ${kwargs[@]} != ${global_kwargs[@]} ]] + then + echo "" + echo "" + + # Display for global flags. + if [[ ${#global_flags[@]} > 0: ]] + then + echo -e " ${text_purple}Global Flags${text_reset} (${#global_flags[@]} Total):" + echo " ${global_flags[@]}" + else + echo " No Global Flags Set." + fi + + # Display for global args. + if [[ ${#global_args[@]} > 0 ]] + then + echo -e " ${text_purple}Global Args${text_reset} (${#global_args[@]} Total):" + for index in ${!global_args[@]} + do + echo " ${index}: ${global_args[${index}]}" + done + else + echo " No Global Args Set." + fi + + # Display for global kwargs. + if [[ ${#global_kwargs[@]} > 0 ]] + then + echo -e " ${text_purple}Global Kwargs${text_reset} (${#global_kwargs[@]} Total):" + for key in ${!global_kwargs[@]} + do + echo " ${key}: ${global_kwargs[${key}]}" + done + else + echo " No Global Kwargs Set." + fi + fi + + echo "" +} + #endregion Other Functions