Add description to namespace when registering commands/subcommands with WP_CLI::add_command and $assoc_args #5915
Unanswered
felixmilazeck-agenturtriebwerk
asked this question in
How do I?
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
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.
Beta Was this translation helpful? Give feedback.
All reactions