Skip to content

Conversation

@scribu
Copy link
Member

@scribu scribu commented Nov 2, 2012

I'm working on a wp-cli command for Co-Authors Plus, and would love to package a man file with the plugin. As far as I can tell, wp-cli only supports man files packaged with the project. Is there something I'm missing?

@scribu
Copy link
Member

scribu commented Nov 1, 2012

I was just thinking about this. We could add a third parametert WP_CLI::add_command().

@danielbachhuber
Copy link
Member Author

What about looking for an appropriately named file in the plugin dir?

@scribu
Copy link
Member

scribu commented Nov 1, 2012

Because add_command() doesn't know if the command is defined in a plugin,
in a theme, etc. so you need to specify the path explicitly.

On Thursday, November 1, 2012, Daniel Bachhuber wrote:

What about looking for an appropriately named file in the plugin dir?


Reply to this email directly or view it on GitHubhttps://github.com//issues/200#issuecomment-9988892.

http://scribu.net

@danielbachhuber
Copy link
Member Author

That makes sense. Although, would it be possible to build the man page from PHPdoc? Having to include a build script to turn .txt into man seems like a pain. Correct me if I'm not understanding things correctly.

@scribu
Copy link
Member

scribu commented Nov 2, 2012

Do you know of a PHP library that generates man pages from PHPdoc?

@scribu
Copy link
Member

scribu commented Nov 2, 2012

With the current man-dirs branch, it would look something like this:

WP_CLI::add_man_dir( dirname(__FILE__) . '/man/', dirname(__FILE__) . '/man-src/' );

WP_CLI::add_command( 'foo', 'Foo_Command' );

...

and to generate the man pages, you'd call wp foo --man.

The only concern is that when generating, it has to look through all the man dirs to find the source. OTOH, if each command would define it's own man dir, it would be tricky to traverse back up from a subcommand to access it.

@scribu scribu merged commit dfbd5a3 into master Nov 3, 2012
@danielbachhuber
Copy link
Member Author

Cool, looks good.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants