Skip to content

Commit 5e798f3

Browse files
Remove command docs
These are now tracked in the handbook repo
1 parent 7189377 commit 5e798f3

File tree

291 files changed

+0
-13290
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

291 files changed

+0
-13290
lines changed

command.php

Lines changed: 0 additions & 92 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
*/
1616
function generate() {
1717
generate_homepage();
18-
generate_commands();
1918
}
2019
WP_CLI::add_command( 'website generate', 'WP_CLI_Org\generate' );
2120

@@ -56,91 +55,6 @@ function generate_homepage() {
5655
}
5756
WP_CLI::add_command( 'website generate-homepage', '\WP_CLI_Org\generate_homepage' );
5857

59-
/**
60-
* Generate the /commands/ page.
61-
*
62-
* @when before_wp_load
63-
*/
64-
function generate_commands() {
65-
$wp = invoke_wp_cli( 'wp --skip-packages cli cmd-dump' );
66-
67-
foreach( $wp['subcommands'] as $k => $cmd ) {
68-
if ( in_array( $cmd['name'], array( 'website', 'api-dump' ) ) ) {
69-
unset( $wp['subcommands'][ $k ] );
70-
}
71-
}
72-
$wp['subcommands'] = array_values( $wp['subcommands'] );
73-
74-
// generate main page
75-
file_put_contents( '_includes/cmd-list.html', render( 'cmd-list.mustache', $wp ) );
76-
WP_CLI::log( 'Generated /commands/' );
77-
78-
foreach ( $wp['subcommands'] as $cmd ) {
79-
gen_cmd_pages( $cmd );
80-
}
81-
WP_CLI::success( 'Generated all command pages.' );
82-
}
83-
WP_CLI::add_command( 'website generate-commands', '\WP_CLI_Org\generate_commands' );
84-
85-
function gen_cmd_pages( $cmd, $parent = array() ) {
86-
$parent[] = $cmd['name'];
87-
88-
$binding = $cmd;
89-
$binding['synopsis'] = implode( ' ', $parent );
90-
$binding['path'] = implode( '/', $parent );
91-
$path = '/commands/';
92-
$binding['breadcrumbs'] = '[Commands](' . $path . ')';
93-
foreach( $parent as $i => $p ) {
94-
$path .= $p . '/';
95-
if ( $i < ( count( $parent ) - 1 ) ) {
96-
$binding['breadcrumbs'] .= " &raquo; [{$p}]({$path})";
97-
} else {
98-
$binding['breadcrumbs'] .= " &raquo; {$p}";
99-
}
100-
}
101-
$binding['has-subcommands'] = isset( $cmd['subcommands'] ) ? array(true) : false;
102-
103-
if ( $cmd['longdesc'] ) {
104-
$docs = $cmd['longdesc'];
105-
$docs = htmlspecialchars( $docs, ENT_COMPAT, 'UTF-8' );
106-
107-
// decrease header level
108-
$docs = preg_replace( '/^## /m', '### ', $docs );
109-
110-
// escape `--` so that it doesn't get converted into `&mdash;`
111-
$docs = preg_replace( '/^(\[?)--/m', '\1\--', $docs );
112-
$docs = preg_replace( '/^\s\s--/m', ' \1\--', $docs );
113-
114-
// hack to prevent double encoding in code blocks
115-
$docs = preg_replace( '/ &lt; /', ' < ', $docs );
116-
$docs = preg_replace( '/ &gt; /', ' > ', $docs );
117-
$docs = preg_replace( '/ &lt;&lt;/', ' <<', $docs );
118-
$docs = preg_replace( '/&quot;/', '"', $docs );
119-
$docs = preg_replace( '/wp&gt; /', 'wp> ', $docs );
120-
$docs = preg_replace( '/=&gt;/', '=>', $docs );
121-
122-
// Strip global parameters -> added in footer
123-
$docs = preg_replace( '/#?## GLOBAL PARAMETERS.+/s', '', $docs );
124-
125-
$binding['docs'] = $docs;
126-
$binding['github_issues_link'] = 'https://github.com/wp-cli/wp-cli/issues?q=is%3Aopen+label%3A' . urlencode( 'command:' . str_replace( ' ', '-', $binding['synopsis'] ) ) . '+sort%3Aupdated-desc';
127-
}
128-
129-
$path = __DIR__ . "/commands/" . $binding['path'];
130-
if ( !is_dir( $path ) ) {
131-
mkdir( $path );
132-
}
133-
file_put_contents( "$path/index.md", render( 'subcmd-list.mustache', $binding ) );
134-
WP_CLI::log( 'Generated /commands/' . $binding['path'] . '/' );
135-
136-
if ( !isset( $cmd['subcommands'] ) )
137-
return;
138-
139-
foreach ( $cmd['subcommands'] as $subcmd ) {
140-
gen_cmd_pages( $subcmd, $parent );
141-
}
142-
}
143-
14458
function invoke_wp_cli( $cmd ) {
14559
ob_start();
14660
system( "WP_CLI_CONFIG_PATH=/dev/null $cmd", $return_code );
@@ -153,9 +67,3 @@ function invoke_wp_cli( $cmd ) {
15367

15468
return json_decode( $json, true );
15569
}
156-
157-
function render( $path, $binding ) {
158-
$m = new Mustache_Engine;
159-
$template = file_get_contents( __DIR__ . "/_templates/$path" );
160-
return $m->render( $template, $binding );
161-
}

commands/blog/create/index.md

Lines changed: 0 additions & 5 deletions
This file was deleted.

commands/blog/delete/index.md

Lines changed: 0 additions & 5 deletions
This file was deleted.

commands/blog/empty/index.md

Lines changed: 0 additions & 5 deletions
This file was deleted.

commands/blog/index.md

Lines changed: 0 additions & 5 deletions
This file was deleted.

commands/cache/add/index.md

Lines changed: 0 additions & 45 deletions
This file was deleted.

commands/cache/decr/index.md

Lines changed: 0 additions & 41 deletions
This file was deleted.

commands/cache/delete/index.md

Lines changed: 0 additions & 35 deletions
This file was deleted.

commands/cache/flush/index.md

Lines changed: 0 additions & 29 deletions
This file was deleted.

commands/cache/get/index.md

Lines changed: 0 additions & 35 deletions
This file was deleted.

0 commit comments

Comments
 (0)