fix: Remove duplicate deactivate from shell completion - #4371
Merged
Conversation
When implementing the shell completion, the "deactivate" command is introduced manually in add_activate_completion(). When first introduced by 821de6b (also complete for deactivate command (mamba-org#1557), 2022-03-03) this was needed (although probably in the wrong function), because micromamba didn't have a proper "deactivate" command. However, commit 5206c2a (fix: Add `deactivate` command to the help message (mamba-org#4350), 2026-07-29) added this missing command to set_umamba_command() (that is also used for handling the "completer" command), but it didn't remove the extra "deactivate". Because of that, running the autocompletion triggers the following error: terminate called after throwing an instance of 'CLI::OptionAlreadyAdded' what(): subcommand name or alias matches existing subcommand: deactivate is already added Drop the manual and redundant addition of "deactivate" command in the completer implementation, so the autocompletion gets back to working as expected. Fixes: 5206c2a (fix: Add `deactivate` command to the help message (mamba-org#4350), 2026-07-29) Signed-off-by: Henrique F. Simoes <henrique.simoes@lnls.br>
jjerphan
approved these changes
Aug 6, 2026
jjerphan
left a comment
Member
There was a problem hiding this comment.
Good catch! I can reproduce it.
Exercise top-level, prefix, env-name, shell, and option completion so a duplicate deactivate subcommand (CLI::OptionAlreadyAdded) cannot regress.
Contributor
Author
|
@jjerphan, thanks for the review and for adding the missing test to avoid future regressions. ;) |
Member
|
Thank you for this fix, @henriquesimoes. We have been lucky to include it as part of 2.9.0. :) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
When implementing the shell completion, the "deactivate" command is introduced manually in add_activate_completion(). When first introduced by 821de6b (also complete for deactivate command (#1557), 2022-03-03) this was needed (although probably in the wrong function), because micromamba didn't have a proper "deactivate" command.
However, commit 5206c2a (fix: Add
deactivatecommand to the help message (#4350), 2026-07-29) added this missing command to set_umamba_command() (that is also used for handling the "completer" command), but it didn't remove the extra "deactivate". Because of that, running the autocompletion triggers the following error:Drop the manual and redundant addition of "deactivate" command in the completer implementation, so the autocompletion gets back to working as expected.
Fixes: 5206c2a (fix: Add
deactivatecommand to the help message (#4350), 2026-07-29)Type of Change
Checklist
pre-commit run --alllocally in the source folder and confirmed that there are no linter errors.