Merge pull request #219 from bkryza/fix-progress-indicators-msvc
Fixed progress indicator characters on Windows (#218)
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
compilation_database_dir: debug
|
||||
output_directory: docs/diagrams
|
||||
comment_parser: clang
|
||||
add_compile_flags:
|
||||
- -Wno-deprecated-declarations
|
||||
remove_compile_flags:
|
||||
- -Wno-class-memaccess
|
||||
- -Wno-dangling-reference
|
||||
|
||||
@@ -30,7 +30,9 @@ target_compile_options(clang-umllib PRIVATE
|
||||
$<$<CXX_COMPILER_ID:MSVC>:/MP /W1 /bigobj /wd4291 /wd4624 /wd4244>)
|
||||
target_compile_definitions(clang-umllib PRIVATE
|
||||
$<$<CXX_COMPILER_ID:MSVC>:
|
||||
-DLLVM_FORCE_USE_OLD_TOOLCHAIN>)
|
||||
-DLLVM_FORCE_USE_OLD_TOOLCHAIN
|
||||
-DTERMCOLOR_USE_WINDOWS_API=1
|
||||
-DTERMCOLOR_TARGET_WINDOWS=1>)
|
||||
|
||||
#
|
||||
# Define the target executable clang-uml
|
||||
|
||||
@@ -39,7 +39,11 @@ void progress_indicator::add_progress_bar(
|
||||
indicators::option::BarWidth{kBarWidth},
|
||||
indicators::option::ForegroundColor{color},
|
||||
indicators::option::ShowElapsedTime{true},
|
||||
#if _MSC_VER
|
||||
indicators::option::Fill{"="}, indicators::option::Lead{">"},
|
||||
#else
|
||||
indicators::option::Fill{"█"}, indicators::option::Lead{"█"},
|
||||
#endif
|
||||
indicators::option::Remainder{"-"},
|
||||
indicators::option::PrefixText{
|
||||
fmt::format("{:<25}", util::abbreviate(name, kPrefixTextWidth))},
|
||||
@@ -104,8 +108,12 @@ void progress_indicator::complete(const std::string &name)
|
||||
|
||||
bar.set_progress(kCompleteProgressPercent);
|
||||
|
||||
bar.set_option(indicators::option::PostfixText{
|
||||
fmt::format("{}/{} ✔", p.progress, p.max)});
|
||||
#if _MSC_VER
|
||||
const auto postfix_text = fmt::format("{}/{} OK", p.progress, p.max);
|
||||
#else
|
||||
const auto postfix_text = fmt::format("{}/{} ✔", p.progress, p.max);
|
||||
#endif
|
||||
bar.set_option(indicators::option::PostfixText{postfix_text});
|
||||
bar.set_option(
|
||||
indicators::option::ForegroundColor{indicators::Color::green});
|
||||
bar.mark_as_completed();
|
||||
@@ -118,9 +126,13 @@ void progress_indicator::fail(const std::string &name)
|
||||
auto &bar = progress_bars_[p.index];
|
||||
progress_bars_mutex_.unlock();
|
||||
|
||||
#if _MSC_VER
|
||||
const auto postfix_text = fmt::format("{}/{} FAILED", p.progress, p.max);
|
||||
#else
|
||||
const auto postfix_text = fmt::format("{}/{} ✗", p.progress, p.max);
|
||||
#endif
|
||||
bar.set_option(indicators::option::ForegroundColor{indicators::Color::red});
|
||||
bar.set_option(indicators::option::PostfixText{
|
||||
fmt::format("{}/{} ✗", p.progress, p.max)});
|
||||
bar.set_option(indicators::option::PostfixText{postfix_text});
|
||||
bar.mark_as_completed();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user