From 228349fab9f569d1d1e462874c8a32e8e60afe8e Mon Sep 17 00:00:00 2001 From: Wolf Vollprecht Date: Thu, 3 Feb 2022 15:40:44 +0100 Subject: [PATCH] nicely format explictly requested specs in micromamba list --- libmamba/include/mamba/core/output.hpp | 3 ++- libmamba/src/api/list.cpp | 11 +++++++++-- libmamba/src/core/output.cpp | 3 +++ 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/libmamba/include/mamba/core/output.hpp b/libmamba/include/mamba/core/output.hpp index 76db7ad5bf..5dde82e182 100644 --- a/libmamba/include/mamba/core/output.hpp +++ b/libmamba/include/mamba/core/output.hpp @@ -57,7 +57,8 @@ namespace mamba none = 0, red = 1 << 1, green = 1 << 2, - yellow = 1 << 3 + yellow = 1 << 3, + bold_blue = 1 << 4 }; struct FormattedString diff --git a/libmamba/src/api/list.cpp b/libmamba/src/api/list.cpp index 6a5915b3f0..2a9281085e 100644 --- a/libmamba/src/api/list.cpp +++ b/libmamba/src/api/list.cpp @@ -85,11 +85,12 @@ namespace mamba return; } - std::cout << "List of packages in environment: " << ctx.target_prefix << std::endl; + std::cout << "List of packages in environment: " << ctx.target_prefix << "\n\n"; formatted_pkg formatted_pkgs; std::vector packages; + auto requested_specs = prefix_data.history().get_requested_specs_map(); // order list of packages from prefix_data by alphabetical order for (const auto& package : prefix_data.m_package_records) @@ -124,7 +125,13 @@ namespace mamba for (auto p : packages) { - t.add_row({ p.name, p.version, p.build, p.channel }); + printers::FormattedString formatted_name(p.name); + if (requested_specs.find(p.name) != requested_specs.end()) + { + formatted_name = printers::FormattedString(p.name); + formatted_name.flag = printers::format::bold_blue; + } + t.add_row({ formatted_name, p.version, p.build, p.channel }); } t.print(std::cout); diff --git a/libmamba/src/core/output.cpp b/libmamba/src/core/output.cpp index fce57c1e8b..2c17e03de7 100644 --- a/libmamba/src/core/output.cpp +++ b/libmamba/src/core/output.cpp @@ -126,6 +126,9 @@ namespace mamba if (static_cast(row[j].flag) & static_cast(format::yellow)) out << termcolor::yellow; + if (static_cast(row[j].flag) + & static_cast(format::bold_blue)) + out << termcolor::blue << termcolor::bold; } if (this->m_align[j] == alignment::left) {