Skip to content

Commit 2c0b69a

Browse files
authored
Merge pull request #605 from wp-cli/copilot/add-set-command-to-docs
2 parents 1c594b8 + 9af1a2f commit 2c0b69a

39 files changed

+1377
-1
lines changed

bin/Handbook_Command.php

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -701,6 +701,29 @@ private static function gen_cmd_pages( $cmd, $parent = [], $verbose = false ) {
701701
WP_CLI::log( 'Generated commands/' . $binding['path'] . '/' );
702702
}
703703

704+
// Generate alias page if command has an alias.
705+
if ( ! empty( $cmd['alias'] ) ) {
706+
$alias_parent = $parent;
707+
$alias_parent[ count( $alias_parent ) - 1 ] = $cmd['alias'];
708+
$alias_binding = $binding;
709+
$alias_binding['synopsis'] = implode( ' ', $alias_parent );
710+
$alias_binding['path'] = implode( '/', $alias_parent );
711+
$alias_binding['description'] .= sprintf( "\n\nThis is an alias for `wp %s`.", $binding['synopsis'] );
712+
$alias_path = dirname( __DIR__ ) . '/commands/' . $alias_binding['path'];
713+
$alias_dir = dirname( $alias_path );
714+
715+
// Don't mention alias for the alias.
716+
unset( $alias_binding['alias'] );
717+
718+
if ( ! is_dir( $alias_dir ) ) {
719+
mkdir( $alias_dir, 0755, true );
720+
}
721+
file_put_contents( "$alias_path.md", self::render( 'subcmd-list.mustache', $alias_binding ) );
722+
if ( $verbose ) {
723+
WP_CLI::log( 'Generated commands/' . $alias_binding['path'] . '/ (alias)' );
724+
}
725+
}
726+
704727
if ( ! isset( $cmd['subcommands'] ) ) {
705728
return;
706729
}

bin/commands-manifest.json

Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1039,6 +1039,13 @@
10391039
"markdown_source": "https:\/\/github.com\/wp-cli\/handbook\/blob\/main\/commands\/db\/columns.md",
10401040
"repo_url": "https:\/\/github.com\/wp-cli\/db-command"
10411041
},
1042+
"db\/connect": {
1043+
"title": "db connect",
1044+
"slug": "connect",
1045+
"cmd_path": "db\/connect",
1046+
"parent": "db",
1047+
"markdown_source": "https:\/\/github.com\/wp-cli\/handbook\/blob\/main\/commands\/db\/connect.md"
1048+
},
10421049
"db\/create": {
10431050
"title": "db create",
10441051
"slug": "create",
@@ -1055,6 +1062,13 @@
10551062
"markdown_source": "https:\/\/github.com\/wp-cli\/handbook\/blob\/main\/commands\/db\/drop.md",
10561063
"repo_url": "https:\/\/github.com\/wp-cli\/db-command"
10571064
},
1065+
"db\/dump": {
1066+
"title": "db dump",
1067+
"slug": "dump",
1068+
"cmd_path": "db\/dump",
1069+
"parent": "db",
1070+
"markdown_source": "https:\/\/github.com\/wp-cli\/handbook\/blob\/main\/commands\/db\/dump.md"
1071+
},
10581072
"db\/export": {
10591073
"title": "db export",
10601074
"slug": "export",
@@ -1407,6 +1421,13 @@
14071421
"markdown_source": "https:\/\/github.com\/wp-cli\/handbook\/blob\/main\/commands\/option\/set-autoload.md",
14081422
"repo_url": "https:\/\/github.com\/wp-cli\/entity-command"
14091423
},
1424+
"option\/set": {
1425+
"title": "option set",
1426+
"slug": "set",
1427+
"cmd_path": "option\/set",
1428+
"parent": "option",
1429+
"markdown_source": "https:\/\/github.com\/wp-cli\/handbook\/blob\/main\/commands\/option\/set.md"
1430+
},
14101431
"option\/update": {
14111432
"title": "option update",
14121433
"slug": "update",
@@ -1583,6 +1604,13 @@
15831604
"markdown_source": "https:\/\/github.com\/wp-cli\/handbook\/blob\/main\/commands\/plugin\/update.md",
15841605
"repo_url": "https:\/\/github.com\/wp-cli\/extension-command"
15851606
},
1607+
"plugin\/upgrade": {
1608+
"title": "plugin upgrade",
1609+
"slug": "upgrade",
1610+
"cmd_path": "plugin\/upgrade",
1611+
"parent": "plugin",
1612+
"markdown_source": "https:\/\/github.com\/wp-cli\/handbook\/blob\/main\/commands\/plugin\/upgrade.md"
1613+
},
15861614
"plugin\/verify-checksums": {
15871615
"title": "plugin verify-checksums",
15881616
"slug": "verify-checksums",
@@ -1791,6 +1819,13 @@
17911819
"markdown_source": "https:\/\/github.com\/wp-cli\/handbook\/blob\/main\/commands\/role\/reset.md",
17921820
"repo_url": "https:\/\/github.com\/wp-cli\/role-command"
17931821
},
1822+
"scaffold\/_s": {
1823+
"title": "scaffold _s",
1824+
"slug": "_s",
1825+
"cmd_path": "scaffold\/_s",
1826+
"parent": "scaffold",
1827+
"markdown_source": "https:\/\/github.com\/wp-cli\/handbook\/blob\/main\/commands\/scaffold\/_s.md"
1828+
},
17941829
"scaffold\/block": {
17951830
"title": "scaffold block",
17961831
"slug": "block",
@@ -1807,6 +1842,13 @@
18071842
"markdown_source": "https:\/\/github.com\/wp-cli\/handbook\/blob\/main\/commands\/scaffold\/child-theme.md",
18081843
"repo_url": "https:\/\/github.com\/wp-cli\/scaffold-command"
18091844
},
1845+
"scaffold\/cpt": {
1846+
"title": "scaffold cpt",
1847+
"slug": "cpt",
1848+
"cmd_path": "scaffold\/cpt",
1849+
"parent": "scaffold",
1850+
"markdown_source": "https:\/\/github.com\/wp-cli\/handbook\/blob\/main\/commands\/scaffold\/cpt.md"
1851+
},
18101852
"scaffold\/plugin-tests": {
18111853
"title": "scaffold plugin-tests",
18121854
"slug": "plugin-tests",
@@ -1831,6 +1873,13 @@
18311873
"markdown_source": "https:\/\/github.com\/wp-cli\/handbook\/blob\/main\/commands\/scaffold\/post-type.md",
18321874
"repo_url": "https:\/\/github.com\/wp-cli\/scaffold-command"
18331875
},
1876+
"scaffold\/tax": {
1877+
"title": "scaffold tax",
1878+
"slug": "tax",
1879+
"cmd_path": "scaffold\/tax",
1880+
"parent": "scaffold",
1881+
"markdown_source": "https:\/\/github.com\/wp-cli\/handbook\/blob\/main\/commands\/scaffold\/tax.md"
1882+
},
18341883
"scaffold\/taxonomy": {
18351884
"title": "scaffold taxonomy",
18361885
"slug": "taxonomy",
@@ -2231,6 +2280,13 @@
22312280
"markdown_source": "https:\/\/github.com\/wp-cli\/handbook\/blob\/main\/commands\/theme\/status.md",
22322281
"repo_url": "https:\/\/github.com\/wp-cli\/extension-command"
22332282
},
2283+
"theme\/uninstall": {
2284+
"title": "theme uninstall",
2285+
"slug": "uninstall",
2286+
"cmd_path": "theme\/uninstall",
2287+
"parent": "theme",
2288+
"markdown_source": "https:\/\/github.com\/wp-cli\/handbook\/blob\/main\/commands\/theme\/uninstall.md"
2289+
},
22342290
"theme\/update": {
22352291
"title": "theme update",
22362292
"slug": "update",
@@ -2239,6 +2295,13 @@
22392295
"markdown_source": "https:\/\/github.com\/wp-cli\/handbook\/blob\/main\/commands\/theme\/update.md",
22402296
"repo_url": "https:\/\/github.com\/wp-cli\/extension-command"
22412297
},
2298+
"theme\/upgrade": {
2299+
"title": "theme upgrade",
2300+
"slug": "upgrade",
2301+
"cmd_path": "theme\/upgrade",
2302+
"parent": "theme",
2303+
"markdown_source": "https:\/\/github.com\/wp-cli\/handbook\/blob\/main\/commands\/theme\/upgrade.md"
2304+
},
22422305
"transient\/delete": {
22432306
"title": "transient delete",
22442307
"slug": "delete",
@@ -2823,6 +2886,13 @@
28232886
"markdown_source": "https:\/\/github.com\/wp-cli\/handbook\/blob\/main\/commands\/comment\/meta\/pluck.md",
28242887
"repo_url": "https:\/\/github.com\/wp-cli\/entity-command"
28252888
},
2889+
"comment\/meta\/set": {
2890+
"title": "comment meta set",
2891+
"slug": "set",
2892+
"cmd_path": "comment\/meta\/set",
2893+
"parent": "comment\/meta",
2894+
"markdown_source": "https:\/\/github.com\/wp-cli\/handbook\/blob\/main\/commands\/comment\/meta\/set.md"
2895+
},
28262896
"comment\/meta\/update": {
28272897
"title": "comment meta update",
28282898
"slug": "update",
@@ -3175,6 +3245,13 @@
31753245
"markdown_source": "https:\/\/github.com\/wp-cli\/handbook\/blob\/main\/commands\/network\/meta\/pluck.md",
31763246
"repo_url": "https:\/\/github.com\/wp-cli\/entity-command"
31773247
},
3248+
"network\/meta\/set": {
3249+
"title": "network meta set",
3250+
"slug": "set",
3251+
"cmd_path": "network\/meta\/set",
3252+
"parent": "network\/meta",
3253+
"markdown_source": "https:\/\/github.com\/wp-cli\/handbook\/blob\/main\/commands\/network\/meta\/set.md"
3254+
},
31783255
"network\/meta\/update": {
31793256
"title": "network meta update",
31803257
"slug": "update",
@@ -3263,6 +3340,13 @@
32633340
"markdown_source": "https:\/\/github.com\/wp-cli\/handbook\/blob\/main\/commands\/post\/meta\/pluck.md",
32643341
"repo_url": "https:\/\/github.com\/wp-cli\/entity-command"
32653342
},
3343+
"post\/meta\/set": {
3344+
"title": "post meta set",
3345+
"slug": "set",
3346+
"cmd_path": "post\/meta\/set",
3347+
"parent": "post\/meta",
3348+
"markdown_source": "https:\/\/github.com\/wp-cli\/handbook\/blob\/main\/commands\/post\/meta\/set.md"
3349+
},
32663350
"post\/meta\/update": {
32673351
"title": "post meta update",
32683352
"slug": "update",
@@ -3351,6 +3435,13 @@
33513435
"markdown_source": "https:\/\/github.com\/wp-cli\/handbook\/blob\/main\/commands\/site\/meta\/pluck.md",
33523436
"repo_url": "https:\/\/github.com\/wp-cli\/entity-command"
33533437
},
3438+
"site\/meta\/set": {
3439+
"title": "site meta set",
3440+
"slug": "set",
3441+
"cmd_path": "site\/meta\/set",
3442+
"parent": "site\/meta",
3443+
"markdown_source": "https:\/\/github.com\/wp-cli\/handbook\/blob\/main\/commands\/site\/meta\/set.md"
3444+
},
33543445
"site\/meta\/update": {
33553446
"title": "site meta update",
33563447
"slug": "update",
@@ -3407,6 +3498,13 @@
34073498
"markdown_source": "https:\/\/github.com\/wp-cli\/handbook\/blob\/main\/commands\/site\/option\/pluck.md",
34083499
"repo_url": "https:\/\/github.com\/wp-cli\/entity-command"
34093500
},
3501+
"site\/option\/set": {
3502+
"title": "site option set",
3503+
"slug": "set",
3504+
"cmd_path": "site\/option\/set",
3505+
"parent": "site\/option",
3506+
"markdown_source": "https:\/\/github.com\/wp-cli\/handbook\/blob\/main\/commands\/site\/option\/set.md"
3507+
},
34103508
"site\/option\/update": {
34113509
"title": "site option update",
34123510
"slug": "update",
@@ -3463,6 +3561,13 @@
34633561
"markdown_source": "https:\/\/github.com\/wp-cli\/handbook\/blob\/main\/commands\/term\/meta\/pluck.md",
34643562
"repo_url": "https:\/\/github.com\/wp-cli\/entity-command"
34653563
},
3564+
"term\/meta\/set": {
3565+
"title": "term meta set",
3566+
"slug": "set",
3567+
"cmd_path": "term\/meta\/set",
3568+
"parent": "term\/meta",
3569+
"markdown_source": "https:\/\/github.com\/wp-cli\/handbook\/blob\/main\/commands\/term\/meta\/set.md"
3570+
},
34663571
"term\/meta\/update": {
34673572
"title": "term meta update",
34683573
"slug": "update",
@@ -3631,6 +3736,13 @@
36313736
"markdown_source": "https:\/\/github.com\/wp-cli\/handbook\/blob\/main\/commands\/user\/meta\/pluck.md",
36323737
"repo_url": "https:\/\/github.com\/wp-cli\/entity-command"
36333738
},
3739+
"user\/meta\/set": {
3740+
"title": "user meta set",
3741+
"slug": "set",
3742+
"cmd_path": "user\/meta\/set",
3743+
"parent": "user\/meta",
3744+
"markdown_source": "https:\/\/github.com\/wp-cli\/handbook\/blob\/main\/commands\/user\/meta\/set.md"
3745+
},
36343746
"user\/meta\/update": {
36353747
"title": "user meta update",
36363748
"slug": "update",

bin/templates/subcmd-list.mustache

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# wp {{synopsis}}
22

3-
{{description}}
3+
{{description}}{{#alias}}
4+
5+
**Alias:** `{{alias}}`{{/alias}}
46

57
{{{docs}}}

commands/comment/meta/set.md

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# wp comment meta set
2+
3+
Update a meta field.
4+
5+
This is an alias for `wp comment meta update`.
6+
7+
### OPTIONS
8+
9+
See the [argument syntax](https://make.wordpress.org/cli/handbook/references/argument-syntax/) reference for a detailed explanation of the syntax conventions used.
10+
11+
<id>
12+
: The ID of the object.
13+
14+
<key>
15+
: The name of the meta field to update.
16+
17+
[<value>]
18+
: The new value. If omitted, the value is read from STDIN.
19+
20+
[\--format=<format>]
21+
: The serialization format for the value.
22+
\---
23+
default: plaintext
24+
options:
25+
- plaintext
26+
- json
27+
\---
28+
29+
### GLOBAL PARAMETERS
30+
31+
These [global parameters](https://make.wordpress.org/cli/handbook/config/) have the same behavior across all commands and affect how WP-CLI interacts with WordPress.
32+
33+
| **Argument** | **Description** |
34+
|:----------------|:-----------------------------|
35+
| `--path=<path>` | Path to the WordPress files. |
36+
| `--url=<url>` | Pretend request came from given URL. In multisite, this argument is how the target site is specified. |
37+
| `--ssh=[<scheme>:][<user>@]<host\|container>[:<port>][<path>]` | Perform operation against a remote server over SSH (or a container using scheme of "docker", "docker-compose", "docker-compose-run", "vagrant"). |
38+
| `--http=<http>` | Perform operation against a remote WordPress installation over HTTP. |
39+
| `--user=<id\|login\|email>` | Set the WordPress user. |
40+
| `--skip-plugins[=<plugins>]` | Skip loading all plugins, or a comma-separated list of plugins. Note: mu-plugins are still loaded. |
41+
| `--skip-themes[=<themes>]` | Skip loading all themes, or a comma-separated list of themes. |
42+
| `--skip-packages` | Skip loading all installed packages. |
43+
| `--require=<path>` | Load PHP file before running the command (may be used more than once). |
44+
| `--exec=<php-code>` | Execute PHP code before running the command (may be used more than once). |
45+
| `--context=<context>` | Load WordPress in a given context. |
46+
| `--[no-]color` | Whether to colorize the output. |
47+
| `--debug[=<group>]` | Show all PHP errors and add verbosity to WP-CLI output. Built-in groups include: bootstrap, commandfactory, and help. |
48+
| `--prompt[=<assoc>]` | Prompt the user to enter values for all command arguments, or a subset specified as comma-separated values. |
49+
| `--quiet` | Suppress informational messages. |

commands/comment/meta/update.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
Update a meta field.
44

5+
**Alias:** `set`
6+
57
### OPTIONS
68

79
See the [argument syntax](https://make.wordpress.org/cli/handbook/references/argument-syntax/) reference for a detailed explanation of the syntax conventions used.

commands/core/install-network.md

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
# wp core install-network
2+
3+
Transforms an existing single-site installation into a multisite installation.
4+
5+
This is an alias for `wp core multisite-convert`.
6+
7+
Creates the multisite database tables, and adds the multisite constants to wp-config.php.
8+
9+
For those using WordPress with Apache, remember to update the `.htaccess` file with the appropriate multisite rewrite rules.
10+
11+
[Review the multisite documentation](https://wordpress.org/support/article/create-a-network/) for more details about how multisite works.
12+
13+
### OPTIONS
14+
15+
See the [argument syntax](https://make.wordpress.org/cli/handbook/references/argument-syntax/) reference for a detailed explanation of the syntax conventions used.
16+
17+
[\--title=&lt;network-title&gt;]
18+
: The title of the new network.
19+
20+
[\--base=&lt;url-path&gt;]
21+
: Base path after the domain name that each site url will start with.
22+
\---
23+
default: /
24+
\---
25+
26+
[\--subdomains]
27+
: If passed, the network will use subdomains, instead of subdirectories. Doesn't work with 'localhost'.
28+
29+
[\--skip-config]
30+
: Don't add multisite constants to wp-config.php.
31+
32+
### EXAMPLES
33+
34+
$ wp core multisite-convert
35+
Set up multisite database tables.
36+
Added multisite constants to wp-config.php.
37+
Success: Network installed. Don't forget to set up rewrite rules.
38+
39+
### GLOBAL PARAMETERS
40+
41+
These [global parameters](https://make.wordpress.org/cli/handbook/config/) have the same behavior across all commands and affect how WP-CLI interacts with WordPress.
42+
43+
| **Argument** | **Description** |
44+
|:----------------|:-----------------------------|
45+
| `--path=<path>` | Path to the WordPress files. |
46+
| `--url=<url>` | Pretend request came from given URL. In multisite, this argument is how the target site is specified. |
47+
| `--ssh=[<scheme>:][<user>@]<host\|container>[:<port>][<path>]` | Perform operation against a remote server over SSH (or a container using scheme of "docker", "docker-compose", "docker-compose-run", "vagrant"). |
48+
| `--http=<http>` | Perform operation against a remote WordPress installation over HTTP. |
49+
| `--user=<id\|login\|email>` | Set the WordPress user. |
50+
| `--skip-plugins[=<plugins>]` | Skip loading all plugins, or a comma-separated list of plugins. Note: mu-plugins are still loaded. |
51+
| `--skip-themes[=<themes>]` | Skip loading all themes, or a comma-separated list of themes. |
52+
| `--skip-packages` | Skip loading all installed packages. |
53+
| `--require=<path>` | Load PHP file before running the command (may be used more than once). |
54+
| `--exec=<php-code>` | Execute PHP code before running the command (may be used more than once). |
55+
| `--context=<context>` | Load WordPress in a given context. |
56+
| `--[no-]color` | Whether to colorize the output. |
57+
| `--debug[=<group>]` | Show all PHP errors and add verbosity to WP-CLI output. Built-in groups include: bootstrap, commandfactory, and help. |
58+
| `--prompt[=<assoc>]` | Prompt the user to enter values for all command arguments, or a subset specified as comma-separated values. |
59+
| `--quiet` | Suppress informational messages. |

commands/core/multisite-convert.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
Transforms an existing single-site installation into a multisite installation.
44

5+
**Alias:** `install-network`
6+
57
Creates the multisite database tables, and adds the multisite constants to wp-config.php.
68

79
For those using WordPress with Apache, remember to update the `.htaccess` file with the appropriate multisite rewrite rules.

commands/core/update.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
Updates WordPress to a newer version.
44

5+
**Alias:** `upgrade`
6+
57
Defaults to updating WordPress to the latest version.
68

79
If you see "Error: Another update is currently in progress.", you may need to run `wp option delete core_updater.lock` after verifying another update isn't actually running.

0 commit comments

Comments
 (0)