@@ -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
0 commit comments