Skip to content

Added optional argument --exclude for plugin deactivate#195

Closed
beaucollins wants to merge 4 commits intowp-cli:masterfrom
beaucollins:plugin_deactivate_exclude
Closed

Added optional argument --exclude for plugin deactivate#195
beaucollins wants to merge 4 commits intowp-cli:masterfrom
beaucollins:plugin_deactivate_exclude

Conversation

@beaucollins
Copy link
Contributor

@beaucollins beaucollins commented Sep 13, 2019

Rebase of #149 onto origin/master on behalf of @achyuthajoy


Added optional argument --exclude for plugin deactivate --all where plugin slugs can be specified as comma-separated.

Objective: Allow users to exclude specific plugins from deactivation.
E.g. wp plugin deactivate --all --exclude=jetpack,akismet

Also, the --exclude parameter will work only if --all is specified. I've added 2 additional tests to check this feature under features/plugin-deactivate.feature

This is my first contribution to WordPress community. Suggestions and modifications to improve this are appreciated. If this can be achieved with less changes, I'm happy to learn about it as well.

-- @achyuthajoy

@achyuthajoy
Copy link
Contributor

Added --exclude argument to plugin delete and plugin uninstall with behat tests

*
* @param array $args Passed-in arguments.
* @param bool $all All flag.
* @param string $exclude Comma separated list of plugin slugs.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

$verb param seems to be missing here. Not a problem of this PR per se, but makes sense to add it while we're working on this.

Suggested change
* @param string $exclude Comma separated list of plugin slugs.
* @param string $verb Optional. Verb to use for the messages. Defaults to 'install'.
* @param string $exclude Comma separated list of plugin slugs.

*/
private function check_optional_args_and_all( $args, $all, $verb = 'install' ) {
private function check_optional_args_and_all( $args, $all, $verb = 'install', $exclude = null ) {
// Workaround for optional argument $verb
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This workaround shouldn't be needed, the argument has a default value of 'install' already.

@schlessera schlessera added command:plugin-install Related to 'plugin install' command command:plugin-delete Related to 'plugin delete' command command:plugin-deactivate Related to 'plugin deactivate' command command:plugin-uninstall Related to 'plugin uninstall' command and removed command:plugin-install Related to 'plugin install' command labels Sep 27, 2019
@schlessera
Copy link
Member

The plugin activate command is missing for the PR to cover all of the commands that have an --all flag.

@danielbachhuber
Copy link
Member

Thanks for your work on this, @beaucollins ! Closing in favor of #321

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

command:plugin-deactivate Related to 'plugin deactivate' command command:plugin-delete Related to 'plugin delete' command command:plugin-uninstall Related to 'plugin uninstall' command

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants