mirror of https://github.com/mamba-org/mamba.git
Fix output (#3428)
Only print activation message when target prefix is not active
This commit is contained in:
parent
4f73c92713
commit
1bdf6f1748
|
@ -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,19 +446,27 @@ 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);
|
||||||
|
|
||||||
Console::stream() << "\nTransaction finished\n\n"
|
// Check if the target prefix is active
|
||||||
"To activate this environment, use:\n\n"
|
if (util::get_env("CONDA_PREFIX") == ctx.prefix_params.target_prefix)
|
||||||
" "
|
{
|
||||||
<< executable << " activate " << environment
|
Console::stream() << "\nTransaction finished\n";
|
||||||
<< "\n\n"
|
}
|
||||||
"Or to execute a single command in this environment, use:\n\n"
|
else
|
||||||
" "
|
{
|
||||||
<< executable
|
Console::stream() << "\nTransaction finished\n\n"
|
||||||
<< " run "
|
"To activate this environment, use:\n\n"
|
||||||
// Use -n or -p depending on if the env_name is a full prefix or just
|
" "
|
||||||
// a name.
|
<< executable << " activate " << environment
|
||||||
<< (environment == ctx.prefix_params.target_prefix ? "-p " : "-n ")
|
<< "\n\n"
|
||||||
<< environment << " mycommand\n";
|
"Or to execute a single command in this environment, use:\n\n"
|
||||||
|
" "
|
||||||
|
<< executable
|
||||||
|
<< " run "
|
||||||
|
// Use -n or -p depending on if the env_name is a full prefix or just
|
||||||
|
// a name.
|
||||||
|
<< (environment == ctx.prefix_params.target_prefix ? "-p " : "-n ")
|
||||||
|
<< environment << " mycommand\n";
|
||||||
|
}
|
||||||
|
|
||||||
prefix.history().add_entry(m_history_entry);
|
prefix.history().add_entry(m_history_entry);
|
||||||
return true;
|
return true;
|
||||||
|
|
Loading…
Reference in New Issue