-
Notifications
You must be signed in to change notification settings - Fork 1k
Closed
Labels
Description
Bug Report
- Yes, I reviewed the contribution guidelines.
- Yes, more specifically, I reviewed the guidelines on how to write clear bug reports.
Describe the current, buggy behavior
Adding a custom subcommand of a native command with WP_CLI::add_command() works fine, except at least for the db command.
Describe how other contributors can replicate this bug
- create a custom command
- register it as a subcommand to the
dbcommand (see code snippet below) - see the error message
Adding a subcommand for core:
WP_CLI::add_command(
'core foo', static function () {
WP_CLI::success('foo');
}
);
// Success: fooAdding a subcommand for db:
WP_CLI::add_command(
'db foo', static function () {
WP_CLI::success('foo');
}
);
// Error: 'foo' is not a registered subcommand of 'db'. See 'wp help db' for available subcommand.Describe what you expect as the correct outcome
The subcommand works, outputting "Success: foo".
Let us know what environment you are running this on
OS: Linux 5.10.109-0-virt #1-Alpine SMP Mon, 28 Mar 2022 11:20:52 +0000 x86_64
Shell:
PHP binary: /usr/bin/php8.0
PHP version: 8.0.24
php.ini used: /etc/php/8.0/cli/php.ini
MySQL binary: /usr/bin/mysql
MySQL version: mysql Ver 15.1 Distrib 10.5.15-MariaDB, for debian-linux-gnu (x86_64) using EditLine wrapper
SQL modes: STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
WP-CLI root dir: phar://wp-cli.phar/vendor/wp-cli/wp-cli
WP-CLI vendor dir: phar://wp-cli.phar/vendor
WP_CLI phar path: /var/www/html
WP-CLI packages dir: /home/[redacted]/.wp-cli/packages/
WP-CLI cache dir: /home/[redacted]/.wp-cli/cache
WP-CLI global config:
WP-CLI project config: /var/www/html/wp-cli.yml
WP-CLI version: 2.7.1
(This is DDEV v1.21.2 on macOS 11.7.)
Provide additional context/screenshots
I haven't tested all native commands if adding subcommands works.