Last active
May 18, 2016 17:03
-
-
Save danielbachhuber/8eee070fcefe2296806be867a050f6e9 to your computer and use it in GitHub Desktop.
Generate a task list of all WP-CLI commands
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Run with: wp eval-file cmd-list.php --skip-wordpress | pbcopy | |
*/ | |
$ret = WP_CLI::launch_self( 'cli cmd-dump', array(), array( 'format' => 'json' ), true, true ); | |
$cmds = json_decode( $ret->stdout, true ); | |
$cmd_list = array(); | |
foreach( $cmds['subcommands'] as $cmd ) { | |
$cmd_list[] = $cmd['name']; | |
if ( ! empty( $cmd['subcommands'] ) ) { | |
foreach( $cmd['subcommands'] as $sub_cmd ) { | |
$cmd_list[] = $cmd['name'] . ' ' . $sub_cmd['name']; | |
if ( ! empty( $sub_cmd['subcommands'] ) ) { | |
foreach( $sub_cmd['subcommands'] as $sub_sub_cmd ) { | |
$cmd_list[] = $cmd['name'] . ' ' . $sub_cmd['name'] . ' ' . $sub_sub_cmd['name']; | |
} | |
} | |
} | |
} | |
} | |
foreach( $cmd_list as $cmd_str ) { | |
$bits = explode( ' ', $cmd_str ); | |
WP_CLI::log( '* [ ] ' . $cmd_str . ' ([current doc](http://wp-cli.org/commands/' . str_replace( ' ', '/', $cmd_str ) . '/), [file to edit](https://github.com/wp-cli/wp-cli/blob/master/php/commands/' . $bits[0] . '.php))' ); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment