Skip to content

Commit e092d99

Browse files
committed
read docs from 'longdesc' property, instead of looking for doc files
1 parent 15f086e commit e092d99

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed

Phakefile.php

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,17 +37,16 @@ function generate_synopsis( $command, $path = '' ) {
3737
generate_synopsis( invoke_wp_cli( 'wp cli cmd-dump', $app ) );
3838
});
3939

40-
function gen_cmd_pages( $wp_cli_path, $cmd, $parent = array() ) {
40+
function gen_cmd_pages( $cmd, $parent = array() ) {
4141
$parent[] = $cmd['name'];
4242

4343
$binding = $cmd;
4444
$binding['synopsis'] = implode( ' ', $parent );
4545
$binding['path'] = implode( '/', $parent );
4646
$binding['has-subcommands'] = isset( $cmd['subcommands'] ) ? array(true) : false;
4747

48-
$docs_path = $wp_cli_path . '/man-src/' . implode( '-', $parent ) . '.txt';
49-
if ( is_readable( $docs_path ) ) {
50-
$docs = file_get_contents( $docs_path );
48+
if ( $cmd['longdesc'] ) {
49+
$docs = $cmd['longdesc'];
5150
$docs = preg_replace( '/^## /m', '### ', $docs );
5251
$binding['docs'] = $docs;
5352
}
@@ -60,7 +59,7 @@ function gen_cmd_pages( $wp_cli_path, $cmd, $parent = array() ) {
6059
return;
6160

6261
foreach ( $cmd['subcommands'] as $subcmd ) {
63-
gen_cmd_pages( $wp_cli_path, $subcmd, $parent );
62+
gen_cmd_pages( $subcmd, $parent );
6463
}
6564
}
6665

@@ -74,7 +73,7 @@ function gen_cmd_pages( $wp_cli_path, $cmd, $parent = array() ) {
7473
system( sprintf( 'rm -rf %s/commands/*/', escapeshellarg( __DIR__ ) ) );
7574

7675
foreach ( $wp['subcommands'] as $cmd ) {
77-
gen_cmd_pages( $app['path'], $cmd );
76+
gen_cmd_pages( $cmd );
7877
}
7978
});
8079

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
3. Build:
88

99
```bash
10-
vendor/bin/phake path=/path/to/wp-cli-dir
10+
vendor/bin/phake
1111
```
1212

1313
### Preview locally

0 commit comments

Comments
 (0)