Skip to content

Commit

Permalink
Improve micromamba transaction message (#2474)
Browse files Browse the repository at this point in the history
* fix: improve transaction message by giving runnable commands back

* misc: extend gitignore with cmake file generated by default when developing in jetbrains clion

* fmt: clang-format using pre-commit

* fix: move the executable back to just mamba or micromamba

* Use new context struct for prefix

---------

Co-authored-by: Hind-M <70631848+Hind-M@users.noreply.github.com>
Co-authored-by: Hind Montassif <hind.montassif@gmail.com>
  • Loading branch information
3 people authored Apr 25, 2023
1 parent 0739da2 commit b6b04e1
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ include/mamba/core/version.hpp
**/build/
**/build-*/
CMakeUserPresets.json
**/cmake-build-debug/

# CMake files that should not exists because they should be generated under a build folder
CMakeLists.txt.user
Expand Down
19 changes: 15 additions & 4 deletions libmamba/src/core/transaction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1088,15 +1088,26 @@ namespace mamba
}
else
{
// TODO: add executable name
// TODO: add environment name/prefix
LOG_INFO << "Waiting for pyc compilation to finish";
m_transaction_context.wait_for_pyc_compilation();

// Get the name of the executable used directly from the command.
const auto executable = ctx.command_params.is_micromamba ? "micromamba" : "mamba";

// Get the name of the environment
const auto environment = env_name(ctx.prefix_params.target_prefix);

Console::stream() << "\nTransaction finished\n\n"
<< "To activate this environment, use:\n\n"
<< " $ [micro]mamba activate <environment>\n\n"
<< " " << executable << " activate " << environment << "\n\n"
<< "Or to execute a single command in this environment, use:\n\n"
<< " $ [micro]mamba run -n <environment> mycommand\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);
}
Expand Down

0 comments on commit b6b04e1

Please sign in to comment.