Update CLI help text for shell command and subcommands

Co-authored-by: jjerphan <13029839+jjerphan@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot] 2025-07-04 14:03:27 +00:00
parent 1f289832f5
commit ef04de4085
3 changed files with 100 additions and 3 deletions

View File

@ -21,3 +21,100 @@ It can be used with a drop-in installation without further steps:
/path/to/micromamba create -p /tmp/env 'pytest>=8.0'
/path/to/micromamba run -p /tmp/env pytest myproject/tests
Shell Command
=============
The ``micromamba shell`` command provides functionality for launching shells and managing shell initialization scripts for environment activation.
Launching a Shell
-----------------
When used without subcommands, ``micromamba shell`` launches a new shell session in the specified environment:
.. code-block:: shell
# Launch a shell in the specified environment
micromamba shell -p /path/to/env
micromamba shell -n myenv
This is particularly useful in CI/CD environments and Docker containers where you need to work within a specific environment.
Shell Initialization Management
-------------------------------
The ``micromamba shell`` command also includes several subcommands for managing shell initialization scripts:
``micromamba shell init``
Add micromamba initialization scripts to your shell's configuration files (e.g., ``.bashrc``, ``.zshrc``).
``micromamba shell deinit``
Remove micromamba initialization scripts from your shell's configuration files.
``micromamba shell reinit``
Restore micromamba initialization scripts in your shell's configuration files.
Environment Activation Scripts
------------------------------
These subcommands generate shell-specific activation code that can be used in scripts or sourced directly:
``micromamba shell activate``
Generate activation code for the specified environment.
``micromamba shell deactivate``
Generate deactivation code to leave the current environment.
``micromamba shell reactivate``
Generate reactivation code to refresh the current environment.
``micromamba shell hook``
Generate shell hook scripts for environment activation.
.. code-block:: shell
# Generate activation code for bash
micromamba shell activate -p /path/to/env -s bash
# Generate deactivation code
micromamba shell deactivate -s bash
# Use in a script
eval "$(micromamba shell activate -p /path/to/env -s bash)"
Supported Shells
----------------
The shell command supports the following shells:
* ``bash`` - Bash shell
* ``zsh`` - Z shell
* ``fish`` - Fish shell
* ``powershell`` - PowerShell
* ``cmd.exe`` - Windows Command Prompt
* ``xonsh`` - Xonsh shell
* ``tcsh`` - Tcsh shell
* ``dash`` - Dash shell
* ``nu`` - Nu shell
* ``posix`` - POSIX-compliant shells
Common Options
--------------
``-s, --shell SHELL``
Specify the shell type. If not provided, micromamba will attempt to detect your shell automatically.
``-p, --prefix PATH``
Specify the environment by its installation path.
``-n, --name NAME``
Specify the environment by its name.
``-r, --root-prefix PATH``
Specify the root prefix (base environment location).
Platform-Specific Features
---------------------------
``micromamba shell enable_long_path_support``
On Windows, this command enables long path support, which allows working with file paths longer than 260 characters.

View File

@ -396,7 +396,7 @@ set_shell_command(CLI::App* shell_subcmd, Configuration& config)
);
set_shell_reinit_command(reinit_subsubcmd, config);
auto* hook_subsubcmd = shell_subcmd->add_subcommand("hook", "Micromamba hook scripts ");
auto* hook_subsubcmd = shell_subcmd->add_subcommand("hook", "Output shell hook scripts for environment activation");
set_shell_hook_command(hook_subsubcmd, config);
auto* acti_subsubcmd = shell_subcmd->add_subcommand(
@ -419,7 +419,7 @@ set_shell_command(CLI::App* shell_subcmd, Configuration& config)
auto* long_path_subsubcmd = shell_subcmd->add_subcommand(
"enable_long_path_support",
"Output deactivation code for the given shell"
"Enable long path support on Windows"
);
set_shell_long_path_command(long_path_subsubcmd, config);

View File

@ -39,7 +39,7 @@ set_umamba_command(CLI::App* com, mamba::Configuration& config)
com->add_flag_function("--version", print_version);
CLI::App* shell_subcom = com->add_subcommand("shell", "Generate shell init scripts");
CLI::App* shell_subcom = com->add_subcommand("shell", "Launch a shell or manage shell initialization scripts");
set_shell_command(shell_subcom, config);
CLI::App* create_subcom = com->add_subcommand("create", "Create new environment");