Currently, there is no way to uninstall modules that depend on one another because Drush checks the dependency chain for each module individually, without considering any of the other modules you are uninstalling.
It's also counterintuitive that although Drupal's core ModuleInstaller::uninstall() function automatically uninstalls dependent modules, Drush (which ultimately just uses the same function) won't let you do the same thing.
Drush should automatically uninstall depending modules, same as core. I can't imagine a scenario where the current behavior is desired. The only argument I could imagine against this is that there's a small performance hit to computing the dependency chain... but we are already incurring that hit by not passing a second parameter to ModuleInstaller::uninstall().
This is a regression introduced by #925, which ostensibly had nothing to do with checking module dependencies.
Issue #1854: Allow uninstall of dependent modules.
Thanks for the PR. Hopefully @jonhattan will get a chance to look into this bug.
Others are welcome to review/test this. @jonhattan is quite busy.
Will the confirmation show the dependant modules that will also be removed? If so I think this makes sense to merge.
No this won't list dependencies. If we want to do that, we would have to manually compute the dependency chain and pass false as the second parameter to drush_module_uninstall.
I think it would be good to merge this as-is and open a follow-up issue to make that change, since the current situation is pretty bad (completely impossible to uninstall any modules with dependencies).
Actually it might not be so hard to make that change, since the existing code already builds the dependency chain, I'll try to take a look later today.
List all modules to be uninstalled.
Okay this should list all modules (including dependencies) that will be uninstalled.
Worked for me. Thanks a lot @danepowell
~/reps/drushbare (2566) $ ./drush -r ~/reps/d8 pmu file
The following extensions will be uninstalled: file, update
Do you really want to continue? (y/n): y
[ok] file was successfully uninstalled.
[ok] update was successfully uninstalled.