Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Register an arbitrary function, closure, or method as a command #2204

Closed
danielbachhuber opened this issue Nov 13, 2015 · 2 comments
Closed
Assignees
Milestone

Comments

@danielbachhuber
Copy link
Member

For simpler definition of WP-CLI commands, it would be cool if you could specify an arbitrary callback as a command.

As an example:

WP_CLI::add_command( 'cool command', function( $args, $assoc_args ) {
    // do something
});

Documentation could be specified in the third $args parameter for WP_CLI::add_command(). However, we'd likely want to specify a schema for the documentation based on some formalization of our PHPdoc parsing.

@borekb
Copy link
Contributor

borekb commented Nov 25, 2015

Very good idea!

@danielbachhuber
Copy link
Member Author

Documentation could be specified in the third $args parameter for WP_CLI::add_command()

As it turns out, PHP's Reflection properly parses docs for closures and functions, so we can handle this as a second issue.

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

No branches or pull requests

2 participants