From 5ce3e6371fc11baf0a1559913c4df8a2e900d1d3 Mon Sep 17 00:00:00 2001 From: Kevin Day Date: Mon, 8 Jun 2020 22:41:59 -0500 Subject: [PATCH] Cleanup: Conditionally print color based on verbosity mode in certain messages in Fake. --- level_3/fake/c/fake.c | 3 +++ level_3/fake/c/fake.h | 5 +++++ level_3/fake/c/private-build.c | 16 ++++++++-------- level_3/fake/c/private-clean.c | 4 ++-- level_3/fake/c/private-skeleton.c | 2 +- 5 files changed, 19 insertions(+), 11 deletions(-) diff --git a/level_3/fake/c/fake.c b/level_3/fake/c/fake.c index 1134c78..d427765 100644 --- a/level_3/fake/c/fake.c +++ b/level_3/fake/c/fake.c @@ -127,6 +127,9 @@ extern "C" { } else if (choice == fake_parameter_verbose) { data->verbosity = fake_verbosity_verbose; + + data->color_section_set = data->context.important; + data->color_section_reset = data->context.reset; } else if (choice == fake_parameter_debug) { data->verbosity = fake_verbosity_debug; diff --git a/level_3/fake/c/fake.h b/level_3/fake/c/fake.h index 9bf9e32..873279f 100644 --- a/level_3/fake/c/fake.h +++ b/level_3/fake/c/fake.h @@ -370,6 +370,9 @@ extern "C" { uint8_t operation; uint8_t verbosity; + f_string_static color_section_set; + f_string_static color_section_reset; + f_string_dynamics define; f_string_dynamics mode; f_string_dynamic process; @@ -431,6 +434,8 @@ extern "C" { 0, \ 0, \ fake_verbosity_normal, \ + f_string_static_initialize, \ + f_string_static_initialize, \ f_string_dynamics_initialize, \ f_string_dynamics_initialize, \ f_string_dynamic_initialize, \ diff --git a/level_3/fake/c/private-build.c b/level_3/fake/c/private-build.c index a913506..a3ffd1e 100644 --- a/level_3/fake/c/private-build.c +++ b/level_3/fake/c/private-build.c @@ -199,7 +199,7 @@ extern "C" { if (data.verbosity != fake_verbosity_quiet) { printf("%c", f_string_eol[0]); - fl_color_print_line(f_type_output, data.context.important, data.context.reset, "Copying %s.", label); + fl_color_print_line(f_type_output, data.color_section_set, data.color_section_reset, "Copying %s.", label); } f_macro_string_dynamic_new(*status, path_source, source.used); @@ -386,7 +386,7 @@ extern "C" { if (data.verbosity != fake_verbosity_quiet) { printf("%c", f_string_eol[0]); - fl_color_print_line(f_type_output, data.context.important, data.context.reset, "Creating base build directories."); + fl_color_print_line(f_type_output, data.color_section_set, data.color_section_reset, "Creating base build directories."); } for (uint8_t i = 0; i < 15; i++) { @@ -667,7 +667,7 @@ extern "C" { if (data.verbosity != fake_verbosity_quiet) { printf("%c", f_string_eol[0]); - fl_color_print_line(f_type_output, data.context.important, data.context.reset, "Compiling shared library."); + fl_color_print_line(f_type_output, data.color_section_set, data.color_section_reset, "Compiling shared library."); } f_string_dynamics arguments = f_string_dynamics_initialize; @@ -931,7 +931,7 @@ extern "C" { if (data.verbosity != fake_verbosity_quiet) { printf("%c", f_string_eol[0]); - fl_color_print_line(f_type_output, data.context.important, data.context.reset, "Compiling static library."); + fl_color_print_line(f_type_output, data.color_section_set, data.color_section_reset, "Compiling static library."); } f_string_dynamic file_name = f_string_dynamic_initialize; @@ -2137,7 +2137,7 @@ extern "C" { if (data.verbosity != fake_verbosity_quiet) { printf("%c", f_string_eol[0]); - fl_color_print_line(f_type_output, data.context.important, data.context.reset, "Compiling static objects."); + fl_color_print_line(f_type_output, data.color_section_set, data.color_section_reset, "Compiling static objects."); } f_string_dynamic file_name = f_string_dynamic_initialize; @@ -2307,7 +2307,7 @@ extern "C" { f_return_status fake_build_operate(const fake_data data) { if (data.verbosity != fake_verbosity_quiet) { printf("%c", f_string_eol[0]); - fl_color_print_line(f_type_output, data.context.important, data.context.reset, "Building project."); + fl_color_print_line(f_type_output, data.color_section_set, data.color_section_reset, "Building project."); } f_status status = F_none; @@ -2420,7 +2420,7 @@ extern "C" { if (data.verbosity != fake_verbosity_quiet) { printf("%c", f_string_eol[0]); - fl_color_print_line(f_type_output, data.context.important, data.context.reset, "Compiling shared program."); + fl_color_print_line(f_type_output, data.color_section_set, data.color_section_reset, "Compiling shared program."); } f_string_dynamics arguments = f_string_dynamics_initialize; @@ -2512,7 +2512,7 @@ extern "C" { if (data.verbosity != fake_verbosity_quiet) { printf("%c", f_string_eol[0]); - fl_color_print_line(f_type_output, data.context.important, data.context.reset, "Compiling static program."); + fl_color_print_line(f_type_output, data.color_section_set, data.color_section_reset, "Compiling static program."); } f_string_dynamics arguments = f_string_dynamics_initialize; diff --git a/level_3/fake/c/private-clean.c b/level_3/fake/c/private-clean.c index de14814..a369658 100644 --- a/level_3/fake/c/private-clean.c +++ b/level_3/fake/c/private-clean.c @@ -13,9 +13,9 @@ extern "C" { if (data.verbosity != fake_verbosity_quiet) { printf("%c", f_string_eol[0]); - fl_color_print(f_type_output, data.context.important, data.context.reset, "Deleting all files within build directory '"); + fl_color_print(f_type_output, data.color_section_set, data.color_section_reset, "Deleting all files within build directory '"); fl_color_print(f_type_output, data.context.notable, data.context.reset, "%s", data.path_build.string); - fl_color_print_line(f_type_output, data.context.important, data.context.reset, "'."); + fl_color_print_line(f_type_output, data.color_section_set, data.color_section_reset, "'."); } if (data.verbosity == fake_verbosity_verbose) { diff --git a/level_3/fake/c/private-skeleton.c b/level_3/fake/c/private-skeleton.c index ad6cf1d..11ba07e 100644 --- a/level_3/fake/c/private-skeleton.c +++ b/level_3/fake/c/private-skeleton.c @@ -13,7 +13,7 @@ extern "C" { if (data.verbosity != fake_verbosity_quiet) { printf("%c", f_string_eol[0]); - fl_color_print_line(f_type_output, data.context.important, data.context.reset, "Generating skeleton structure."); + fl_color_print_line(f_type_output, data.color_section_set, data.color_section_reset, "Generating skeleton structure."); } { -- 1.8.3.1