Unnecessary termcolor dependency (?)
We use Termcolor for getting a couple colors, but it looks like we could get them from fmt::color, which we also use.
According to the documentation of those two libraries fmt::color always uses ANSI codes for colors, while Termcolor uses ANSI on most systems, but the windows api on windows.
Windows only started supporting ANSI codes starting with windows 10 and even there it still needs to be manually enabled by the user.
I don't know the specifics, but surely we want to be using only one option, not a mix of both, right? (There is even a hard-coded \033[...)
@AntoinePrv yes, I agree. We started out with termcolor, but later started using fmt. I would be happy if someone wants to refactor mamba to only use fmt :)
@wolfv I'm looking into it and there is the following limitation: fmt does not support both writing to an std::ostream and using colors. So we would have to do:
Console::stream() << fmt::format(
fmt::fg(fmt::terminal_color:: "Installing {} packages: {}",
pkg_mgr, fmt::join(install_instructions, " ")
);
Instead of
Console::stream() << termcolor::cyan << "Installing " << pkg_mgr
<< " packages: " << join(", ", deps) << termcolor::reset;
Which creates a temporary string.
I also want to point out that we are explicitly using fmt, while only getting it through spdlog (and that the spdlog conda package does not use the fmt package but vendors it).
#ifdef SPDLOG_FMT_EXTERNAL
#include <fmt/core.h>
#else
#include <spdlog/fmt/bundled/core.h>
#endif
I think we should add an explicit dependency on fmt since we started using it in Mamba.