buddypress / wp-cli-buddypress

WP-CLI Community Package of BuddyPress commands
GNU General Public License v3.0
47 stars 19 forks source link

Missing subcommands #64

Closed modelm closed 6 years ago

modelm commented 6 years ago

I'm using:

PHP 7.2.4 WP-CLI 1.5.0 BuddyPress 2.9.3 WordPress 4.9.2

I installed this package like this:

wp package install buddypress/wp-cli-buddypress

When I try to use a command that consists of more than two words e.g. bp group member I get an error:

Error: 'member' is not a registered subcommand of 'bp group'. See 'wp help bp group' for available subcommands.

I noticed that all three-word commands are affected. Just running wp bp only shows me two-word commands:

$ wp bp
usage: wp bp activity <command>
   or: wp bp component <command>
   or: wp bp email <command>
   or: wp bp friend <command>
   or: wp bp group <command>
   or: wp bp member <command>
   or: wp bp message <command>
   or: wp bp signup <command>
   or: wp bp tool <command>
   or: wp bp xprofile <command>

See 'wp help bp <command>' for more information on a specific command.

And the three-word commands are apparently not registered as subcommands since they're missing from this list as well:

$ wp bp group
usage: wp bp group create --name=<name> [--slug=<slug>] [--description=<description>] [--creator-id=<creator-id>] [--slug=<slug>] [--status=<status>] [--enable-forum=<enable-forum>] [--date-created=<date-created>] [--silent] [--porcelain]
   or: wp bp group delete <group-id>... [--yes]
   or: wp bp group generate [--count=<number>] [--status=<status>] [--creator-id=<creator-id>] [--enable-forum=<enable-forum>]
   or: wp bp group get <group-id> [--fields=<fields>] [--format=<format>]
   or: wp bp group list [--<field>=<value>] [--fields=<fields>] [--user-id=<user>] [--orderby=<orderby>] [--order=<order>] [--format=<format>] [--count=<number>]
   or: wp bp group update <group-id>... [--<field>=<value>]

See 'wp help bp group <command>' for more information on a specific command.

If I change the second word from group to something unique like groupp in wp-cli-bp.php then I can see & run the command as expected:

$ wp bp groupp
usage: wp bp groupp member <command>

See 'wp help bp groupp <command>' for more information on a specific command.

I also tried replacing the installed buddypress/wp-cli-buddypress package with a clone of the latest master branch and had the same problem.

renatonascalves commented 6 years ago

In all fairness, this is not a bug in wp-cli-buddpress per se. I had this problem too in my local development but not on sites/server I installed the package into.

So my guess would be this is an environment bug with wp-cli instead of the package itself. I've found several similar cases with other packages and its commands but so far I don't have a possible explanation for why this is happening.