Dark Mode

Skip to content

Navigation Menu

Sign in
Appearance settings
wp-cli

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Add description to namespace when registering commands/subcommands with WP_CLI::add_command and $assoc_args #5915

Unanswered
Add description to namespace when registering commands/subcommands with WP_CLI::add_command and $assoc_args #5915
Mar 7, 2024 * 0 comments
Return to top
Discussion options

Hello there!

My project structure requires that description and synopsis of WP_CLI commands are defined by the $assoc_args array.

Due to the general structure, it is also not possible to build the classes in which the command logic is located differently. A command extends an abstract command class. In this abstract class there is an __invoke method which calls the handle function of the subclass. For example, I have a namespace 'my-namespace' and a command 'my-namespace my-command'. In both add_class calls I pass the classes as callables.

However, this throws the error "'my-namespace' can't have subcommands".

Any help would be greatly appreciated. Unfortunately I could not find anything in the documentation.

You must be logged in to vote

Replies: 0 comments

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
How do I?
Labels
None yet
1 participant