Fix output (#3428)

Only print activation message when target prefix is not active
This commit is contained in:
Hind-M 2024-09-02 14:25:20 +02:00 committed by GitHub
parent 4f73c92713
commit 1bdf6f1748
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 22 additions and 13 deletions

View File

@ -30,6 +30,7 @@
#include "mamba/core/util_os.hpp" #include "mamba/core/util_os.hpp"
#include "mamba/solver/libsolv/database.hpp" #include "mamba/solver/libsolv/database.hpp"
#include "mamba/specs/match_spec.hpp" #include "mamba/specs/match_spec.hpp"
#include "mamba/util/environment.hpp"
#include "mamba/util/variant_cmp.hpp" #include "mamba/util/variant_cmp.hpp"
#include "solver/helpers.hpp" #include "solver/helpers.hpp"
@ -445,6 +446,13 @@ namespace mamba
// Get the name of the environment // Get the name of the environment
const auto environment = env_name(ctx); const auto environment = env_name(ctx);
// Check if the target prefix is active
if (util::get_env("CONDA_PREFIX") == ctx.prefix_params.target_prefix)
{
Console::stream() << "\nTransaction finished\n";
}
else
{
Console::stream() << "\nTransaction finished\n\n" Console::stream() << "\nTransaction finished\n\n"
"To activate this environment, use:\n\n" "To activate this environment, use:\n\n"
" " " "
@ -458,6 +466,7 @@ namespace mamba
// a name. // a name.
<< (environment == ctx.prefix_params.target_prefix ? "-p " : "-n ") << (environment == ctx.prefix_params.target_prefix ? "-p " : "-n ")
<< environment << " mycommand\n"; << environment << " mycommand\n";
}
prefix.history().add_entry(m_history_entry); prefix.history().add_entry(m_history_entry);
return true; return true;