Add wildcard/glob pattern support to pm:install and pm:uninstall#6527
Open
philoSurfer wants to merge 1 commit intodrush-ops:14.xfrom
Open
Add wildcard/glob pattern support to pm:install and pm:uninstall#6527philoSurfer wants to merge 1 commit intodrush-ops:14.xfrom
philoSurfer wants to merge 1 commit intodrush-ops:14.xfrom
Conversation
Re-adds wildcard expansion for module names that was available in Drush 7 but lost during the Drush 9 rewrite. Module names containing '*' are expanded against the available extension list before dependency resolution. Examples: drush pm:install "views*" drush pm:uninstall "devel*" The expandWildcards() method is placed in PmTrait so both install and uninstall commands benefit. When no wildcards are present, the method returns immediately with zero overhead (no extension list lookup).
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.
Summary
Re-adds wildcard expansion for module names in
pm:installandpm:uninstallcommands. This feature existed in Drush 7 (drupal.org #779612) but was lost during the Drush 9 rewrite.Closes #6526
Changes
PmTrait::expandWildcards()— New protected method that expands*glob patterns against the available module extension list using regex matchingPmInstallCommand— CallsexpandWildcards()after CSV parsing in bothexecute()andvalidateModules()PmUninstallCommand— CallsexpandWildcards()after CSV parsing in bothexecute()andvalidateUninstall()Design Decisions
PmTraitso both install and uninstall inherit it without duplication*characters are present (no extension list lookup)*can appear anywhere in the name (prefix, suffix, or middle), not just trailingExamples
Test Plan
drush pm:install --dry-run "views*"expands to matching modulesdrush pm:uninstall --dry-run "nonexistent*"shows warningdrush pm:install admin_toolbar(no wildcard) works unchanged*in the middle work (e.g.field_*_storage)